Added preferred RNode setting for Bluetooth connectivity

This commit is contained in:
Mark Qvist 2022-11-03 20:22:16 +01:00
parent 433adb0c48
commit ecb5c6ea40
2 changed files with 19 additions and 0 deletions

View File

@ -1456,6 +1456,11 @@ class SidebandApp(MDApp):
else:
self.sideband.config["hw_rnode_beacondata"] = self.root.ids.hardware_rnode_beacondata.text
if self.root.ids.hardware_rnode_bt_device.text == "":
self.sideband.config["hw_rnode_bt_device"] = None
else:
self.sideband.config["hw_rnode_bt_device"] = self.root.ids.hardware_rnode_bt_device.text
self.sideband.save_configuration()
def hardware_rnode_bt_on_action(self, sender=None):
@ -1550,6 +1555,10 @@ class SidebandApp(MDApp):
t_bd = str(self.sideband.config["hw_rnode_beacondata"])
else:
t_bd = ""
if self.sideband.config["hw_rnode_bt_device"] != None:
t_btd = str(self.sideband.config["hw_rnode_bt_device"])
else:
t_btd = ""
self.root.ids.hardware_rnode_bluetooth.active = self.sideband.config["hw_rnode_bluetooth"]
self.root.ids.hardware_rnode_frequency.text = t_freq
@ -1559,6 +1568,7 @@ class SidebandApp(MDApp):
self.root.ids.hardware_rnode_codingrate.text = t_cr
self.root.ids.hardware_rnode_beaconinterval.text = t_bi
self.root.ids.hardware_rnode_beacondata.text = t_bd
self.root.ids.hardware_rnode_bt_device.text = t_btd
self.root.ids.hardware_rnode_frequency.bind(focus=focus_save)
self.root.ids.hardware_rnode_bandwidth.bind(focus=focus_save)
self.root.ids.hardware_rnode_txpower.bind(focus=focus_save)
@ -1566,6 +1576,7 @@ class SidebandApp(MDApp):
self.root.ids.hardware_rnode_codingrate.bind(focus=focus_save)
self.root.ids.hardware_rnode_beaconinterval.bind(focus=focus_save)
self.root.ids.hardware_rnode_beacondata.bind(focus=focus_save)
self.root.ids.hardware_rnode_bt_device.bind(focus=focus_save)
self.root.ids.hardware_rnode_frequency.bind(on_text_validate=save_connectivity)
self.root.ids.hardware_rnode_bandwidth.bind(on_text_validate=save_connectivity)
self.root.ids.hardware_rnode_txpower.bind(on_text_validate=save_connectivity)

View File

@ -229,6 +229,7 @@ class SidebandCore():
self.config["hw_rnode_tx_power"] = 0
self.config["hw_rnode_beaconinterval"] = None
self.config["hw_rnode_beacondata"] = None
self.config["hw_rnode_bt_device"] = None
self.config["hw_modem_baudrate"] = 57600
self.config["hw_modem_databits"] = 8
self.config["hw_modem_stopbits"] = 1
@ -331,6 +332,8 @@ class SidebandCore():
self.config["hw_rnode_beacondata"] = None
if not "hw_rnode_bluetooth" in self.config:
self.config["hw_rnode_bluetooth"] = False
if not "hw_rnode_bt_device" in self.config:
self.config["hw_rnode_bt_device"] = None
if not "hw_modem_baudrate" in self.config:
self.config["hw_modem_baudrate"] = 115200
@ -1390,6 +1393,10 @@ class SidebandCore():
# TODO: Remove
RNS.log("Allowing RNode bluetooth")
rnode_allow_bluetooth = True
if self.config["hw_rnode_bt_device"] != None:
bt_device_name = self.config["hw_rnode_bt_device"]
else:
bt_device_name = None
else:
# TODO: Remove
RNS.log("Disallowing RNode bluetooth since config is disabled")
@ -1424,6 +1431,7 @@ class SidebandCore():
id_interval = self.config["hw_rnode_beaconinterval"],
id_callsign = self.config["hw_rnode_beacondata"],
allow_bluetooth = rnode_allow_bluetooth,
target_device_name = bt_device_name,
)
rnodeinterface.OUT = True