Refactored hardware screen

This commit is contained in:
Mark Qvist 2025-12-25 22:20:34 +01:00
commit 7ddea1e175
4 changed files with 1712 additions and 1670 deletions

File diff suppressed because it is too large Load diff

View file

@ -2036,10 +2036,8 @@ class SidebandCore():
except Exception as e:
RNS.log("Error on client RPC connection: "+str(e), RNS.LOG_ERROR)
RNS.trace_exception(e)
try:
connection.close()
except:
pass
try: connection.close()
except: pass
return rpc_client_job

1691
sbapp/ui/hardware.py Normal file

File diff suppressed because it is too large Load diff

View file

@ -1978,717 +1978,3 @@ MDScreen:
text_size: self.width, None
height: self.texture_size[1]
"""
layout_hardware_screen = """
MDScreen:
name: "hardware_screen"
BoxLayout:
orientation: "vertical"
MDTopAppBar:
title: "Hardware"
anchor_title: "left"
elevation: 0
left_action_items:
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
right_action_items:
[
['close', lambda x: root.app.close_hardware_action(self)],
]
ScrollView:
id: hardware_scrollview
MDBoxLayout:
orientation: "vertical"
spacing: "8dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(28), dp(48), dp(28), dp(16)]
MDLabel:
text: "Configure Hardware Parameters\\n"
font_style: "H6"
MDLabel:
id: hardware_info
markup: True
text: ""
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDBoxLayout:
orientation: "vertical"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(35), dp(0), dp(35)]
MDRectangleFlatIconButton:
id: hardware_rnode_button
icon: "radio-handheld"
text: "RNode"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_action(self)
MDRectangleFlatIconButton:
id: hardware_modem_button
icon: "router-wireless"
text: "Radio Modem"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_modem_action(self)
disabled: False
MDRectangleFlatIconButton:
id: hardware_serial_button
icon: "cable-data"
text: "Serial Port"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_serial_action(self)
disabled: False
"""
layout_hardware_modem_screen = """
MDScreen:
name: "hardware_modem_screen"
BoxLayout:
orientation: "vertical"
MDTopAppBar:
title: "Radio Modem"
anchor_title: "left"
elevation: 0
left_action_items:
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
right_action_items:
[
['close', lambda x: root.app.close_sub_hardware_action(self)],
]
ScrollView:
id: hardware_modem_scrollview
MDBoxLayout:
orientation: "vertical"
spacing: "8dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(28), dp(48), dp(28), dp(16)]
MDLabel:
text: "Modem Hardware Parameters\\n"
font_style: "H6"
MDLabel:
id: hardware_modem_info
markup: True
text: "To communicate using a Radio Modem, you will need to specify the following parameters. Serial port parameters must be set to match those of the modem. CSMA parameters can be left at their default values in most cases.\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDLabel:
text: "Port Options"
font_style: "H6"
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDTextField:
id: hardware_modem_baudrate
hint_text: "Baud Rate"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(24)]
MDTextField:
id: hardware_modem_databits
hint_text: "Data Bits"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_modem_parity
hint_text: "Parity"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_modem_stopbits
hint_text: "Stop Bits"
text: ""
font_size: dp(24)
MDLabel:
text: "CSMA Parameters"
font_style: "H6"
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(0)]
MDTextField:
id: hardware_modem_preamble
hint_text: "Preamble (ms)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_modem_tail
hint_text: "TX Tail (ms)"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(24)]
MDTextField:
id: hardware_modem_persistence
hint_text: "Persistence (1-255)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_modem_slottime
hint_text: "Slot Time (ms)"
text: ""
font_size: dp(24)
MDLabel:
text: "Optional Settings"
font_style: "H6"
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDTextField:
id: hardware_modem_beaconinterval
hint_text: "Beacon Interval (seconds)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_modem_beacondata
hint_text: "Beacon Data"
text: ""
font_size: dp(24)
"""
layout_hardware_rnode_screen = """
MDScreen:
name: "hardware_rnode_screen"
BoxLayout:
orientation: "vertical"
MDTopAppBar:
title: "RNode"
anchor_title: "left"
elevation: 0
left_action_items:
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
right_action_items:
[
['close', lambda x: root.app.close_sub_hardware_action(self)],
]
ScrollView:
id: hardware_rnode_scrollview
MDBoxLayout:
orientation: "vertical"
spacing: "8dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(28), dp(48), dp(28), dp(16)]
MDLabel:
text: "RNode Hardware Parameters\\n"
font_style: "H6"
MDLabel:
id: hardware_rnode_info
markup: True
text: "To communicate using an RNode, you will need to specify the following parameters. For two or more RNodes to be able to communicate, all parameters must match, except for the [i]Coding Rate[/i] and [i]TX Power[/i] parameter, which can vary between devices.\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(48)]
MDRectangleFlatIconButton:
id: rnode_mote_export
icon: "upload"
text: "Export"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_export(self)
MDRectangleFlatIconButton:
id: rnode_mote_import
icon: "download"
text: "Import"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_import(self)
MDLabel:
text: "Radio Options\\n"
font_style: "H6"
# MDTextField:
# id: hardware_rnode_modulation
# hint_text: "Modulation"
# text: "LoRa"
# disabled: True
# font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDTextField:
id: hardware_rnode_frequency
hint_text: "Frequency (MHz)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_rnode_bandwidth
hint_text: "Bandwidth (KHz)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_rnode_txpower
hint_text: "TX Power (dBm)"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(24)]
MDTextField:
id: hardware_rnode_spreadingfactor
hint_text: "Spreading Factor"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_rnode_codingrate
hint_text: "Coding Rate"
text: ""
font_size: dp(24)
MDLabel:
text: "Optional Settings"
font_style: "H6"
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDTextField:
id: hardware_rnode_beaconinterval
hint_text: "Beacon Interval (seconds)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_rnode_beacondata
hint_text: "Beacon Data"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDTextField:
id: hardware_rnode_atl_short
hint_text: "Airime Limit % (15s)"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_rnode_atl_long
hint_text: "Airime Limit % (1h)"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,dp(14),dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Control RNode Display"
font_style: "H6"
MDSwitch:
id: hardware_rnode_framebuffer
pos_hint: {"center_y": 0.3}
active: False
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: "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.\\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]
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(0)]
height: dp(48)
MDLabel:
text: "Connect using Bluetooth"
font_style: "H6"
MDSwitch:
id: hardware_rnode_bluetooth
pos_hint: {"center_y": 0.3}
active: False
MDBoxLayout:
orientation: "horizontal"
size_hint_y: None
padding: [0,0,dp(24),dp(48)]
height: dp(86)
MDLabel:
text: "Device requires BLE"
font_style: "H6"
MDSwitch:
id: hardware_rnode_ble
pos_hint: {"center_y": 0.3}
active: False
MDLabel:
text: "Bluetooth Pairing\\n"
font_style: "H6"
MDLabel:
id: hardware_rnode_info
markup: True
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]
MDBoxLayout:
orientation: "vertical"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(12)]
MDRectangleFlatIconButton:
id: hardware_rnode_bt_scan_button
icon: "bluetooth-connect"
text: "Pair New Device"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_bt_scan_action(self)
MDBoxLayout:
id: rnode_scan_results
orientation: "vertical"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
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: "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]
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_bt_device
hint_text: "Preferred RNode Device Name"
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"
MDLabel:
id: hardware_rnode_info
markup: True
text: "\\n\\nIf your RNode does not have a physical pairing button, you can enable Bluetooth and put it into pairing mode by first connecting it via a USB cable, and using the buttons below. When plugging in the RNode over USB, you must grant Sideband permission to the USB device for this to work.\\n\\nYou can also change Bluetooth settings using the \\"rnodeconf\\" utility from a computer.\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDBoxLayout:
orientation: "vertical"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDRectangleFlatIconButton:
id: hardware_rnode_bt_on_button
icon: "bluetooth"
text: "Enable Bluetooth"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_bt_on_action(self)
MDRectangleFlatIconButton:
id: hardware_rnode_bt_off_button
icon: "bluetooth-off"
text: "Disable Bluetooth"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_bt_off_action(self)
disabled: False
MDRectangleFlatIconButton:
id: hardware_rnode_bt_pair_button
icon: "link-variant"
text: "Start Pairing Mode"
padding: [dp(0), dp(14), dp(0), dp(14)]
icon_size: dp(24)
font_size: dp(16)
size_hint: [1.0, None]
on_release: root.app.hardware_rnode_bt_pair_action(self)
disabled: False
"""
layout_hardware_serial_screen = """
MDScreen:
name: "hardware_serial_screen"
BoxLayout:
orientation: "vertical"
MDTopAppBar:
title: "Serial Port"
anchor_title: "left"
elevation: 0
left_action_items:
[['menu', lambda x: root.app.nav_drawer.set_state("open")]]
right_action_items:
[
['close', lambda x: root.app.close_sub_hardware_action(self)],
]
ScrollView:
id: hardware_serial_scrollview
MDBoxLayout:
orientation: "vertical"
spacing: "8dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(28), dp(48), dp(28), dp(16)]
MDLabel:
text: "Serial Hardware Parameters\\n"
font_style: "H6"
MDLabel:
id: hardware_serial_info
markup: True
text: "To communicate using a serial port, you will need to specify the following parameters. If communicating directly to another Reticulum instance over serial, the parameters must match the other device.\\n\\nIf you are using a serial-connected device to pass on data to other Reticulum instances, it should be configured to pass data transparently to the desired endpoints.\\n"
size_hint_y: None
text_size: self.width, None
height: self.texture_size[1]
MDLabel:
text: "Port Options"
font_style: "H6"
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
# padding: [dp(0), dp(0), dp(0), dp(35)]
MDTextField:
id: hardware_serial_baudrate
hint_text: "Baud Rate"
text: ""
font_size: dp(24)
MDBoxLayout:
orientation: "horizontal"
spacing: "24dp"
size_hint_y: None
height: self.minimum_height
padding: [dp(0), dp(0), dp(0), dp(24)]
MDTextField:
id: hardware_serial_databits
hint_text: "Data Bits"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_serial_parity
hint_text: "Parity"
text: ""
font_size: dp(24)
MDTextField:
id: hardware_serial_stopbits
hint_text: "Stop Bits"
text: ""
font_size: dp(24)
"""