diff --git a/freedata_server/arq_session.py b/freedata_server/arq_session.py index 99313b1c..d92f1d48 100644 --- a/freedata_server/arq_session.py +++ b/freedata_server/arq_session.py @@ -36,12 +36,12 @@ class ARQSession: 'duration_per_frame': 6.5, 'bandwidth': 2438, }, - 4: { - 'mode': codec2.FREEDV_MODE.qam16c2, - 'min_snr': 11, - 'duration_per_frame': 2.8, - 'bandwidth': 2438, - }, + #4: { + # 'mode': codec2.FREEDV_MODE.qam16c2, + # 'min_snr': 11, + # 'duration_per_frame': 2.8, + # 'bandwidth': 2438, + #}, } def __init__(self, config: dict, modem, dxcall: str, state_manager): diff --git a/freedata_server/codec2.py b/freedata_server/codec2.py index fe7b785e..54ec7d36 100644 --- a/freedata_server/codec2.py +++ b/freedata_server/codec2.py @@ -37,7 +37,7 @@ class FREEDV_MODE(Enum): data_ofdm_500 = 21500 data_ofdm_2438 = 2124381 #data_qam_2438 = 2124382 - qam16c2 = 22 + #qam16c2 = 22 class FREEDV_MODE_USED_SLOTS(Enum): """ diff --git a/freedata_server/demodulator.py b/freedata_server/demodulator.py index b72973e1..491b6e51 100644 --- a/freedata_server/demodulator.py +++ b/freedata_server/demodulator.py @@ -119,7 +119,7 @@ class Demodulator(): for mode in self.MODE_DICT: # Start decoder threads self.MODE_DICT[mode]['decoding_thread'] = threading.Thread( - target=self.demodulate_audio,args=[mode], name=self.MODE_DICT[mode]['name'], daemon=True + target=self.demodulate_audio,args=[mode], name=self.MODE_DICT[mode]['name'], daemon=False ) self.MODE_DICT[mode]['decoding_thread'].start() diff --git a/freedata_server/modulator.py b/freedata_server/modulator.py index 91f1085e..6dbe2147 100644 --- a/freedata_server/modulator.py +++ b/freedata_server/modulator.py @@ -26,7 +26,7 @@ class Modulator: self.freedv_datac14_tx = codec2.open_instance(codec2.FREEDV_MODE.datac14.value) self.data_ofdm_500_tx = codec2.open_instance(codec2.FREEDV_MODE.data_ofdm_500.value) self.data_ofdm_2438_tx = codec2.open_instance(codec2.FREEDV_MODE.data_ofdm_2438.value) - self.freedv_qam16c2_tx = codec2.open_instance(codec2.FREEDV_MODE.qam16c2.value) + #self.freedv_qam16c2_tx = codec2.open_instance(codec2.FREEDV_MODE.qam16c2.value) #self.data_qam_2438_tx = codec2.open_instance(codec2.FREEDV_MODE.data_qam_2438.value) def transmit_add_preamble(self, buffer, freedv): diff --git a/freedata_server/schedule_manager.py b/freedata_server/schedule_manager.py index 67f5f0dd..3bfb9196 100644 --- a/freedata_server/schedule_manager.py +++ b/freedata_server/schedule_manager.py @@ -50,7 +50,7 @@ class ScheduleManager: self.scheduler.enter(0, 1, self.schedule_event, (event_info['function'], event_info['interval'])) # Run the scheduler in a separate thread - self.scheduler_thread = threading.Thread(target=self.scheduler.run, daemon=True) + self.scheduler_thread = threading.Thread(target=self.scheduler.run, daemon=False) self.scheduler_thread.start() def stop(self): diff --git a/freedata_server/server.py b/freedata_server/server.py index d9115948..78a6f53a 100644 --- a/freedata_server/server.py +++ b/freedata_server/server.py @@ -380,7 +380,7 @@ def main(): if not modemport: modemport = 5000 - app.run(modemaddress, modemport) + app.run(modemaddress, modemport, debug=False) if __name__ == "__main__": main() diff --git a/freedata_server/service_manager.py b/freedata_server/service_manager.py index 43b21515..54027ecd 100644 --- a/freedata_server/service_manager.py +++ b/freedata_server/service_manager.py @@ -22,7 +22,7 @@ class SM: self.socket_interface_manager = None runner_thread = threading.Thread( - target=self.runner, name="runner thread", daemon=True + target=self.runner, name="runner thread", daemon=False ) runner_thread.start() @@ -66,6 +66,9 @@ class SM: else: self.log.warning("[SVC] freedata_server command processing failed", cmd=cmd, state=self.state_manager.is_modem_running) + # finally clear processing commands + self.modem_service.queue.clear() + def start_modem(self): if self.config['STATION']['mycall'] in ['XX1XXX']: @@ -76,10 +79,8 @@ class SM: self.log.warning("freedata_server already running") return False - # test audio devices audio_test = self.test_audio() - if False in audio_test or None in audio_test or self.state_manager.is_modem_running: self.log.warning("starting freedata_server failed", input_test=audio_test[0], output_test=audio_test[1]) self.state_manager.set("is_modem_running", False) @@ -104,13 +105,13 @@ class SM: def stop_modem(self): self.log.info("stopping freedata_server....") - self.modem.stop_modem() - del self.modem - self.modem = False + if self.modem: + self.modem.stop_modem() + del self.modem + self.modem = False self.state_manager.set("is_modem_running", False) self.schedule_manager.stop() self.event_manager.modem_stopped() - def test_audio(self): try: audio_test = audio.test_audio_devices(self.config['AUDIO']['input_device'],