summaryrefslogtreecommitdiff
path: root/CLAUDE.original.md
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2026-04-22 11:06:45 -0600
committerChristian Kolset <christian.kolset@gmail.com>2026-04-22 11:06:45 -0600
commit38ba9706e43c24a9d882b9d0d627812e01a30744 (patch)
treefdf6720447a6cc6e4285fa6c4b73889c829c302c /CLAUDE.original.md
parenta00ed2a932fdb0f3103777ac3eac106701484ca2 (diff)
Added port scanning for new devices and only shows related backend config lines
Diffstat (limited to 'CLAUDE.original.md')
-rw-r--r--CLAUDE.original.md22
1 files changed, 11 insertions, 11 deletions
diff --git a/CLAUDE.original.md b/CLAUDE.original.md
index 05c7092..5347d9d 100644
--- a/CLAUDE.original.md
+++ b/CLAUDE.original.md
@@ -1,6 +1,6 @@
# CLAUDE.md
-This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
+Guidance for Claude Code (claude.ai/code) working in this repo.
## Running the app
@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
python main.py
```
-No build step. Runs in simulation mode by default (no hardware needed).
+No build step. Simulation mode default (no hardware needed).
## Dependencies
@@ -35,17 +35,17 @@ Hardware / Simulation
ui/strip_chart.py StripChartWidget — consumes processed_data, renders via pyqtgraph
```
-Control widgets (left panel) go the other direction: UI → `ControlWidget._write()` → `DeviceRegistry.get_instance()` → `device.write_channel()` → api_layer.
+Control widgets (left panel) go other direction: UI → `ControlWidget._write()` → `DeviceRegistry.get_instance()` → `device.write_channel()` → api_layer.
### Key design patterns
-**Shared serial port** — `api_layers/port_registry.py` holds a module-level `port_registry` singleton. When multiple devices share one Arduino (e.g. `AnalogInputDevice` + `DigitalIODevice` on the same port), both call `port_registry.get_layer(port, baud)` and get the same `ArduinoLayer` instance. Never construct `ArduinoLayer` directly in device code.
+**Shared serial port** — `api_layers/port_registry.py` holds module-level `port_registry` singleton. When multiple devices share one Arduino (e.g. `AnalogInputDevice` + `DigitalIODevice` on same port), both call `port_registry.get_layer(port, baud)`, get same `ArduinoLayer` instance. Never construct `ArduinoLayer` directly in device code.
-**Device auto-discovery** — `DeviceRegistry._discover()` scans `devices/` with `pkgutil`, imports every module, and registers any class that subclasses `BaseDevice`. Adding a new device type = drop a file in `devices/`, no registration needed.
+**Device auto-discovery** — `DeviceRegistry._discover()` scans `devices/` with `pkgutil`, imports every module, registers any class subclassing `BaseDevice`. New device type = drop file in `devices/`, no registration needed.
-**Backend switching at runtime** — `AnalogInputDevice` and `DigitalIODevice` both have `switch_backend(backend, simulate, ...)` that disconnects, reconfigures, and reconnects without restarting. Called from "Apply & Reconnect" in the config dialog.
+**Backend switching at runtime** — `AnalogInputDevice` and `DigitalIODevice` both have `switch_backend(backend, simulate, ...)` — disconnects, reconfigures, reconnects without restart. Called from "Apply & Reconnect" in config dialog.
-**Profile persistence** — `core/profile.py` serialises the full operator state (controls, plot layout, signal pipelines, derived channels) to `.labdaq` JSON files. `ProfileManager` handles save/load.
+**Profile persistence** — `core/profile.py` serialises full operator state (controls, plot layout, signal pipelines, derived channels) to `.labdaq` JSON files. `ProfileManager` handles save/load.
### Directory map
@@ -69,13 +69,13 @@ Control widgets (left panel) go the other direction: UI → `ControlWidget._writ
### Arduino firmware
-The firmware is embedded as `ARDUINO_FIRMWARE` in `api_layers/arduino_layer.py`. When editing it, set `N_DIG_OUT` to match the number of digital output pins in use (default was 0 — leaving pins in INPUT mode causes inverted write behaviour). Upload via Arduino IDE.
+Firmware embedded as `ARDUINO_FIRMWARE` in `api_layers/arduino_layer.py`. When editing: set `N_DIG_OUT` to match digital output pins in use (default 0 — leaves pins in INPUT mode, causes inverted write behaviour). Upload via Arduino IDE.
Serial protocol: `A0:3.14,D2:1\n` stream from Arduino; `W:D7:1\n` / `P:D9:128\n` commands from PC.
### Adding a new device type
-1. Subclass `BaseDevice` in a new file under `devices/`
+1. Subclass `BaseDevice` in new file under `devices/`
2. Implement: `connect()`, `disconnect()`, `read_channels() → Dict[str, float]`, `write_channel(channel_id, value) → bool`, `get_config_widget() → QWidget`
-3. Include `switch_backend()` if the device supports runtime reconfiguration
-4. `DeviceRegistry` discovers it automatically on next run
+3. Include `switch_backend()` if device supports runtime reconfiguration
+4. `DeviceRegistry` discovers it automatically on next run \ No newline at end of file