summaryrefslogtreecommitdiff
path: root/ui/control_panel.py
diff options
context:
space:
mode:
authorChristian Kolset <ckolset@colostate.edu>2026-07-27 17:13:41 -0600
committerChristian Kolset <ckolset@colostate.edu>2026-07-27 17:13:41 -0600
commitc3f07a7ffa320aecb3fca5dd40e7644424bddfb5 (patch)
tree42d1e9062e7800f24937a62bef06acda8959001b /ui/control_panel.py
parentfc6f90404c9428362f1a0c62bb28eb350c0f248d (diff)
Fix .gitignore: remove duplicate entry for plugins/enabled.json
Diffstat (limited to 'ui/control_panel.py')
-rw-r--r--ui/control_panel.py17
1 files changed, 11 insertions, 6 deletions
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: