updated rigctld integration

This commit is contained in:
DJ2LS 2021-09-02 20:16:46 +02:00 committed by GitHub
parent 6d555b9362
commit 770a6ccdaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 21 deletions

View file

@ -12,7 +12,7 @@ import argparse
import threading import threading
import static import static
import subprocess import subprocess
import sys
if __name__ == '__main__': if __name__ == '__main__':
@ -63,13 +63,26 @@ if __name__ == '__main__':
else: else:
dtr_state = "NONE" dtr_state = "NONE"
if sys.platform == "linux":
command = "exec ./hamlib/linux/rigctld -r " + str(static.HAMLIB_DEVICE_PORT) + \ command = "exec ./hamlib/linux/rigctld -r " + str(static.HAMLIB_DEVICE_PORT) + \
" -s "+ str(static.HAMLIB_SERIAL_SPEED) + \ " -s "+ str(static.HAMLIB_SERIAL_SPEED) + \
" -P "+ str(static.HAMLIB_PTT_TYPE) + \ " -P "+ str(static.HAMLIB_PTT_TYPE) + \
" -m "+ str(static.HAMLIB_DEVICE_ID) + \ " -m "+ str(static.HAMLIB_DEVICE_ID) + \
" --set-conf=dtr_state=" + dtr_state " --set-conf=dtr_state=" + dtr_state
try:
p = subprocess.Popen(command, shell=True) p = subprocess.Popen(command, shell=True)
except:
print("hamlib not started")
sys.exit()
elif sys.platform == "darwin":
print("platform not yet supported")
sys.exit()
elif sys.platform == "win32":
print("platform not yet supported")
sys.exit()
else:
print("platform not supported!")
sys.exit()

View file

@ -646,17 +646,10 @@ class RF():
static.SNR = 0 static.SNR = 0
def get_radio_stats(self): def get_radio_stats(self):
#static.HAMLIB_FREQUENCY = float(self.my_rig.get_freq()/1000)
#(hamlib_mode, static.HAMLIB_BANDWITH) = self.my_rig.get_mode()
#static.HAMLIB_MODE = Hamlib.rig_strrmode(hamlib_mode)
static.HAMLIB_FREQUENCY = rigctld.get_frequency() static.HAMLIB_FREQUENCY = rigctld.get_frequency()
static.HAMLIB_MODE = rigctld.get_mode()[0] static.HAMLIB_MODE = rigctld.get_mode()[0]
static.HAMLIB_BANDWITH = rigctld.get_mode()[1] static.HAMLIB_BANDWITH = rigctld.get_mode()[1]
print(static.HAMLIB_MODE)
print(static.HAMLIB_FREQUENCY)
print(static.HAMLIB_BANDWITH)
def calculate_fft(self, data_in): def calculate_fft(self, data_in):

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import socket import socket
import logging import logging
import static
# 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
# https://github.com/xssfox/freedv-tnc/blob/master/freedvtnc/rigctl.py # https://github.com/xssfox/freedv-tnc/blob/master/freedvtnc/rigctl.py
@ -64,9 +65,9 @@ class Rigctld():
if data is not None: if data is not None:
data = data.split(b'\n') data = data.split(b'\n')
try: try:
freq = int(data[0]) freq = int(data[0])/1000
except: except:
freq = 0 freq = static.HAMLIB_FREQUENCY
print(data) print(data)
return freq return freq
@ -79,7 +80,7 @@ class Rigctld():
bandwith = int(data[1]) bandwith = int(data[1])
except: except:
print(data) print(data)
mode = '0' mode = static.HAMLIB_MODE
bandwith = 0 bandwith = static.HAMLIB_BANDWITH
return [mode, bandwith] return [mode, bandwith]