enable/disable cq response

Enable and disable CQ response via GUI. Also moved settings to settings modal - with a small redesign. Auto updater still WIP
This commit is contained in:
dj2ls 2022-04-18 17:17:53 +02:00
parent b1cebf0905
commit a90abb122f
13 changed files with 1523 additions and 40 deletions

View file

@ -57,7 +57,7 @@ add_test(NAME highsnr_stdio_P_P_single
PATH=$PATH:${CODEC2_BUILD_DIR}/src;
cd ${CMAKE_CURRENT_SOURCE_DIR}/test;
python3 test_tx.py --mode datac0 --delay 500 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS} |
python3 test_rx.py --mode datac0 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS}")
python3 test_rx.py --debug --mode datac0 --framesperburst ${FRAMESPERBURST} --bursts ${BURSTS}")
set_tests_properties(highsnr_stdio_P_P_single PROPERTIES PASS_REGULAR_EXPRESSION "RECEIVED BURSTS: ${BURSTS} RECEIVED FRAMES: ${FRAMESPERBURST}")
add_test(NAME highsnr_stdio_P_P_multi

View file

@ -209,7 +209,7 @@ exports.getDaemonState = function() {
// START TNC
// ` `== multi line string
exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, devicename, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwith_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level) {
exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, devicename, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwith_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level, respond_to_cq) {
var json_command = JSON.stringify({
type: 'set',
command: 'start_tnc',
@ -235,7 +235,8 @@ exports.startTNC = function(mycall, mygrid, rx_audio, tx_audio, radiocontrol, de
low_bandwith_mode : low_bandwith_mode,
tuning_range_fmin : tuning_range_fmin,
tuning_range_fmax : tuning_range_fmax,
tx_audio_level : tx_audio_level
tx_audio_level : tx_audio_level,
respond_to_cq : respond_to_cq
}]
})

View file

@ -76,7 +76,8 @@ const configDefaultSettings = '{\
"beacon_interval" : 5,\
"received_files_folder" : "None",\
"tuning_range_fmin" : "-50.0",\
"tuning_range_fmax" : "50.0"\
"tuning_range_fmax" : "50.0",\
"respond_to_cq" : "True" \
}';
if (!fs.existsSync(configPath)) {

View file

@ -110,8 +110,9 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
document.getElementById("scatterSwitch").value = config.enable_scatter;
document.getElementById("fftSwitch").value = config.enable_fft;
document.getElementById("500HzModeSwitch").value = config.low_bandwith_mode;
document.getElementById("fskModeSwitch").value = config.enable_fsk;
//document.getElementById("500HzModeSwitch").value = config.low_bandwith_mode;
//document.getElementById("fskModeSwitch").value = config.enable_fsk;
//document.getElementById("respondCQSwitch").value = config.respond_to_cq;
document.getElementById("received_files_folder").value = config.received_files_folder;
@ -140,6 +141,12 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
} else {
document.getElementById("fskModeSwitch").checked = false;
}
if(config.respond_to_cq == 'True'){
document.getElementById("respondCQSwitch").checked = true;
} else {
document.getElementById("respondCQSwitch").checked = false;
}
// theme selector
if(config.theme != 'default'){
@ -509,6 +516,17 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
}
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
});
// enable response to cq clicked
document.getElementById("respondCQSwitch").addEventListener("click", () => {
if(document.getElementById("respondCQSwitch").checked == true){
config.respond_to_cq = "True";
} else {
config.respond_to_cq = "False";
}
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
});
// enable fsk Switch clicked
document.getElementById("fskModeSwitch").addEventListener("click", () => {
@ -630,6 +648,13 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
} else {
var enable_fsk = "False";
}
if (document.getElementById("respondCQSwitch").checked == true){
var respond_to_cq = "True";
} else {
var respond_to_cq = "False";
}
// loop through audio device list and select
for(i = 0; i < document.getElementById("audio_input_selectbox").length; i++) {
@ -697,9 +722,8 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
config.enable_fsk = enable_fsk;
config.low_bandwith_mode = low_bandwith_mode;
config.tx_audio_level = tx_audio_level;
config.respond_to_cq = respond_to_cq;
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
@ -717,7 +741,7 @@ document.getElementById('openReceivedFilesFolder').addEventListener('click', ()
*/
daemon.startTNC(callsign_ssid, mygrid, rx_audio, tx_audio, radiocontrol, deviceid, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwith_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level);
daemon.startTNC(callsign_ssid, mygrid, rx_audio, tx_audio, radiocontrol, deviceid, deviceport, pttprotocol, pttport, serialspeed, data_bits, stop_bits, handshake, rigctld_ip, rigctld_port, enable_fft, enable_scatter, low_bandwith_mode, tuning_range_fmin, tuning_range_fmax, enable_fsk, tx_audio_level, respond_to_cq);
})

View file

@ -80,7 +80,7 @@ client.on('error', function(data) {
ipcRenderer.send('request-update-tnc-state', Data);
ipcRenderer.send('request-update-tnc-connection', {tnc_connection : client.readyState});
client.destroy();
setTimeout(connectTNC, 500)
setTimeout(connectTNC, 1500)
// setTimeout( function() { exports.connectTNC(tnc_host, tnc_port); }, 2000 );
});

View file

@ -86,8 +86,8 @@
</button>
</span>
<span data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-html="true" title="Settings and Info">
<button type="button" id="infoModalButton" data-bs-toggle="modal" data-bs-target="#infoModal" class="btn btn-sm btn-secondary">
<i class="bi bi-sliders" style="font-size: 1rem; color: white;"></i>
<button type="button" id="infoModalButton" data-bs-toggle="modal" data-bs-target="#infoModal" class="btn btn-sm btn-secondary"><strong>Settings </strong>
<i class="bi bi-sliders" style="font-size: 1rem; color: white;"></i>
</button>
</span>
@ -322,7 +322,7 @@
-->
<input type="radio" class="btn-check" name="radio-control-switch" id="radio-control-switch3" autocomplete="off">
<label class="btn btn-sm btn-outline-secondary" for="radio-control-switch3"><strong>rigctld</strong>
<label class="btn btn-sm btn-outline-secondary" for="radio-control-switch3"><strong><i class="bi bi-ethernet"></i></strong>
</label>
</div>
<div class="btn-group" role="group" data-bs-placement="bottom" data-bs-toggle="tooltip" data-bs-html="true" title="Set advanced hamlib settings like stop_bits and data_bits or a different port for a PTT device">
@ -690,7 +690,7 @@
</div>
-->
<div id="radio-control-rigctld">
<div class="input-group input-group-sm mb-1"> <span class="input-group-text" id="basic-addon1">IP</span>
<div class="input-group input-group-sm mb-1"> <span class="input-group-text" id="basic-addon1">Rigctld IP</span>
<input type="text" class="form-control" placeholder="rigctld IP" id="hamlib_rigctld_ip" aria-label="Device IP" aria-describedby="basic-addon1"> <span class="input-group-text" id="basic-addon1">:</span>
<input type="text" class="form-control" placeholder="rigctld port" id="hamlib_rigctld_port" aria-label="Device Port" aria-describedby="basic-addon1">
</div>
@ -757,7 +757,8 @@
<div class="col">
<div class="card text-dark mb-0">
<div class="card-header p-1">
<i class="bi bi-sliders2" style="font-size: 1rem; color: black;"></i> <strong>Auto-Updater</strong>
<i class="bi bi-cloud-download" style="font-size: 1rem; color: black;"></i> <strong>Auto-Updater</strong>
</div>
<div class="card-body p-2 mb-1">
<button class="btn btn-secondary btn-sm" id="updater_channel" type="button" disabled>...</button>
@ -1230,12 +1231,12 @@
<div class="modal-dialog modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">App settings</h5>
<h5 class="modal-title">Settings</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="input-group input-group-sm mb-1"> <span class="input-group-text" id="basic-addon1">Theme</span>
<select class="form-select form-select-sm" id="theme_selector">
<div class="input-group input-group-sm mb-1"> <span class="input-group-text w-50" id="basic-addon1">Theme</span>
<select class="form-select form-select-sm w-50" id="theme_selector">
<option value="default">Default</option>
<option value="cerulean">Cerulean</option>
<option value="cosmo">Cosmo</option>
@ -1265,8 +1266,8 @@
</select>
</div>
<div class="input-group input-group-sm mb-1"> <span class="input-group-text" id="basic-addon1">Update channel</span>
<select class="form-select form-select-sm" id="update_channel_selector">
<div class="input-group input-group-sm mb-1"> <span class="input-group-text w-50" id="basic-addon1">Update channel</span>
<select class="form-select form-select-sm w-50" id="update_channel_selector">
<option value="latest">stable</option>
<option value="beta">beta</option>
<option value="alpha">alpha</option>
@ -1274,13 +1275,13 @@
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text" for="inputGroupFile02">Received files folder</label>
<input type="text" class="form-control" id="received_files_folder">
<label class="input-group-text w-50" for="inputGroupFile02">Received files folder</label>
<input type="text" class="form-control w-50" id="received_files_folder">
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text">Tuning range</label>
<label class="input-group-text w-25">Tuning range</label>
<label class="input-group-text">fmin</label>
<select class="form-select form-select-sm" id="tuning_range_fmin">
<option value="-50.0">-50.0</option>
@ -1303,8 +1304,8 @@
<div class="input-group input-group-sm mb-1">
<label class="input-group-text">Enable FSK mode</label>
<label class="input-group-text">
<label class="input-group-text w-50">Enable FSK mode</label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline ms-2">
<input class="form-check-input" type="checkbox" id="fskModeSwitch" disabled>
<label class="form-check-label" for="fskModeSwitch">not available, yet</label>
@ -1313,33 +1314,41 @@
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text">Enable Waterfall data</label>
<label class="input-group-text">
<label class="input-group-text w-50">Enable Waterfall data</label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline">
<input class="form-check-input" type="checkbox" id="fftSwitch">
<label class="form-check-label" for="fftSwitch">Waterfall</label>
</div>
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text">Enable Scatter diagram data</label>
<label class="input-group-text">
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable Scatter diagram data</label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline">
<input class="form-check-input" type="checkbox" id="scatterSwitch">
<label class="form-check-label" for="scatterSwitch">Scatter</label>
</div>
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text">Enable 500Hz mode</label>
<label class="input-group-text">
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Enable 500Hz mode</label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline">
<input class="form-check-input" type="checkbox" id="500HzModeSwitch">
<label class="form-check-label" for="500HzModeSwitch">500Hz</label>
</div>
</label>
</div>
<div class="input-group input-group-sm mb-1">
<label class="input-group-text w-50">Respond to CQ</label>
<label class="input-group-text bg-white w-50">
<div class="form-check form-switch form-check-inline">
<input class="form-check-input" type="checkbox" id="respondCQSwitch">
<label class="form-check-label" for="respondCQSwitch">QRV</label>
</div>
</label>
</div>

1439
gui/src/index.html~ Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

View file

@ -138,6 +138,9 @@ class DAEMON():
# data[18] low_bandwith_mode
# data[19] tuning_range_fmin
# data[20] tuning_range_fmax
# data[21] enable FSK
# data[22] tx-audio-level
# data[23] respond_to_cq
if data[0] == 'STARTTNC':
structlog.get_logger("structlog").warning("[DMN] Starting TNC", rig=data[5], port=data[6])
@ -222,7 +225,10 @@ class DAEMON():
options.append('--tx-audio-level')
options.append(data[22])
if data[23] == 'True':
options.append('--qrv')
# try running tnc from binary, else run from source

View file

@ -1670,8 +1670,8 @@ class DATA():
structlog.get_logger("structlog").info("[TNC] CQ RCVD [" + str(dxcallsign, 'utf-8') + "]["+ str(dxgrid, 'utf-8') +"] ", snr=static.SNR)
helpers.add_to_heard_stations(dxcallsign, dxgrid, 'CQ CQ CQ', static.SNR, static.FREQ_OFFSET, static.HAMLIB_FREQUENCY)
# TODO: Add configuration option to enable responding to CQ.
self.transmit_qrv()
if static.RESPOND_TO_CQ:
self.transmit_qrv()
def transmit_qrv(self):

View file

@ -70,6 +70,7 @@ if __name__ == '__main__':
PARSER.add_argument('--fft', dest="send_fft", action="store_true", help="Send fft information via network")
PARSER.add_argument('--500hz', dest="low_bandwith_mode", action="store_true", help="Enable low bandwith mode ( 500 Hz only )")
PARSER.add_argument('--fsk', dest="enable_fsk", action="store_true", help="Enable FSK mode for ping, beacon and CQ")
PARSER.add_argument('--qrv', dest="enable_respond_to_cq", action="store_true", help="Enable sending a QRV frame if CQ received")
PARSER.add_argument('--tuning_range_fmin', dest="tuning_range_fmin", choices=[-50.0, -100.0, -150.0, -200.0, -250.0], default=-50.0, help="Tuning range fmin", type=float)
PARSER.add_argument('--tuning_range_fmax', dest="tuning_range_fmax", choices=[50.0, 100.0, 150.0, 200.0, 250.0], default=50.0, help="Tuning range fmax", type=float)
PARSER.add_argument('--tx-audio-level', dest="tx_audio_level", default=50, help="Set the tx audio level at an early stage", type=int)
@ -109,7 +110,7 @@ if __name__ == '__main__':
static.TUNING_RANGE_FMIN = ARGS.tuning_range_fmin
static.TUNING_RANGE_FMAX = ARGS.tuning_range_fmax
static.TX_AUDIO_LEVEL = ARGS.tx_audio_level
static.RESPOND_TO_CQ = ARGS.enable_respond_to_cq
# we need to wait until we got all parameters from argparse first before we can load the other modules
import sock

View file

@ -537,7 +537,8 @@ def process_daemon_commands(data):
tuning_range_fmin, \
tuning_range_fmax, \
enable_fsk, \
tx_audio_level \
tx_audio_level, \
respond_to_cq \
])
command_response("start_tnc", True)

View file

@ -67,6 +67,7 @@ FREQ_OFFSET = 0
SCATTER = []
ENABLE_SCATTER = False
ENABLE_FSK = False
RESPOND_TO_CQ = False
# ---------------------------------
# Audio Defaults