mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
changed getting ptt state
getting ptt now via own function
This commit is contained in:
parent
71453bf390
commit
9d869fb698
|
@ -294,7 +294,7 @@ class CMDTCPRequestHandler(socketserver.BaseRequestHandler):
|
|||
hamlib.open_rig(devicename=devicename, deviceport=deviceport, hamlib_ptt_type=pttprotocol, serialspeed=serialspeed)
|
||||
|
||||
hamlib.set_ptt(True)
|
||||
pttstate = hamlib.get_rig_data()[3]
|
||||
pttstate = hamlib.get_ptt()
|
||||
if pttstate:
|
||||
structlog.get_logger("structlog").info("[DMN] Hamlib PTT", status = 'SUCCESS')
|
||||
data = {'COMMAND': 'TEST_HAMLIB', 'RESULT': 'SUCCESS'}
|
||||
|
|
18
tnc/rig.py
18
tnc/rig.py
|
@ -34,11 +34,11 @@ except Exception as e:
|
|||
class radio:
|
||||
def __init__(self):
|
||||
|
||||
self.deviceid = '2'
|
||||
self.devicename = ''
|
||||
self.devicenumber = ''
|
||||
self.deviceport = '/dev/ttyUSB0'
|
||||
self.serialspeed = 9600
|
||||
self.hamlib_ptt_type = 'RIG'
|
||||
self.deviceport = ''
|
||||
self.serialspeed = 0
|
||||
self.hamlib_ptt_type = ''
|
||||
self.my_rig = ''
|
||||
|
||||
|
||||
|
@ -118,7 +118,8 @@ class radio:
|
|||
structlog.get_logger("structlog").info("[DMN] Hamlib device openend", status='SUCCESS')
|
||||
|
||||
|
||||
|
||||
# set ptt to false if ptt is stuck for some reason
|
||||
self.set_ptt(False)
|
||||
|
||||
# set rig mode to USB
|
||||
self.my_rig.set_mode(Hamlib.RIG_MODE_USB)
|
||||
|
@ -133,7 +134,7 @@ class radio:
|
|||
freq = int(self.my_rig.get_freq())
|
||||
(hamlib_mode, bandwith) = self.my_rig.get_mode()
|
||||
mode = Hamlib.rig_strrmode(hamlib_mode)
|
||||
ptt = self.my_rig.get_ptt()
|
||||
ptt = self.get_ptt()
|
||||
if ptt:
|
||||
ptt = True
|
||||
else:
|
||||
|
@ -143,7 +144,10 @@ class radio:
|
|||
|
||||
def set_mode(self, mode):
|
||||
return 0
|
||||
|
||||
|
||||
def get_ptt(self):
|
||||
return self.my_rig.get_ptt()
|
||||
|
||||
def set_ptt(self, state):
|
||||
if state:
|
||||
self.my_rig.set_ptt(self.hamlib_ptt_type, 1)
|
||||
|
|
Loading…
Reference in a new issue