From 7a93f0a824c0a80329483be2f487dba4b154a0a6 Mon Sep 17 00:00:00 2001 From: dj2ls Date: Thu, 17 Feb 2022 08:32:19 +0100 Subject: [PATCH] fixed callsign detection and default config --- gui/main.js | 16 ++++++++-------- gui/preload-main.js | 24 ++++++++++++------------ tnc/data_handler.py | 8 ++++---- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/gui/main.js b/gui/main.js index 8fbd21ec..cd7279a1 100644 --- a/gui/main.js +++ b/gui/main.js @@ -30,17 +30,17 @@ var configContent = ` "mygrid": "JN40aa", "deviceid": "RIG_MODEL_DUMMY_NOVFO", "deviceport": "/dev/ttyACM1", - "serialspeed": "9600", - "ptt": "USB", + "serialspeed_direct": "9600", "spectrum": "waterfall", "tnclocation": "localhost", - "stop_bits" : "1", - "data_bits" : "8", - "handshake" : "None", - "radiocontrol" : "direct", + "stop_bits_direct" : "1", + "data_bits_direct" : "8", + "handshake_direct" : "None", + "radiocontrol" : "disabled", "deviceport_rigctl" : "3", "deviceid_rigctl" : "3", "serialspeed_rigctl" : "9600", + "pttprotocol_direct" : "USB", "pttprotocol_rigctl" : "USB", "rigctld_port" : "4532", "rigctld_ip" : "127.0.0.1", @@ -48,8 +48,8 @@ var configContent = ` "enable_fft" : "False", "low_bandwith_mode" : "False", "theme" : "default", - "screen_height" : 1050, - "screen_width" : 430 + "screen_height" : 430, + "screen_width" : 1050 } `; if (!fs.existsSync(configPath)) { diff --git a/gui/preload-main.js b/gui/preload-main.js index 377dedaa..99a2a5ab 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -64,8 +64,8 @@ window.addEventListener('DOMContentLoaded', () => { document.getElementById("myGrid").value = config.mygrid; document.getElementById('hamlib_deviceid').value = config.deviceid; - document.getElementById('hamlib_serialspeed').value = config.serialspeed; - document.getElementById('hamlib_ptt_protocol').value = config.pttprotocol; + document.getElementById('hamlib_serialspeed').value = config.serialspeed_direct; + document.getElementById('hamlib_ptt_protocol').value = config.pttprotocol_direct; document.getElementById("hamlib_rigctld_ip").value = config.rigctld_ip; document.getElementById("hamlib_rigctld_port").value = config.rigctld_port; @@ -74,11 +74,11 @@ window.addEventListener('DOMContentLoaded', () => { document.getElementById("hamlib_serialspeed_rigctl").value = config.serialspeed_rigctl; document.getElementById("hamlib_ptt_protocol_rigctl").value = config.pttprotocol_rigctl; - document.getElementById('hamlib_serialspeed_advanced').value = config.serialspeed; - document.getElementById('hamlib_ptt_protocol_advanced').value = config.pttprotocol; - document.getElementById('hamlib_databits_advanced').value = config.data_bits; - document.getElementById('hamlib_stopbits_advanced').value = config.stop_bits; - document.getElementById('hamlib_handshake_advanced').value = config.handshake; + document.getElementById('hamlib_serialspeed_advanced').value = config.serialspeed_direct; + document.getElementById('hamlib_ptt_protocol_advanced').value = config.pttprotocol_direct; + document.getElementById('hamlib_databits_advanced').value = config.data_bits_direct; + document.getElementById('hamlib_stopbits_advanced').value = config.stop_bits_direct; + document.getElementById('hamlib_handshake_advanced').value = config.handshake_direct; document.getElementById("beaconInterval").value = config.beacon_interval; @@ -550,12 +550,12 @@ window.addEventListener('DOMContentLoaded', () => { config.mygrid = mygrid; config.deviceid = deviceid; config.deviceport = deviceport; - config.serialspeed = serialspeed; - config.pttprotocol = pttprotocol; + config.serialspeed_direct = serialspeed; + config.pttprotocol_direct = pttprotocol; config.pttport = pttport; - config.data_bits = data_bits; - config.stop_bits = stop_bits; - config.handshake = handshake; + config.data_bits_direct = data_bits; + config.stop_bits_direct = stop_bits; + config.handshake_direct = handshake; config.deviceid_rigctl = deviceid_rigctl; config.serialspeed_rigctl = serialspeed_rigctl; config.pttprotocol_rigctl = pttprotocol_rigctl; diff --git a/tnc/data_handler.py b/tnc/data_handler.py index 5ea17195..c4e54ecc 100644 --- a/tnc/data_handler.py +++ b/tnc/data_handler.py @@ -156,12 +156,12 @@ class DATA(): def process_data(self, bytes_out, freedv, bytes_per_frame): # forward data only if broadcast or we are the receiver # bytes_out[1:3] == callsign check for signalling frames, - # bytes_out[1:2] == b'\x01' --> broadcasts like CQ with n frames per_burst = 1 + # bytes_out[2:4] == transmission # we could also create an own function, which returns True. frametype = int.from_bytes(bytes(bytes_out[:1]), "big") - if bytes(bytes_out[1:3]) == static.MYCALLSIGN_CRC or frametype == 200 or frametype == 250: + if bytes(bytes_out[1:3]) == static.MYCALLSIGN_CRC or bytes(bytes_out[2:4]) == static.MYCALLSIGN_CRC or frametype == 200 or frametype == 250: # CHECK IF FRAMETYPE IS BETWEEN 10 and 50 ------------------------ frame = frametype - 10 @@ -1125,8 +1125,8 @@ class DATA(): def received_cq(self, data_in:bytes): # here we add the received station to the heard stations buffer - dxcallsign = bytes(data_in[2:8]).rstrip(b'\x00') - dxgrid = bytes(data_in[8:14]).rstrip(b'\x00') + dxcallsign = bytes(data_in[1:7]).rstrip(b'\x00') + dxgrid = bytes(data_in[7:13]).rstrip(b'\x00') static.INFO.append("CQ;RECEIVING") 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)