diff --git a/tnc/modem.py b/tnc/modem.py index dbf0e75e..eab2d6bf 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -693,22 +693,16 @@ class RF: # Release our mod_out_lock, so we can use the queue self.mod_out_locked = False - # we need to wait manually for tci processing - if static.AUDIO_ENABLE_TCI: - - duration = len(txbuffer_out) / 8000 - timestamp_to_sleep = time.time() + (duration) - self.log.debug("[MDM] TCI calculated duration", duration=duration) - while time.time() < timestamp_to_sleep: - threading.Event().wait(0.01) - else: - timestamp_to_sleep = time.time() - - while self.modoutqueue and time.time() < timestamp_to_sleep: + while self.modoutqueue: threading.Event().wait(0.01) # if we're transmitting FreeDATA signals, reset channel busy state static.CHANNEL_BUSY = False + # wait until tci protocol released tx state + if static.AUDIO_ENABLE_TCI: + while not self.tci_module.get_tx_enable(): + threading.Event().wait(0.01) + static.PTT_STATE = self.radio.set_ptt(False) # Push ptt state to socket stream diff --git a/tnc/tci.py b/tnc/tci.py index eb5da6e2..d9326d80 100644 --- a/tnc/tci.py +++ b/tnc/tci.py @@ -46,6 +46,8 @@ class TCI: self.meter = None self.level = None self.ptt = None + self.tx_enable = False + def connect(self): self.log.info( @@ -74,6 +76,10 @@ class TCI: self.ws.send('audio_stream_samples:1200;') self.ws.send('audio_start:0;') + if message == "tx_enable:1,true": + self.tx_enable = True + self.set_ptt(False) + # tx chrono frame if len(message) in {64}: receiver = message[:4] @@ -315,6 +321,9 @@ class TCI: self.ws.send(f'trx:0;') return self.ptt + def get_tx_enable(self): + """ """ + return self.tx_enable def close_rig(self): """ """ return