diff options
| author | Christian Kolset <ckolset@colostate.edu> | 2026-07-27 17:13:41 -0600 |
|---|---|---|
| committer | Christian Kolset <ckolset@colostate.edu> | 2026-07-27 17:13:41 -0600 |
| commit | c3f07a7ffa320aecb3fca5dd40e7644424bddfb5 (patch) | |
| tree | 42d1e9062e7800f24937a62bef06acda8959001b | |
| parent | fc6f90404c9428362f1a0c62bb28eb350c0f248d (diff) | |
Fix .gitignore: remove duplicate entry for plugins/enabled.json
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | devices/serial_device.py | 2 | ||||
| -rw-r--r-- | ui/control_panel.py | 17 |
3 files changed, 14 insertions, 6 deletions
@@ -6,3 +6,4 @@ __pychache__/ .claude/settings.local.json plugins/enabled.json plugins/enabled.json +plugins/enabled.json diff --git a/devices/serial_device.py b/devices/serial_device.py index 8b8de04..ca551c6 100644 --- a/devices/serial_device.py +++ b/devices/serial_device.py @@ -157,6 +157,8 @@ class SerialDevice(BaseDevice): return mapped def write_channel(self, channel_id: str, value: Any) -> bool: + if self.status not in (DeviceStatus.CONNECTED, DeviceStatus.SIMULATED): + return False return self._layer.write(channel_id, int(value)) def get_config_widget(self) -> QWidget: diff --git a/ui/control_panel.py b/ui/control_panel.py index 6e78e89..2b936c4 100644 --- a/ui/control_panel.py +++ b/ui/control_panel.py @@ -33,6 +33,7 @@ from PyQt6.QtCore import Qt, pyqtSignal, QTimer from PyQt6.QtGui import QFont from devices.device_registry import DeviceRegistry +from devices.base_device import DeviceStatus # ══════════════════════════════════════════════════════════════════════════════ @@ -119,13 +120,17 @@ class ControlWidget(QFrame): if self.registry and self.device_id and self.channel_id: dev = self.registry.get_instance(self.device_id) if dev: - ok = dev.write_channel(self.channel_id, value) - if ok: - written = True + if dev.status not in (DeviceStatus.CONNECTED, DeviceStatus.SIMULATED): + print(f"[Control] write_channel({self.channel_id}, {value}) skipped on " + f"{self.device_id} — device status is {dev.status.value}, not connected") else: - print(f"[Control] write_channel({self.channel_id}, {value}) " - f"returned False on {self.device_id} — " - f"check device type and channel ID") + ok = dev.write_channel(self.channel_id, value) + if ok: + written = True + else: + print(f"[Control] write_channel({self.channel_id}, {value}) " + f"returned False on {self.device_id} — " + f"check device type and channel ID") self.value_changed.emit(self.channel_id, value) if self._on_action_fn is not None: |
