Skip to content

Commit

Permalink
@mbridak Trying something new.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbridak committed Nov 26, 2024
1 parent 60fca4b commit a030dc1
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions not1mm/lib/cat_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,11 @@ def __getvfo_rigctld(self) -> str:
if self.rigctrlsocket:
try:
self.online = True
self.rigctrlsocket.send(b"f\n")
return self.__get_serial_string().strip()
self.rigctrlsocket.send(b"|f\n")
report = self.__get_serial_string().strip()
if "get_freq:|" in report and "RPRT 0" in report:
seg_rpt = report.split("|")
return seg_rpt[1].split(" ")[1]
except socket.error as exception:
self.online = False
logger.debug(f"{exception=}")
Expand Down Expand Up @@ -334,12 +337,12 @@ def __getmode_rigctld(self) -> str:
if self.rigctrlsocket:
try:
self.online = True
self.rigctrlsocket.send(b"m\n")
mode = self.__get_serial_string()
mode = mode.strip().split()[0]
if mode == "RPRT":
return ""
return mode
self.rigctrlsocket.send(b"|m\n")
# get_mode:|Mode: CW|Passband: 500|RPRT 0
report = self.__get_serial_string().strip()
if "getmode:|" in report and "RPRT 0" in report:
seg_rpt = report.split("|")
return seg_rpt[1].split(" ")[1]
except IndexError as exception:
logger.debug("%s", f"{exception}")
except socket.error as exception:
Expand Down Expand Up @@ -383,11 +386,13 @@ def __getbw_rigctld(self):
if self.rigctrlsocket:
try:
self.online = True
self.rigctrlsocket.send(b"m\n")
mode = self.__get_serial_string()
mode = mode.strip().split()[1]
# logger.debug("%s", mode)
return mode
self.rigctrlsocket.send(b"|m\n")
# get_mode:|Mode: CW|Passband: 500|RPRT 0
report = self.__get_serial_string().strip()
if "getmode:|" in report and "RPRT 0" in report:
seg_rpt = report.split("|")
return seg_rpt[2].split(" ")[1]

except IndexError as exception:
logger.debug("%s", f"{exception}")
except socket.error as exception:
Expand Down Expand Up @@ -426,8 +431,12 @@ def __getpower_rigctld(self):
if self.rigctrlsocket:
try:
self.online = True
self.rigctrlsocket.send(b"l RFPOWER\n")
return int(float(self.__get_serial_string().strip()) * 100)
self.rigctrlsocket.send(b"|l RFPOWER\n")
# get_level: RFPOWER|0.000000|RPRT 0
report = self.__get_serial_string().strip()
if "get_level: RFPOWER|" in report and "RPRT 0" in report:
seg_rpt = report.split("|")
return int(float(seg_rpt[1]) * 100)
except socket.error as exception:
self.online = False
logger.debug("getpower_rigctld: %s", f"{exception}")
Expand Down

0 comments on commit a030dc1

Please sign in to comment.