enable / disable morse identifier

This commit is contained in:
DJ2LS 2023-10-31 09:53:31 +01:00
parent 4a47c3f58c
commit 5d111cac5b
5 changed files with 29 additions and 5 deletions

View file

@ -77,14 +77,15 @@ class CONFIG:
'explorer': data[17],
'stats': data[19],
'fsk': data[13],
'tx_delay': data[21]
}
'tx_delay': data[21],
'transmit_morse_identifier' : data[25]
}
self.config['TCI'] = {'#TCI settings': None,
'ip': data[22],
'port': data[23]
}
self.config['MESH'] = {'#TCI settings': None,
self.config['MESH'] = {'#Mesh settings': None,
'enable_protocol': data[24]
}

View file

@ -496,6 +496,12 @@ class DAEMON:
if data[24] == "True":
options.append("--mesh")
#Morse identifier
print(data[25])
if data[25] == "True":
options.append("--morse")
# safe data to config file
config.write_entire_config(data)

View file

@ -1966,6 +1966,10 @@ class DATA:
# we need to send disconnect frame before doing arq cleanup
# we would lose our session id then
self.send_disconnect_frame()
# transmit morse identifier if configured
if Modem.transmit_morse_identifier:
modem.MODEM_TRANSMIT_QUEUE.put(["morse", 1, 0, self.mycallsign])
self.arq_cleanup()
def received_session_close(self, data_in: bytes):
@ -2856,7 +2860,8 @@ class DATA:
self.enqueue_frame_for_tx([cq_frame], c2_mode=FREEDV_MODE.fsk_ldpc_0.value)
else:
self.enqueue_frame_for_tx([cq_frame], c2_mode=FREEDV_MODE.sig0.value, copies=1, repeat_delay=0)
#modem.MODEM_TRANSMIT_QUEUE.put(["morse", 1, 0, self.mycallsign])
if Modem.transmit_morse_identifier:
modem.MODEM_TRANSMIT_QUEUE.put(["morse", 1, 0, self.mycallsign])
def received_cq(self, data_in: bytes) -> None:
"""

View file

@ -261,6 +261,15 @@ if __name__ == "__main__":
help="Enable and set hmac message salt",
)
PARSER.add_argument(
"--morse",
dest="transmit_morse_identifier",
action="store_true",
default=True,
help="Enable and send a morse identifier on disconnect an beacon",
)
ARGS = PARSER.parse_args()
# set save to folder state for allowing downloading files to local file system
@ -316,7 +325,7 @@ if __name__ == "__main__":
ModemParam.tx_delay = ARGS.tx_delay
MeshParam.enable_protocol = ARGS.enable_mesh
Modem.enable_hmac = ARGS.enable_hmac
Modem.transmit_morse_identifier = ARGS.transmit_morse_identifier
except Exception as e:
log.error("[DMN] Error reading config file", exception=e)
@ -368,6 +377,8 @@ if __name__ == "__main__":
TCIParam.port = int(conf.get('TCI', 'tci_port', '50001'))
ModemParam.tx_delay = int(conf.get('Modem', 'tx_delay', '0'))
MeshParam.enable_protocol = conf.get('MESH','mesh_enable','False')
MeshParam.transmit_morse_identifier = conf.get('Modem','transmit_morse_identifier','False')
except KeyError as e:
log.warning("[CFG] Error reading config file near", key=str(e))
except Exception as e:

View file

@ -151,6 +151,7 @@ class Modem:
heard_stations = []
listen: bool = True
enable_hmac: bool = True
transmit_morse_identifier: bool = False
# ------------