summaryrefslogtreecommitdiff
path: root/api_layers/arduino_layer.py
diff options
context:
space:
mode:
authorChristian Kolset <ckolset@colostate.edu>2026-08-10 16:12:05 -0600
committerChristian Kolset <ckolset@colostate.edu>2026-08-10 16:12:05 -0600
commit5d5bcaed8639a162fda85c8cd0d340c296a054b8 (patch)
treea7a1a62fb607c9c85127dab4aab17ccf8e22c906 /api_layers/arduino_layer.py
parent46231c00994cd681d598961f2056dbda31c3e483 (diff)
Unify Signals/Channels around auto-naming, plot-by-channel, and shared vars
Devices: auto-name from OS-reported port description (Device Manager / udev string) instead of a generic label; default Serial #Channels 1; consistent simulate-mode checkbox across backends; inline device rename. Channels: calibration/filters move out of Signals into a Channel "Operation" (adds Scale/Offset alongside the existing math kinds); single-physical-source Channels get an embedded Filters block; new Channels auto-name/auto-ID from their source and reject duplicate names/IDs on apply; "Create Channel" button on each Signal row; renamed "Sources" -> "Signals" in the Channels UI; Signals' READ/WRITE dir badge (was silently-broken IN/OUT) now reflects the real writable flag. Plot: default layout is one pane per Channel (not per device, not raw Signals) titled by channel name; "+ Add Channel" is a checkbox dialog instead of an inline dropdown; traces get up/down reorder; live unit changes (e.g. a Mark-10 gauge switching lb/kgF/N/ozF) propagate to an open pane's axis label without clobbering a manually-typed one. Control Panel: hardware assignment now picks from the same writable- Signals list instead of a separate device/channel combo with a hardcoded Arduino pin list; stale visual indicator when a control's target device/channel disconnects or disappears; documented the `vars` bridge (Control Panel On Action Script <-> Channel scripts) in both directions' help text and script templates. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'api_layers/arduino_layer.py')
-rw-r--r--api_layers/arduino_layer.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/api_layers/arduino_layer.py b/api_layers/arduino_layer.py
index 52eeb30..a3c3584 100644
--- a/api_layers/arduino_layer.py
+++ b/api_layers/arduino_layer.py
@@ -87,7 +87,7 @@ class ArduinoLayer:
DEFAULT_DIGITAL_PINS = ["D2", "D3", "D4", "D5", "D6", "D7"]
# Firmware DIGITAL_IN[] and DIGITAL_OUT[] arrays — match arduino_layer.py firmware sketch
DEFAULT_DI_PINS = ["D2", "D3", "D4"]
- DEFAULT_DO_PINS = ["D5", "D6", "D7", "D9", "D10", "D11"]
+ DEFAULT_DO_PINS = ["D5", "D6", "D7", "D8", "D9", "D10", "D11", "D13"]
def __init__(
self,
@@ -563,6 +563,18 @@ class ArduinoLayer:
def is_pyserial_available() -> bool:
return _SERIAL_AVAILABLE
+ @staticmethod
+ def describe_port(port: str) -> str:
+ """OS-reported device description for a port — the same string shown
+ in Windows Device Manager or a Linux udev/lsusb listing — so an
+ auto-named device mirrors what the operator already sees outside
+ this app. Empty string if the port isn't currently enumerable
+ (e.g. simulation mode, or the device was unplugged)."""
+ for dev, desc in ArduinoLayer.list_ports():
+ if dev == port and desc:
+ return desc
+ return ""
+
def __repr__(self):
mode = "SIM" if self.simulate else f"HW:{self.port}@{self.baud}"
return f"<ArduinoLayer {mode} pins={self.analog_pins}>"