diff options
| author | Christian Kolset <ckolset@colostate.edu> | 2026-07-29 15:44:24 -0600 |
|---|---|---|
| committer | Christian Kolset <ckolset@colostate.edu> | 2026-07-29 15:44:24 -0600 |
| commit | 767f1b013dffb8124a389997a2dbf2f06937a1d4 (patch) | |
| tree | 06f20f442ed0e810eb544b740e47089ebb8d8a41 /ui | |
| parent | 34c8b0950398c07e84777479f3534615907f4f58 (diff) | |
| parent | 9360dea6e6327004b905eb6d7c782cc7c0d3ba13 (diff) | |
Merge branch 'fix/control-channel-direction-filter'
# Conflicts:
# ui/control_editor.py
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/control_editor.py | 6 | ||||
| -rw-r--r-- | ui/control_panel.py | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/ui/control_editor.py b/ui/control_editor.py index 65aa96e..111a71f 100644 --- a/ui/control_editor.py +++ b/ui/control_editor.py @@ -360,8 +360,12 @@ class ControlEditorDialog(QDialog): dev = self.registry.get_instance(dev_id) if not dev: return - # Add actual channels + # Add actual channels (skip disabled — can't be driven while switched + # off — and skip read-only channels — a control writes, so a channel + # with no write mapping should never be offered as a target) for ch in dev.info.channels: + if not ch.enabled or not ch.writable: + continue self._ch_cb.addItem(f"{ch.name} ({ch.channel_id})", userData=ch.channel_id) # For Arduino backends also suggest digital pins for output diff --git a/ui/control_panel.py b/ui/control_panel.py index 4db18e3..4c4f1fd 100644 --- a/ui/control_panel.py +++ b/ui/control_panel.py @@ -120,7 +120,11 @@ class ControlWidget(QFrame): if self.registry and self.device_id and self.channel_id: dev = self.registry.get_instance(self.device_id) if dev: - if dev.status not in (DeviceStatus.CONNECTED, DeviceStatus.SIMULATED): + ch = dev.get_channel(self.channel_id) + if ch is not None and not ch.enabled: + print(f"[Control] write_channel({self.channel_id}, {value}) skipped on " + f"{self.device_id} — channel is disabled") + elif 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: |
