possible fix for stuck radio control

This commit is contained in:
DJ2LS 2024-02-07 22:23:49 +01:00
parent 9e617b2da5
commit 0e111e628b
2 changed files with 2 additions and 4 deletions

View file

@ -62,7 +62,8 @@ class radio:
def send_command(self, command) -> str: def send_command(self, command) -> str:
if self.connected: if self.connected:
# wait if we have another command awaiting its response... # wait if we have another command awaiting its response...
self.await_response.wait() # we need to set a timeout for avoiding a blocking state
self.await_response.wait(timeout=1)
try: try:
self.await_response = threading.Event() self.await_response = threading.Event()
@ -73,8 +74,6 @@ class radio:
except Exception as err: except Exception as err:
self.log.warning(f"[RIGCTLD] Error sending command [{command}] to rigctld: {err}") self.log.warning(f"[RIGCTLD] Error sending command [{command}] to rigctld: {err}")
self.connected = False self.connected = False
return "" return ""
def set_ptt(self, state): def set_ptt(self, state):

View file

@ -122,7 +122,6 @@ def get_modem_state():
def post_cqcqcq(): def post_cqcqcq():
if request.method not in ['POST']: if request.method not in ['POST']:
return api_response({"info": "endpoint for triggering a CQ via POST"}) return api_response({"info": "endpoint for triggering a CQ via POST"})
print(app.state_manager.is_modem_running)
if not app.state_manager.is_modem_running: if not app.state_manager.is_modem_running:
api_abort('Modem not running', 503) api_abort('Modem not running', 503)
enqueue_tx_command(command_cq.CQCommand) enqueue_tx_command(command_cq.CQCommand)