mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
improved rigctld output
This commit is contained in:
parent
85d2f36e36
commit
0e2d23c5b9
2 changed files with 21 additions and 10 deletions
|
@ -830,7 +830,7 @@ class RF:
|
||||||
- static.HAMLIB_BANDWIDTH
|
- static.HAMLIB_BANDWIDTH
|
||||||
"""
|
"""
|
||||||
while True:
|
while True:
|
||||||
threading.Event().wait(1.0)
|
threading.Event().wait(0.5)
|
||||||
static.HAMLIB_FREQUENCY = self.hamlib.get_frequency()
|
static.HAMLIB_FREQUENCY = self.hamlib.get_frequency()
|
||||||
static.HAMLIB_MODE = self.hamlib.get_mode()
|
static.HAMLIB_MODE = self.hamlib.get_mode()
|
||||||
static.HAMLIB_BANDWIDTH = self.hamlib.get_bandwidth()
|
static.HAMLIB_BANDWIDTH = self.hamlib.get_bandwidth()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# class taken from darsidelemm
|
# class taken from darksidelemm
|
||||||
# rigctl - https://github.com/darksidelemm/rotctld-web-gui/blob/master/rotatorgui.py#L35
|
# rigctl - https://github.com/darksidelemm/rotctld-web-gui/blob/master/rotatorgui.py#L35
|
||||||
#
|
#
|
||||||
# modified and adjusted to FreeDATA needs by DJ2LS
|
# modified and adjusted to FreeDATA needs by DJ2LS
|
||||||
|
@ -16,8 +16,6 @@ hamlib_version = 0
|
||||||
class radio:
|
class radio:
|
||||||
"""rigctld (hamlib) communication class"""
|
"""rigctld (hamlib) communication class"""
|
||||||
|
|
||||||
# Note: This is a massive hack.
|
|
||||||
|
|
||||||
log = structlog.get_logger("radio (rigctld)")
|
log = structlog.get_logger("radio (rigctld)")
|
||||||
|
|
||||||
def __init__(self, hostname="localhost", port=4532, poll_rate=5, timeout=5):
|
def __init__(self, hostname="localhost", port=4532, poll_rate=5, timeout=5):
|
||||||
|
@ -30,6 +28,12 @@ class radio:
|
||||||
self.port = port
|
self.port = port
|
||||||
self.connection_attempts = 5
|
self.connection_attempts = 5
|
||||||
|
|
||||||
|
# class wide variable for some parameters
|
||||||
|
self.bandwidth = 0
|
||||||
|
self.frequency = 0
|
||||||
|
self.mode = ''
|
||||||
|
|
||||||
|
|
||||||
def open_rig(
|
def open_rig(
|
||||||
self,
|
self,
|
||||||
devicename,
|
devicename,
|
||||||
|
@ -144,8 +148,10 @@ class radio:
|
||||||
try:
|
try:
|
||||||
data = self.send_command(b"m")
|
data = self.send_command(b"m")
|
||||||
data = data.split(b"\n")
|
data = data.split(b"\n")
|
||||||
mode = data[0]
|
if 'RPRT' not in data[0]:
|
||||||
return mode.decode("utf-8")
|
self.mode = data[0]
|
||||||
|
|
||||||
|
return self.mode.decode("utf-8")
|
||||||
except Exception:
|
except Exception:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -154,16 +160,21 @@ class radio:
|
||||||
try:
|
try:
|
||||||
data = self.send_command(b"m")
|
data = self.send_command(b"m")
|
||||||
data = data.split(b"\n")
|
data = data.split(b"\n")
|
||||||
bandwidth = data[1]
|
|
||||||
return bandwidth.decode("utf-8")
|
if 'RPRT' not in data[1]:
|
||||||
|
self.bandwidth = data[1]
|
||||||
|
return self.bandwidth.decode("utf-8")
|
||||||
except Exception:
|
except Exception:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get_frequency(self):
|
def get_frequency(self):
|
||||||
""" """
|
""" """
|
||||||
try:
|
try:
|
||||||
frequency = self.send_command(b"f")
|
data = self.send_command(b"f")
|
||||||
return frequency.decode("utf-8")
|
if 'RPRT' not in data:
|
||||||
|
self.frequency = data
|
||||||
|
|
||||||
|
return self.frequency.decode("utf-8")
|
||||||
except Exception:
|
except Exception:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue