From 18741229cda38797da7cc48041c8e885bb1a9e05 Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Fri, 17 Feb 2023 09:37:58 +0100 Subject: [PATCH] tci adjustments --- tnc/modem.py | 6 +++++- tnc/tci.py | 18 ++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/tnc/modem.py b/tnc/modem.py index 65471812..48254018 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -193,6 +193,9 @@ class RF: # lets open TCI radio self.tci_module.open_rig(static.TCI_IP, static.TCI_PORT) + # lets init TCI audio + self.tci_module.init_audio() + # let's start the audio rx callback self.log.debug("[MDM] Starting tci rx callback thread") tci_rx_callback_thread = threading.Thread( @@ -328,6 +331,7 @@ class RF: while True: threading.Event().wait(0.01) + # -----write if len(self.modoutqueue) > 0 and not self.mod_out_locked: data_out48k = self.modoutqueue.popleft() @@ -347,7 +351,7 @@ class RF: data_in48k = self.tci_module.get_audio() x = np.frombuffer(data_in48k, dtype=np.int16) - x = self.resampler.resample48_to_8(x) + # x = self.resampler.resample48_to_8(x) self.fft_data = x diff --git a/tnc/tci.py b/tnc/tci.py index 459bf49f..f310f7de 100644 --- a/tnc/tci.py +++ b/tnc/tci.py @@ -133,7 +133,7 @@ class TCI: """ if self.ptt_connected: try: - self.ptt_connection.sendall(command + b"\n") + self.ptt_connection.sendall(command) except Exception: self.log.warning( "[TCI] Command not executed!", @@ -156,7 +156,7 @@ class TCI: self.data_connection.setblocking(False) self.data_connection.settimeout(0.05) try: - self.data_connection.sendall(command + b"\n") + self.data_connection.sendall(command) except Exception: @@ -194,6 +194,17 @@ class TCI: ) self.data_connected = False return b"" + + def init_audio(self): + try: + self.send_data_command(b"IQ_SAMPLERATE:48000;", False) + self.send_data_command(b"audio_samplerate:8;", False) + self.send_data_command(b"audio_start: 0;", False) + + return True + except Exception: + return False + def get_audio(self): """""" # generate random audio data @@ -201,9 +212,8 @@ class TCI: return np.random.uniform(-1, 1, 48000) try: - return self.send_data_command(b"GET AUDIO COMMAND", True) + return self.data_connection.recv(4800) except Exception: - print("NOOOOO") return False