tci adjustments

This commit is contained in:
DJ2LS 2023-02-17 09:37:58 +01:00
parent a20bd873f8
commit 18741229cd
2 changed files with 19 additions and 5 deletions

View file

@ -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

View file

@ -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