moved from snr to meter

This commit is contained in:
DJ2LS 2023-01-30 12:28:02 +01:00
parent d54416fc8d
commit 87fb4382a4
5 changed files with 16 additions and 17 deletions

View file

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

View file

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

View file

@ -34,7 +34,7 @@ class radio:
""" """
return None
def get_swr(self):
def get_meter(self):
""" """
return None

View file

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

View file

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