From 67cfa0a514c7de4605ed7360e15a81aa781e510e Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Fri, 24 Apr 2026 11:51:26 -0600 Subject: Added difference serial protocols --- ui/__pycache__/__init__.cpython-312.pyc | Bin 140 -> 149 bytes ui/__pycache__/__init__.cpython-314.pyc | Bin 142 -> 151 bytes ui/__pycache__/add_device_dialog.cpython-312.pyc | Bin 29737 -> 29935 bytes ui/__pycache__/add_device_dialog.cpython-314.pyc | Bin 0 -> 32389 bytes ui/__pycache__/config_dialog.cpython-312.pyc | Bin 6917 -> 6931 bytes ui/__pycache__/control_editor.cpython-312.pyc | Bin 22558 -> 22602 bytes ui/__pycache__/control_panel.cpython-312.pyc | Bin 42676 -> 42708 bytes ui/__pycache__/main_window.cpython-312.pyc | Bin 28733 -> 28788 bytes ui/__pycache__/profile_manager_ui.cpython-312.pyc | Bin 8357 -> 8371 bytes ui/__pycache__/strip_chart.cpython-312.pyc | Bin 14879 -> 14901 bytes ui/add_device_dialog.py | 35 ++++++++++++--------- ui/windows/__pycache__/__init__.cpython-312.pyc | Bin 148 -> 157 bytes .../__pycache__/devices_window.cpython-312.pyc | Bin 22008 -> 22041 bytes ui/windows/__pycache__/plot_window.cpython-312.pyc | Bin 44550 -> 44685 bytes .../__pycache__/settings_window.cpython-312.pyc | Bin 15906 -> 15935 bytes .../__pycache__/signals_window.cpython-312.pyc | Bin 53973 -> 54087 bytes 16 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 ui/__pycache__/add_device_dialog.cpython-314.pyc (limited to 'ui') diff --git a/ui/__pycache__/__init__.cpython-312.pyc b/ui/__pycache__/__init__.cpython-312.pyc index 8dc1c2f..42ac581 100644 Binary files a/ui/__pycache__/__init__.cpython-312.pyc and b/ui/__pycache__/__init__.cpython-312.pyc differ diff --git a/ui/__pycache__/__init__.cpython-314.pyc b/ui/__pycache__/__init__.cpython-314.pyc index 15d71d0..ef40b13 100644 Binary files a/ui/__pycache__/__init__.cpython-314.pyc and b/ui/__pycache__/__init__.cpython-314.pyc differ diff --git a/ui/__pycache__/add_device_dialog.cpython-312.pyc b/ui/__pycache__/add_device_dialog.cpython-312.pyc index 2da95a6..990c229 100644 Binary files a/ui/__pycache__/add_device_dialog.cpython-312.pyc and b/ui/__pycache__/add_device_dialog.cpython-312.pyc differ diff --git a/ui/__pycache__/add_device_dialog.cpython-314.pyc b/ui/__pycache__/add_device_dialog.cpython-314.pyc new file mode 100644 index 0000000..f5852ba Binary files /dev/null and b/ui/__pycache__/add_device_dialog.cpython-314.pyc differ diff --git a/ui/__pycache__/config_dialog.cpython-312.pyc b/ui/__pycache__/config_dialog.cpython-312.pyc index cbc9cf0..5a051dc 100644 Binary files a/ui/__pycache__/config_dialog.cpython-312.pyc and b/ui/__pycache__/config_dialog.cpython-312.pyc differ diff --git a/ui/__pycache__/control_editor.cpython-312.pyc b/ui/__pycache__/control_editor.cpython-312.pyc index 3a53377..e76411d 100644 Binary files a/ui/__pycache__/control_editor.cpython-312.pyc and b/ui/__pycache__/control_editor.cpython-312.pyc differ diff --git a/ui/__pycache__/control_panel.cpython-312.pyc b/ui/__pycache__/control_panel.cpython-312.pyc index 1c101a8..45f1eb9 100644 Binary files a/ui/__pycache__/control_panel.cpython-312.pyc and b/ui/__pycache__/control_panel.cpython-312.pyc differ diff --git a/ui/__pycache__/main_window.cpython-312.pyc b/ui/__pycache__/main_window.cpython-312.pyc index 054aa5b..3aefd67 100644 Binary files a/ui/__pycache__/main_window.cpython-312.pyc and b/ui/__pycache__/main_window.cpython-312.pyc differ diff --git a/ui/__pycache__/profile_manager_ui.cpython-312.pyc b/ui/__pycache__/profile_manager_ui.cpython-312.pyc index 97cbe3a..93491f7 100644 Binary files a/ui/__pycache__/profile_manager_ui.cpython-312.pyc and b/ui/__pycache__/profile_manager_ui.cpython-312.pyc differ diff --git a/ui/__pycache__/strip_chart.cpython-312.pyc b/ui/__pycache__/strip_chart.cpython-312.pyc index ff41c1a..a3e25c0 100644 Binary files a/ui/__pycache__/strip_chart.cpython-312.pyc and b/ui/__pycache__/strip_chart.cpython-312.pyc differ diff --git a/ui/add_device_dialog.py b/ui/add_device_dialog.py index 7e8e935..4df71a3 100644 --- a/ui/add_device_dialog.py +++ b/ui/add_device_dialog.py @@ -23,7 +23,7 @@ from PyQt6.QtGui import QFont from devices.device_registry import DeviceRegistry from devices.analog_input import AnalogInputDevice from devices.digital_io import DigitalIODevice -from devices.serial_device import SerialDevice +from devices.serial_device import SerialDevice, _FORMAT_LABELS # ── Port scanner thread ─────────────────────────────────────────────────────── @@ -339,7 +339,7 @@ class DigitalIOPanel(QWidget): class SerialPanel(QWidget): - """Config fields for SerialDevice with live port scanner.""" + """Config fields for SerialDevice — port, baud, protocol/format, simulate.""" def __init__(self): super().__init__() @@ -354,33 +354,34 @@ class SerialPanel(QWidget): form.addRow("Port:", self.port_edit) self.baud_cb = QComboBox() - self.baud_cb.addItems(["9600", "19200", "38400", "57600", "115200", "230400", "460800"]) + self.baud_cb.addItems(["1200", "2400", "4800", "9600", "19200", "38400", + "57600", "115200", "230400", "460800"]) self.baud_cb.setCurrentText("115200") form.addRow("Baud Rate:", self.baud_cb) - self.ch_spin = QSpinBox() - self.ch_spin.setRange(1, 32) - self.ch_spin.setValue(4) - form.addRow("Channels:", self.ch_spin) - self.fmt_cb = QComboBox() - self.fmt_cb.addItems(["key:val", "csv", "json"]) - form.addRow("Parse Format:", self.fmt_cb) + self.fmt_cb.addItems(list(_FORMAT_LABELS.keys())) + form.addRow("Protocol / Format:", self.fmt_cb) self.sim_chk = QCheckBox("Simulation mode") self.sim_chk.setChecked(False) form.addRow(self.sim_chk) + note = QLabel("Protocol-specific settings (queries, registers, motors) available in device config dialog.") + note.setObjectName("traceSource") + note.setWordWrap(True) + lay.addLayout(form) + lay.addWidget(note) lay.addWidget(PortScanGroup(self.port_edit)) def build_device(self, device_id: str) -> SerialDevice: + fmt = _FORMAT_LABELS.get(self.fmt_cb.currentText(), "key:val") return SerialDevice( device_id=device_id, port=self.port_edit.text().strip() or "COM3", baud_rate=int(self.baud_cb.currentText()), - num_channels=self.ch_spin.value(), - parse_format=self.fmt_cb.currentText(), + parse_format=fmt, simulate=self.sim_chk.isChecked(), ) @@ -388,8 +389,8 @@ class SerialPanel(QWidget): # ── Main dialog ─────────────────────────────────────────────────────────────── _PANELS = { - "Analog Input": AnalogInputPanel, - "Digital I/O": DigitalIOPanel, + "Analog Input": AnalogInputPanel, + "Digital I/O": DigitalIOPanel, "Serial / UART": SerialPanel, } @@ -480,7 +481,11 @@ class AddDeviceDialog(QDialog): # Auto-generate ID if blank if not dev_id: - prefixes = {"Analog Input": "ai", "Digital I/O": "dio", "Serial / UART": "ser"} + prefixes = { + "Analog Input": "ai", + "Digital I/O": "dio", + "Serial / UART": "ser", + } prefix = prefixes.get(type_name, "dev") existing = {d.info.device_id for d in self.registry.all_instances()} for i in range(100): diff --git a/ui/windows/__pycache__/__init__.cpython-312.pyc b/ui/windows/__pycache__/__init__.cpython-312.pyc index 66495c5..1454fd8 100644 Binary files a/ui/windows/__pycache__/__init__.cpython-312.pyc and b/ui/windows/__pycache__/__init__.cpython-312.pyc differ diff --git a/ui/windows/__pycache__/devices_window.cpython-312.pyc b/ui/windows/__pycache__/devices_window.cpython-312.pyc index 601221d..fb52b79 100644 Binary files a/ui/windows/__pycache__/devices_window.cpython-312.pyc and b/ui/windows/__pycache__/devices_window.cpython-312.pyc differ diff --git a/ui/windows/__pycache__/plot_window.cpython-312.pyc b/ui/windows/__pycache__/plot_window.cpython-312.pyc index c72d74b..7499763 100644 Binary files a/ui/windows/__pycache__/plot_window.cpython-312.pyc and b/ui/windows/__pycache__/plot_window.cpython-312.pyc differ diff --git a/ui/windows/__pycache__/settings_window.cpython-312.pyc b/ui/windows/__pycache__/settings_window.cpython-312.pyc index d596487..47d5611 100644 Binary files a/ui/windows/__pycache__/settings_window.cpython-312.pyc and b/ui/windows/__pycache__/settings_window.cpython-312.pyc differ diff --git a/ui/windows/__pycache__/signals_window.cpython-312.pyc b/ui/windows/__pycache__/signals_window.cpython-312.pyc index 8b0db88..ec57533 100644 Binary files a/ui/windows/__pycache__/signals_window.cpython-312.pyc and b/ui/windows/__pycache__/signals_window.cpython-312.pyc differ -- cgit v1.2.3