mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
big cleanup
This commit is contained in:
parent
c27bf8f19e
commit
d17b77e323
5 changed files with 39 additions and 57 deletions
|
@ -57,25 +57,25 @@ class CONFIG:
|
|||
self.config['AUDIO'] = {'#Audio settings': None,
|
||||
'rx': data[3],
|
||||
'tx': data[4],
|
||||
'txaudiolevel': data[22],
|
||||
'auto_tune': data[27]
|
||||
'txaudiolevel': data[14],
|
||||
'auto_tune': data[19]
|
||||
|
||||
}
|
||||
self.config['RADIO'] = {'#Radio settings': None,
|
||||
'radiocontrol': data[13],
|
||||
'rigctld_ip': data[14],
|
||||
'rigctld_port': data[15]
|
||||
'radiocontrol': data[5],
|
||||
'rigctld_ip': data[6],
|
||||
'rigctld_port': data[7]
|
||||
}
|
||||
self.config['TNC'] = {'#TNC settings': None,
|
||||
'scatter': data[16],
|
||||
'fft': data[17],
|
||||
'narrowband': data[18],
|
||||
'fmin': data[19],
|
||||
'fmax': data[20],
|
||||
'qrv': data[23],
|
||||
'rxbuffersize': data[24],
|
||||
'explorer': data[25],
|
||||
'stats': data[28]
|
||||
'scatter': data[8],
|
||||
'fft': data[9],
|
||||
'narrowband': data[10],
|
||||
'fmin': data[11],
|
||||
'fmax': data[12],
|
||||
'qrv': data[15],
|
||||
'rxbuffersize': data[16],
|
||||
'explorer': data[17],
|
||||
'stats': data[18]
|
||||
}
|
||||
try:
|
||||
with open(self.config_name, 'w') as configfile:
|
||||
|
|
|
@ -130,7 +130,7 @@ class DAEMON:
|
|||
# increase length of list for storing additional
|
||||
# parameters starting at entry 64
|
||||
data = data[:64] + [None] * (64 - len(data))
|
||||
|
||||
print(data)
|
||||
# data[1] mycall
|
||||
# data[2] mygrid
|
||||
# data[3] rx_audio
|
||||
|
@ -161,14 +161,6 @@ class DAEMON:
|
|||
# data[28] stats
|
||||
# TODO: We need to remove 5-12 and adjust the list number for other paramters
|
||||
# This is only a dirty fix
|
||||
data[5] = False
|
||||
data[6] = False
|
||||
data[7] = False
|
||||
data[8] = False
|
||||
data[9] = False
|
||||
data[10] = False
|
||||
data[11] = False
|
||||
data[12] = False
|
||||
|
||||
if data[0] == "STARTTNC":
|
||||
self.log.warning("[DMN] Starting TNC", rig=data[5], port=data[6])
|
||||
|
@ -197,60 +189,57 @@ class DAEMON:
|
|||
# this should hopefully avoid a ton of problems if we are just running in
|
||||
# disabled mode
|
||||
|
||||
if data[13] != "disabled":
|
||||
if data[5] != "disabled":
|
||||
|
||||
options.append("--radiocontrol")
|
||||
options.append(data[13])
|
||||
options.append(data[5])
|
||||
|
||||
if data[13] == "rigctld":
|
||||
if data[5] == "rigctld":
|
||||
options.append("--rigctld_ip")
|
||||
options.append(data[14])
|
||||
options.append(data[6])
|
||||
|
||||
options.append("--rigctld_port")
|
||||
options.append(data[15])
|
||||
options.append(data[7])
|
||||
|
||||
if data[16] == "True":
|
||||
if data[8] == "True":
|
||||
options.append("--scatter")
|
||||
|
||||
if data[17] == "True":
|
||||
if data[9] == "True":
|
||||
options.append("--fft")
|
||||
|
||||
if data[18] == "True":
|
||||
if data[10] == "True":
|
||||
options.append("--500hz")
|
||||
|
||||
options.append("--tuning_range_fmin")
|
||||
options.append(data[19])
|
||||
options.append(data[11])
|
||||
|
||||
options.append("--tuning_range_fmax")
|
||||
options.append(data[20])
|
||||
options.append(data[12])
|
||||
|
||||
# overriding FSK mode
|
||||
# if data[21] == "True":
|
||||
# if data[13] == "True":
|
||||
# options.append("--fsk")
|
||||
|
||||
options.append("--tx-audio-level")
|
||||
options.append(data[22])
|
||||
options.append(data[14])
|
||||
|
||||
if data[23] == "True":
|
||||
if data[15] == "True":
|
||||
options.append("--qrv")
|
||||
|
||||
options.append("--rx-buffer-size")
|
||||
options.append(data[24])
|
||||
options.append(data[16])
|
||||
|
||||
if data[25] == "True":
|
||||
if data[17] == "True":
|
||||
options.append("--explorer")
|
||||
|
||||
# we want our ssid like this: --ssid 1 2 3 4
|
||||
ssid_list = ""
|
||||
for i in data[26]:
|
||||
ssid_list += str(i) + " "
|
||||
options.append("--ssid")
|
||||
options.append(ssid_list)
|
||||
for i in data[18]:
|
||||
options.append(str(i))
|
||||
|
||||
if data[27] == "True":
|
||||
if data[19] == "True":
|
||||
options.append("--tune")
|
||||
|
||||
if data[28] == "True":
|
||||
if data[20] == "True":
|
||||
options.append("--stats")
|
||||
|
||||
# safe data to config file
|
||||
|
|
|
@ -478,6 +478,7 @@ def safe_execute(default, exception, function, *args):
|
|||
|
||||
|
||||
def return_key_from_object(default, obj, key):
|
||||
|
||||
try:
|
||||
return obj[key]
|
||||
except KeyError:
|
||||
|
|
|
@ -222,14 +222,6 @@ class RF:
|
|||
|
||||
self.hamlib = rig.radio()
|
||||
self.hamlib.open_rig(
|
||||
devicename=static.HAMLIB_DEVICE_NAME,
|
||||
deviceport=static.HAMLIB_DEVICE_PORT,
|
||||
hamlib_ptt_type=static.HAMLIB_PTT_TYPE,
|
||||
serialspeed=static.HAMLIB_SERIAL_SPEED,
|
||||
pttport=static.HAMLIB_PTT_PORT,
|
||||
data_bits=static.HAMLIB_DATA_BITS,
|
||||
stop_bits=static.HAMLIB_STOP_BITS,
|
||||
handshake=static.HAMLIB_HANDSHAKE,
|
||||
rigctld_ip=static.HAMLIB_RIGCTLD_IP,
|
||||
rigctld_port=static.HAMLIB_RIGCTLD_PORT,
|
||||
)
|
||||
|
|
|
@ -787,19 +787,19 @@ def process_daemon_commands(data):
|
|||
enable_stats = str(helpers.return_key_from_object("False", startparam,"enable_stats"))
|
||||
try:
|
||||
# convert ssid list to python list
|
||||
ssid_list = str(received_json["parameter"][0]["ssid_list"])
|
||||
ssid_list = str(helpers.return_key_from_object("0, 1, 2, 3, 4, 5, 6, 7, 8, 9", startparam, "ssid_list"))
|
||||
ssid_list = ssid_list.replace(" ", "")
|
||||
ssid_list = ssid_list.split(",")
|
||||
# convert str to int
|
||||
ssid_list = list(map(int, ssid_list))
|
||||
except KeyError:
|
||||
ssid_list = [0]
|
||||
ssid_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||
|
||||
# print some debugging parameters
|
||||
for item in received_json["parameter"][0]:
|
||||
for item in startparam:
|
||||
log.debug(
|
||||
f"[SCK] TNC Startup Config : {item}",
|
||||
value=received_json["parameter"][0][item],
|
||||
value=startparam[item],
|
||||
)
|
||||
|
||||
DAEMON_QUEUE.put(
|
||||
|
|
Loading…
Reference in a new issue