From 87fb4382a4c9f41190066fefc25bc9511f8bdc4b Mon Sep 17 00:00:00 2001 From: DJ2LS <75909252+DJ2LS@users.noreply.github.com> Date: Mon, 30 Jan 2023 12:28:02 +0100 Subject: [PATCH] moved from snr to meter --- tnc/modem.py | 4 ++-- tnc/rigctld.py | 23 +++++++++++------------ tnc/rigdummy.py | 2 +- tnc/sock.py | 2 +- tnc/static.py | 2 +- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/tnc/modem.py b/tnc/modem.py index 7b089607..82ec99e6 100644 --- a/tnc/modem.py +++ b/tnc/modem.py @@ -970,8 +970,8 @@ class RF: static.HAMLIB_STATUS = self.hamlib.get_status() static.HAMLIB_ALC = self.hamlib.get_alc() static.HAMLIB_RF = self.hamlib.get_level() - static.HAMLIB_SWR = self.hamlib.get_swr() - print(f"ALC: {static.HAMLIB_ALC}, RF: {static.HAMLIB_RF}, SWR: {static.HAMLIB_SWR}") + static.HAMLIB_METER = self.hamlib.get_meter() + print(f"ALC: {static.HAMLIB_ALC}, RF: {static.HAMLIB_RF}, SWR: {static.HAMLIB_METER}") def calculate_fft(self) -> None: """ Calculate an average signal strength of the channel to assess diff --git a/tnc/rigctld.py b/tnc/rigctld.py index 4c5a9e47..1487bb45 100644 --- a/tnc/rigctld.py +++ b/tnc/rigctld.py @@ -35,7 +35,7 @@ class radio: self.frequency = '' self.mode = '' self.alc = '' - self.swr = '' + self.meter = '' self.rf = '' def open_rig( @@ -209,7 +209,7 @@ class radio: rf = data[0].decode("utf-8") if 'RPRT' not in rf: try: - rf = int(rf) + self.rf = int(rf) except ValueError: self.rf = str(rf) @@ -217,30 +217,29 @@ class radio: except Exception: return self.rf - def get_swr(self): + def get_meter(self): try: - data = self.send_data_command(b"l SWR", True) + data = self.send_data_command(b"l METER", True) data = data.split(b"\n") - swr = data[0].decode("utf-8") - if 'RPRT' not in swr: + meter = data[0].decode("utf-8") + if 'RPRT' not in meter: try: - swr = int(swr) + self.meter = str(meter) except ValueError: - self.swr = str(swr) + self.meter = str(meter) - return self.swr + return self.meter except Exception: - return self.swr + return self.meter def get_alc(self): try: data = self.send_data_command(b"l ALC", True) data = data.split(b"\n") - print(data) alc = data[0].decode("utf-8") if 'RPRT' not in alc: try: - alc = int(alc) + self.alc = int(alc) except ValueError: self.alc = str(alc) diff --git a/tnc/rigdummy.py b/tnc/rigdummy.py index c6534a0f..46e78475 100644 --- a/tnc/rigdummy.py +++ b/tnc/rigdummy.py @@ -34,7 +34,7 @@ class radio: """ """ return None - def get_swr(self): + def get_meter(self): """ """ return None diff --git a/tnc/sock.py b/tnc/sock.py index 0992db48..af476d63 100644 --- a/tnc/sock.py +++ b/tnc/sock.py @@ -654,7 +654,7 @@ def send_tnc_state(): "snr": str(static.SNR), "frequency": str(static.HAMLIB_FREQUENCY), "rf_level": str(static.HAMLIB_RF), - "swr": str(static.HAMLIB_SWR), + "meter": str(static.HAMLIB_METER), "alc": str(static.HAMLIB_ALC), "speed_level": str(static.ARQ_SPEED_LEVEL), "mode": str(static.HAMLIB_MODE), diff --git a/tnc/static.py b/tnc/static.py index ec9e9d0d..80ab4c82 100644 --- a/tnc/static.py +++ b/tnc/static.py @@ -66,7 +66,7 @@ HAMLIB_MODE: str = "" HAMLIB_BANDWIDTH: int = 0 HAMLIB_RF: int = 0 HAMLIB_ALC: int = 0 -HAMLIB_SWR: int = 0 +HAMLIB_METER: int = 0 # ------------------------- # FreeDV Defaults