mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
check for tx chrono
This commit is contained in:
parent
a5a0a4576b
commit
6da2453912
19
tnc/tci.py
19
tnc/tci.py
|
@ -32,6 +32,11 @@ class TCI:
|
||||||
)
|
)
|
||||||
tci_thread.start()
|
tci_thread.start()
|
||||||
|
|
||||||
|
# flag if we're receiving a tx_chrono
|
||||||
|
self.tx_chrono = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def connect(self):
|
def connect(self):
|
||||||
self.log.info(
|
self.log.info(
|
||||||
"[TCI] Starting TCI thread!", ip=self.hostname, port=self.port
|
"[TCI] Starting TCI thread!", ip=self.hostname, port=self.port
|
||||||
|
@ -49,13 +54,23 @@ class TCI:
|
||||||
#rel.dispatch()
|
#rel.dispatch()
|
||||||
|
|
||||||
def on_message(self, ws, message):
|
def on_message(self, ws, message):
|
||||||
|
|
||||||
|
# ready message
|
||||||
|
# we need to wait until radio is ready before we can push commands
|
||||||
if message == "ready;":
|
if message == "ready;":
|
||||||
self.ws.send('audio_samplerate:8000;')
|
self.ws.send('audio_samplerate:8000;')
|
||||||
self.ws.send('audio_stream_channels:1;')
|
self.ws.send('audio_stream_channels:1;')
|
||||||
self.ws.send('AUDIO_STREAM_SAMPLE_TYPE:int16;')
|
self.ws.send('audio_stream_sample_type:int16;')
|
||||||
self.ws.send('AUDIO_STREAM_SAMPLES:1200;')
|
self.ws.send('audio_stream_samples:1200;')
|
||||||
self.ws.send('audio_start:0;')
|
self.ws.send('audio_start:0;')
|
||||||
|
|
||||||
|
# tx chrono frame
|
||||||
|
if len(message) in {64}:
|
||||||
|
type = int.from_bytes(message[24:28], "little")
|
||||||
|
if type == 3:
|
||||||
|
self.tx_chrono = True
|
||||||
|
|
||||||
|
# audio frame
|
||||||
if len(message) in {576, 2464, 4160}:
|
if len(message) in {576, 2464, 4160}:
|
||||||
# audio received
|
# audio received
|
||||||
receiver = message[:4]
|
receiver = message[:4]
|
||||||
|
|
Loading…
Reference in a new issue