From f3327d56d48d63b21ffc03a55fa5e7db753d1707 Mon Sep 17 00:00:00 2001 From: Christian Kolset Date: Sat, 19 Sep 2026 17:38:07 -0600 Subject: Redesign Signal/Channel naming and fix pin-remap breaking references Arduino analog Signal ids used to be the pin name itself, so fixing a wrong pin silently changed the id and orphaned any plot trace, control, or filter pipeline pointing at it. Analog Signal ids are now positional (ai0, ai1, ...) and decoupled from the underlying pin, matching how digital I/O already worked. More broadly, formalizes a Device -> Signal -> Channel -> Plot naming model (SignalConfig for physical device channels, Channel for derived/ computed ones) and adds core/reference_registry.py to propagate any Signal or Channel id rename through plot traces, controls, and filter pipelines instead of leaving them dangling. Signal ids are now editable in the Signals tab with the same propagation. .labui profile schema bumped to v2.0 with a transparent migration for old files, including remapping old pin-name Signal ids to the new positional ones. Removed six confirmed-dead files (two legacy device classes, four superseded top-level ui/ duplicates). --- api_layers/nidaqmx_layer.py | 4 ++-- api_layers/port_registry.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'api_layers') diff --git a/api_layers/nidaqmx_layer.py b/api_layers/nidaqmx_layer.py index ba40efb..e0fc670 100644 --- a/api_layers/nidaqmx_layer.py +++ b/api_layers/nidaqmx_layer.py @@ -6,8 +6,8 @@ NI-DAQmx API abstraction layer. • When nidaqmx package + NI runtime are present → uses real hardware • Otherwise → falls back to simulation -Swap this layer by changing the `backend` parameter on AnalogInputDevice -or by subclassing NidaqmxLayer and overriding _hw_read(). +Used by devices/nidaqmx_device.py::NidaqmxDevice. Swap it out by +subclassing NidaqmxLayer and overriding _hw_read(). Usage example: from api_layers.nidaqmx_layer import NidaqmxLayer diff --git a/api_layers/port_registry.py b/api_layers/port_registry.py index e3c85fd..4328bb2 100644 --- a/api_layers/port_registry.py +++ b/api_layers/port_registry.py @@ -3,10 +3,10 @@ api_layers/port_registry.py PortRegistry — ensures one ArduinoLayer per physical serial port. -Problem: if both an AnalogInputDevice and a DigitalIODevice are -configured for the same Arduino (/dev/ttyUSB0), they would each -create their own ArduinoLayer and both try to open the same serial -port → "device reports readiness to read but returned no data". +Problem: if two ArduinoDevice instances are configured for the same +physical Arduino (/dev/ttyUSB0), they would each create their own +ArduinoLayer and both try to open the same serial port → "device +reports readiness to read but returned no data". Solution: all devices call PortRegistry.get_layer(port, baud) instead of constructing ArduinoLayer directly. The registry returns an @@ -14,9 +14,9 @@ existing layer if one is already open on that port, or creates a new one. All reads/writes go through the single shared layer. The registry also merges analog_pins across devices so the layer -caches values for all channels on the Arduino. +caches values for all signals on the Arduino. -Usage (handled automatically by AnalogInputDevice and DigitalIODevice): +Usage (handled automatically by ArduinoDevice): from api_layers.port_registry import port_registry layer = port_registry.get_layer("/dev/ttyUSB0", 115200, simulate=False) -- cgit v1.2.3