mirror of
https://github.com/markqvist/Sideband.git
synced 2026-04-27 22:25:39 +00:00
Added wifi connection option to RNode settings
This commit is contained in:
parent
ecdbacd5d2
commit
5d5f949a15
3 changed files with 122 additions and 51 deletions
|
|
@ -4533,58 +4533,40 @@ class SidebandApp(MDApp):
|
|||
self.root.ids.screen_manager.transition = self.slide_transition
|
||||
|
||||
def hardware_rnode_save(self):
|
||||
try:
|
||||
self.sideband.config["hw_rnode_frequency"] = int(float(self.hardware_rnode_screen.ids.hardware_rnode_frequency.text)*1000000)
|
||||
except:
|
||||
pass
|
||||
try: self.sideband.config["hw_rnode_frequency"] = int(float(self.hardware_rnode_screen.ids.hardware_rnode_frequency.text)*1000000)
|
||||
except: pass
|
||||
|
||||
try:
|
||||
self.sideband.config["hw_rnode_bandwidth"] = int(float(self.hardware_rnode_screen.ids.hardware_rnode_bandwidth.text)*1000)
|
||||
except:
|
||||
pass
|
||||
try: self.sideband.config["hw_rnode_bandwidth"] = int(float(self.hardware_rnode_screen.ids.hardware_rnode_bandwidth.text)*1000)
|
||||
except: pass
|
||||
|
||||
try:
|
||||
self.sideband.config["hw_rnode_tx_power"] = int(self.hardware_rnode_screen.ids.hardware_rnode_txpower.text)
|
||||
except:
|
||||
pass
|
||||
try: self.sideband.config["hw_rnode_tx_power"] = int(self.hardware_rnode_screen.ids.hardware_rnode_txpower.text)
|
||||
except: pass
|
||||
|
||||
try:
|
||||
self.sideband.config["hw_rnode_spreading_factor"] = int(self.hardware_rnode_screen.ids.hardware_rnode_spreadingfactor.text)
|
||||
except:
|
||||
pass
|
||||
try: self.sideband.config["hw_rnode_spreading_factor"] = int(self.hardware_rnode_screen.ids.hardware_rnode_spreadingfactor.text)
|
||||
except: pass
|
||||
|
||||
try:
|
||||
self.sideband.config["hw_rnode_coding_rate"] = int(self.hardware_rnode_screen.ids.hardware_rnode_codingrate.text)
|
||||
except:
|
||||
pass
|
||||
try: self.sideband.config["hw_rnode_coding_rate"] = int(self.hardware_rnode_screen.ids.hardware_rnode_codingrate.text)
|
||||
except: pass
|
||||
|
||||
try:
|
||||
self.sideband.config["hw_rnode_atl_short"] = float(self.hardware_rnode_screen.ids.hardware_rnode_atl_short.text)
|
||||
except:
|
||||
self.sideband.config["hw_rnode_atl_short"] = None
|
||||
try: self.sideband.config["hw_rnode_atl_short"] = float(self.hardware_rnode_screen.ids.hardware_rnode_atl_short.text)
|
||||
except: self.sideband.config["hw_rnode_atl_short"] = None
|
||||
|
||||
try:
|
||||
self.sideband.config["hw_rnode_atl_long"] = float(self.hardware_rnode_screen.ids.hardware_rnode_atl_long.text)
|
||||
except:
|
||||
self.sideband.config["hw_rnode_atl_long"] = None
|
||||
try: self.sideband.config["hw_rnode_atl_long"] = float(self.hardware_rnode_screen.ids.hardware_rnode_atl_long.text)
|
||||
except: self.sideband.config["hw_rnode_atl_long"] = None
|
||||
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_beaconinterval.text == "":
|
||||
self.sideband.config["hw_rnode_beaconinterval"] = None
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_beaconinterval.text == "": self.sideband.config["hw_rnode_beaconinterval"] = None
|
||||
else:
|
||||
try:
|
||||
self.sideband.config["hw_rnode_beaconinterval"] = int(self.hardware_rnode_screen.ids.hardware_rnode_beaconinterval.text)
|
||||
except:
|
||||
pass
|
||||
try: self.sideband.config["hw_rnode_beaconinterval"] = int(self.hardware_rnode_screen.ids.hardware_rnode_beaconinterval.text)
|
||||
except: pass
|
||||
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_beacondata.text == "":
|
||||
self.sideband.config["hw_rnode_beacondata"] = None
|
||||
else:
|
||||
self.sideband.config["hw_rnode_beacondata"] = self.hardware_rnode_screen.ids.hardware_rnode_beacondata.text
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_beacondata.text == "": self.sideband.config["hw_rnode_beacondata"] = None
|
||||
else: self.sideband.config["hw_rnode_beacondata"] = self.hardware_rnode_screen.ids.hardware_rnode_beacondata.text
|
||||
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_bt_device.text == "":
|
||||
self.sideband.config["hw_rnode_bt_device"] = None
|
||||
else:
|
||||
self.sideband.config["hw_rnode_bt_device"] = self.hardware_rnode_screen.ids.hardware_rnode_bt_device.text
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_bt_device.text == "": self.sideband.config["hw_rnode_bt_device"] = None
|
||||
else: self.sideband.config["hw_rnode_bt_device"] = self.hardware_rnode_screen.ids.hardware_rnode_bt_device.text
|
||||
|
||||
if self.hardware_rnode_screen.ids.hardware_rnode_tcp_host.text == "": self.sideband.config["hw_rnode_tcp_host"] = None
|
||||
else: self.sideband.config["hw_rnode_tcp_host"] = self.hardware_rnode_screen.ids.hardware_rnode_tcp_host.text
|
||||
|
||||
self.sideband.save_configuration()
|
||||
|
||||
|
|
@ -4724,6 +4706,12 @@ class SidebandApp(MDApp):
|
|||
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def hardware_rnode_tcp_toggle_action(self, sender=None, event=None):
|
||||
if sender.active: self.sideband.config["hw_rnode_tcp"] = True
|
||||
else: self.sideband.config["hw_rnode_tcp"] = False
|
||||
|
||||
self.sideband.save_configuration()
|
||||
|
||||
def hardware_rnode_init(self, sender=None):
|
||||
if not self.hardware_rnode_ready:
|
||||
if not self.root.ids.screen_manager.has_screen("hardware_rnode_screen"):
|
||||
|
|
@ -4773,6 +4761,8 @@ class SidebandApp(MDApp):
|
|||
t_btd = str(self.sideband.config["hw_rnode_bt_device"])
|
||||
else:
|
||||
t_btd = ""
|
||||
if self.sideband.config["hw_rnode_tcp_host"] != None: t_th = str(self.sideband.config["hw_rnode_tcp_host"])
|
||||
else: t_th = ""
|
||||
if self.sideband.config["hw_rnode_atl_short"] != None:
|
||||
t_ats = str(self.sideband.config["hw_rnode_atl_short"])
|
||||
else:
|
||||
|
|
@ -4784,6 +4774,7 @@ class SidebandApp(MDApp):
|
|||
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_bluetooth.active = self.sideband.config["hw_rnode_bluetooth"]
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_ble.active = self.sideband.config["hw_rnode_ble"]
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_tcp.active = self.sideband.config["hw_rnode_tcp"]
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_framebuffer.active = self.sideband.config["hw_rnode_enable_framebuffer"]
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_frequency.text = t_freq
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_bandwidth.text = t_bw
|
||||
|
|
@ -4793,6 +4784,7 @@ class SidebandApp(MDApp):
|
|||
self.hardware_rnode_screen.ids.hardware_rnode_beaconinterval.text = t_bi
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_beacondata.text = t_bd
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_bt_device.text = t_btd
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_tcp_host.text = t_th
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_atl_short.text = t_ats
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_atl_long.text = t_atl
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_frequency.bind(focus=focus_save)
|
||||
|
|
@ -4803,6 +4795,7 @@ class SidebandApp(MDApp):
|
|||
self.hardware_rnode_screen.ids.hardware_rnode_beaconinterval.bind(focus=focus_save)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_beacondata.bind(focus=focus_save)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_bt_device.bind(focus=focus_save)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_tcp_host.bind(focus=focus_save)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_frequency.bind(on_text_validate=save_connectivity)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_bandwidth.bind(on_text_validate=save_connectivity)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_txpower.bind(on_text_validate=save_connectivity)
|
||||
|
|
@ -4815,6 +4808,7 @@ class SidebandApp(MDApp):
|
|||
self.hardware_rnode_screen.ids.hardware_rnode_bluetooth.bind(active=self.hardware_rnode_bt_toggle_action)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_ble.bind(active=self.hardware_rnode_ble_toggle_action)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_framebuffer.bind(active=self.hardware_rnode_framebuffer_toggle_action)
|
||||
self.hardware_rnode_screen.ids.hardware_rnode_tcp.bind(active=self.hardware_rnode_tcp_toggle_action)
|
||||
|
||||
self.hardware_rnode_ready = True
|
||||
|
||||
|
|
|
|||
|
|
@ -680,8 +680,10 @@ class SidebandCore():
|
|||
if not "hw_rnode_beacondata" in self.config: self.config["hw_rnode_beacondata"] = None
|
||||
if not "hw_rnode_bluetooth" in self.config: self.config["hw_rnode_bluetooth"] = False
|
||||
if not "hw_rnode_ble" in self.config: self.config["hw_rnode_ble"] = False
|
||||
if not "hw_rnode_tcp" in self.config: self.config["hw_rnode_tcp"] = False
|
||||
if not "hw_rnode_enable_framebuffer" in self.config: self.config["hw_rnode_enable_framebuffer"] = False
|
||||
if not "hw_rnode_bt_device" in self.config: self.config["hw_rnode_bt_device"] = None
|
||||
if not "hw_rnode_tcp_host" in self.config: self.config["hw_rnode_tcp_host"] = None
|
||||
if not "hw_rnode_atl_short" in self.config: self.config["hw_rnode_atl_short"] = None
|
||||
if not "hw_rnode_atl_long" in self.config: self.config["hw_rnode_atl_long"] = None
|
||||
|
||||
|
|
|
|||
|
|
@ -2589,8 +2589,8 @@ MDScreen:
|
|||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
padding: [0,dp(14),dp(24),dp(48)]
|
||||
height: dp(86)
|
||||
padding: [0,dp(14),dp(24),dp(0)]
|
||||
height: dp(48)
|
||||
|
||||
MDLabel:
|
||||
text: "Control RNode Display"
|
||||
|
|
@ -2602,13 +2602,71 @@ MDScreen:
|
|||
active: False
|
||||
|
||||
MDLabel:
|
||||
text: "Bluetooth Settings\\n"
|
||||
text: "•"
|
||||
font_style: "H6"
|
||||
text_size: self.size
|
||||
halign: "center"
|
||||
size_hint_y: None
|
||||
height: self.texture_size[1]
|
||||
padding: [0, dp(2+14), 0, dp(22+24)]
|
||||
|
||||
MDLabel:
|
||||
text: "WiFi & Ethernet Connection\\n"
|
||||
font_style: "H6"
|
||||
|
||||
MDLabel:
|
||||
id: hardware_rnode_info_wifi
|
||||
markup: True
|
||||
text: "If your device is hosting or connected to a WiFi network, you can connect it by entering its IP address or hostname below."
|
||||
size_hint_y: None
|
||||
text_size: self.width, None
|
||||
height: self.texture_size[1]
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
padding: [0,dp(12),dp(24),dp(0)]
|
||||
height: dp(36)
|
||||
|
||||
MDLabel:
|
||||
text: "Connect using WiFi"
|
||||
font_style: "H6"
|
||||
|
||||
MDSwitch:
|
||||
id: hardware_rnode_tcp
|
||||
pos_hint: {"center_y": 0.3}
|
||||
active: False
|
||||
|
||||
MDBoxLayout:
|
||||
orientation: "vertical"
|
||||
# spacing: "24dp"
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
# padding: [dp(0), dp(0), dp(0), dp(35)]
|
||||
|
||||
MDTextField:
|
||||
id: hardware_rnode_tcp_host
|
||||
hint_text: "RNode IP address or hostname"
|
||||
text: ""
|
||||
font_size: dp(24)
|
||||
|
||||
MDLabel:
|
||||
text: "•"
|
||||
font_style: "H6"
|
||||
text_size: self.size
|
||||
halign: "center"
|
||||
size_hint_y: None
|
||||
height: self.texture_size[1]
|
||||
padding: [0, dp(2+14), 0, dp(22+24)]
|
||||
|
||||
MDLabel:
|
||||
text: "Bluetooth Connection\\n"
|
||||
font_style: "H6"
|
||||
|
||||
MDLabel:
|
||||
id: hardware_rnode_info
|
||||
markup: True
|
||||
text: "If you enable connection via Bluetooth, Sideband will attempt to connect to any available and paired RNodes over Bluetooth. If your RNode uses BLE (ESP32-S3 and nRF devices) instead of classic Bluetooth, enable the [i]Device requires BLE[/i] option as well."
|
||||
text: "If you enable connection via Bluetooth, Sideband will attempt to connect to any available and paired RNodes over Bluetooth.\\n\\nIf your RNode uses BLE (ESP32-S3 and nRF devices) instead of classic Bluetooth, enable the [i]Device requires BLE[/i] option as well."
|
||||
size_hint_y: None
|
||||
text_size: self.width, None
|
||||
height: self.texture_size[1]
|
||||
|
|
@ -2631,8 +2689,8 @@ MDScreen:
|
|||
MDBoxLayout:
|
||||
orientation: "horizontal"
|
||||
size_hint_y: None
|
||||
padding: [0,0,dp(24),dp(0)]
|
||||
height: dp(48)
|
||||
padding: [0,0,dp(24),dp(48)]
|
||||
height: dp(86)
|
||||
|
||||
MDLabel:
|
||||
text: "Device requires BLE"
|
||||
|
|
@ -2643,10 +2701,14 @@ MDScreen:
|
|||
pos_hint: {"center_y": 0.3}
|
||||
active: False
|
||||
|
||||
MDLabel:
|
||||
text: "Bluetooth Pairing\\n"
|
||||
font_style: "H6"
|
||||
|
||||
MDLabel:
|
||||
id: hardware_rnode_info
|
||||
markup: True
|
||||
text: "You must first pair the RNode with your device for this to work. To put an RNode into pairing mode, hold down the multi-function user button for more than 5 seconds, and release it. The display will indicate pairing mode.You can then pair the device using the Bluetooth settings of your device, or by pressing the pairing button below. On older Android versions, the in-app scanning and pairing may not work. In this case, use the Bluetooth settings of your device to scan and pair.\\n"
|
||||
text: "To put an RNode into pairing mode, hold down the multi-function user button for more than 5 seconds, and release it. The display will indicate pairing mode. If the in-app pairing does not find any devices, use the Bluetooth settings of your device to scan and pair.\\n"
|
||||
size_hint_y: None
|
||||
text_size: self.width, None
|
||||
height: self.texture_size[1]
|
||||
|
|
@ -2674,12 +2736,16 @@ MDScreen:
|
|||
spacing: "24dp"
|
||||
size_hint_y: None
|
||||
height: self.minimum_height
|
||||
padding: [dp(0), dp(0), dp(0), dp(12)]
|
||||
padding: [dp(0), dp(0), dp(0), dp(12+24)]
|
||||
|
||||
MDLabel:
|
||||
text: "Preffered Bluetooth Device\\n"
|
||||
font_style: "H6"
|
||||
|
||||
MDLabel:
|
||||
id: hardware_rnode_info
|
||||
markup: True
|
||||
text: "By default, Sideband will connect to the first available RNode that is paired. If you want to always use a specific RNode, you can enter its name in the Preferred RNode Device Name field below, for example \\"RNode A8EB\\"."
|
||||
text: "Sideband will connect to the first available RNode that is paired. If you want to always use a specific RNode, you can enter its name here, for example \\"RNode A8EB\\"."
|
||||
size_hint_y: None
|
||||
text_size: self.width, None
|
||||
height: self.texture_size[1]
|
||||
|
|
@ -2697,6 +2763,15 @@ MDScreen:
|
|||
text: ""
|
||||
font_size: dp(24)
|
||||
|
||||
MDLabel:
|
||||
text: "•"
|
||||
font_style: "H6"
|
||||
text_size: self.size
|
||||
halign: "center"
|
||||
size_hint_y: None
|
||||
height: self.texture_size[1]
|
||||
padding: [0, dp(2+14), 0, dp(22)]
|
||||
|
||||
MDLabel:
|
||||
text: "\\n\\nDevice Bluetooth Control\\n"
|
||||
font_style: "H6"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue