Channel 11 defaults, ESP-NOW driver config and rig/desktop updates
Moves the controller, bridge and led-driver default ESP-NOW channel to 11 and updates the led-driver and led-tool submodule pointers. Includes the rest of the working tree: web UI, desktop and sim-controller changes, API and bridge code, graphify output, and the .gitea and fixture-driver folders. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
35207a868a
commit
edf35e9c71
280 files changed
+24043
-1756
No files matched your search
+46
-8
@@ -63,7 +63,7 @@ Keys with meaning on the controller (others are stored as they are):
|
||||
|-----|---------|---------|
|
||||
| `ap_enabled` | | Wi-Fi access point (open, SSID = hostname, `192.168.5.1`); default `true`; applies after a restart. Holding the D3 button at boot forces it on |
|
||||
| `ap_password` | | AP password, 8-63 characters (WPA2); empty (default) is an open network; applies after a restart |
|
||||
| `bridges` | list of strings | Bridges the ESP-NOW frames go to instead of the radio, each up to 79 characters: `/dev/ttyACM1` (a USB bridge board, or `serial:/dev/...`) or `host:port` (UDP: led-simulator, or a network bridge board, default port 8766). Every frame goes to each; a frame several bridges hear arrives once. Empty or missing: the radio. The host applies changes at once (`GET`/`PUT /settings/bridge`); a device applies them after a restart. `bridge` (one address) is still read when `bridges` is missing. |
|
||||
| `bridges` | list of strings | Bridges the ESP-NOW frames go to instead of the radio, each up to 79 characters: `/dev/ttyACM1` (a USB bridge board, or `serial:/dev/...`) `host:port` (UDP: led-simulator, or a network bridge board, default port 8766), or `dmx:<id>` (a DMX bridge, see below; host builds only, and only an id that exists). Every frame goes to each; a frame several bridges hear arrives once. Empty or missing: the radio. The host applies changes at once (`GET`/`PUT /settings/bridge`); a device applies them after a restart. `bridge` (one address) is still read when `bridges` is missing. |
|
||||
| `hostname` | | mDNS name (`<hostname>.local`, default `led-controller`); applies after a restart |
|
||||
| `static_ips` | | List of `{ip, netmask?, gw, dns?}` tried in order when the Ethernet link comes up; the first whose gateway answers ARP is used, else DHCP, else `192.168.4.1/24` for a direct PC cable. Applies after a restart |
|
||||
| `global_brightness` | integer 0–255 | Global factor of each driver's brightness (see Groups). Stored only: the UI pushes each driver its combined value |
|
||||
@@ -108,10 +108,12 @@ A preset has `name`, `pattern`, `colors` (`#RRGGBB`), `brightness`, `delay`, `n1
|
||||
|--------|------|-------------|
|
||||
| GET | `/presets` | The current profile's presets |
|
||||
| GET | `/presets/<id>` | One preset (404 for another profile's) |
|
||||
| POST | `/presets` | Create in the current profile. Reply `{"<id>": preset}`, 201 |
|
||||
| PUT | `/presets/<id>` | Merge fields |
|
||||
| POST | `/presets` | Create in the current profile; sent and saved to every driver. Reply `{"<id>": preset}`, 201 |
|
||||
| PUT | `/presets/<id>` | Merge fields; the preset is sent and saved to every driver again |
|
||||
| DELETE | `/presets/<id>` | Delete |
|
||||
| POST | `/presets/push` | Send driver messages. Body: `{"sequence": [message, ...]}` or `{"payload": message}`, optional `targets` (MACs: acked unicast to each). Without targets, broadcast. Reply `{"message": "Delivered"}`. See Driver messages |
|
||||
| POST | `/presets/sync` | Send every preset of the current profile to every driver, saved on each (the Presets window's Sync to Devices button). Reply `{"message", "presets_sent": n}` |
|
||||
| POST | `/presets/clear` | Every driver deletes all its stored presets (the Presets window's Clear Devices button). Reply `{"message"}`. Sequences never clear presets on drivers; use Sync to Devices to send them again |
|
||||
| POST | `/presets/send` | Send stored presets. Body: `preset_ids` (or `ids`), `save` (default true), `default` (startup preset id), `targets` or `destination_mac`. Reply `{"message": "Presets sent", "presets_sent": n}` |
|
||||
| GET | `/presets/<id>/export` | Preset bundle |
|
||||
| POST | `/presets/import` | Body: a preset bundle (or `{"bundle": ...}`). New id in the current profile, 201 |
|
||||
@@ -161,10 +163,10 @@ A device is `{id: MAC, name, type: "led", transport: "espnow" | "wifi", address,
|
||||
| GET | `/devices` | All devices, each with `connected` (`null` for ESP-NOW, `false` for Wi-Fi) |
|
||||
| GET | `/devices/<id>` | One device (the id may be written with colons) |
|
||||
| POST | `/devices` | Create. `name` required; `mac` (or, for ESP-NOW, a MAC in `address`); `transport` `espnow` (default) or `wifi`. Reply `{"<mac>": device}`, 201; 409 for a MAC already registered |
|
||||
| PUT | `/devices/<id>` | Merge fields. `name` cannot be blank, the MAC cannot change, `output_brightness` 0–255. Changing `name`, `max_brightness`, `num_leds`, `color_order`, `startup_mode` or `reversed` also sends them to the driver as `device_config` |
|
||||
| PUT | `/devices/<id>` | Merge fields. `name` cannot be blank, the MAC cannot change, `output_brightness` 0–255. Changing `name`, `max_brightness`, `num_leds`, `color_order`, `startup_mode`, `reversed`, `pin` (the strip's data GPIO: 0–10, 20, 21) or `espnow_channel` (1–13: the driver restarts onto it, so move the bridge too) also sends them to the driver as `device_config`. Drivers announce these back, so the record shows the driver's own values. The bare ESP-NOW driver (led-driver `sdkconfig.espnow`: no web interface or USB config) is set up only this way |
|
||||
| DELETE | `/devices/<id>` | Delete |
|
||||
| GET | `/devices/status` | Per driver: `{"last_ack_ms_ago": ms or -1, "failed_messages": n}` from the acked link |
|
||||
| POST | `/devices/ping` | Body `{"timeout_s": 0.5–30, "broadcast": bool}` (timeout default 3). Sends the ping as an acked unicast to each known device and collects replies; `"broadcast": true`, or no known devices, broadcasts it instead so new drivers are found: `{"ok", "ping_id", "timeout_s", "responses": {mac: {mac, name, rtt_ms}}, "registered": n}`. Drivers that answer are added or renamed |
|
||||
| POST | `/devices/ping` | Body `{"timeout_s": 0.5–30, "broadcast": bool}` (timeout default 3). Sends the ping as a unicast to each known device (waiting for room when there are more devices than the send queue holds; 503 only when none could be sent) and collects replies; `"broadcast": true`, or no known devices, broadcasts it instead so new drivers are found: `{"ok", "ping_id", "timeout_s", "responses": {mac: {mac, name, rtt_ms}}, "registered": n}`. Drivers that answer are added or renamed |
|
||||
| POST | `/devices/layout` | Body `{"placements": {mac: {x0, y0, x1, y1} \| null}, "center"?: {x, y}}`: where each bar sits, in any units with y up, and the rig's centre (kept in `settings.rig_center`; without one, the layout's bounding-box centre). `x0,y0` is LED 1, the data-in end; `null` removes a bar. Saved as the device's `placement`. Then every placed ESP-NOW driver gets `device_config.place`: its ends relative to the centre, scaled so the furthest end is 1 from it. Reply `{"updated", "sent", "failed"}`; 400 without `placements` |
|
||||
| POST | `/devices/groups` | Send every ESP-NOW driver its groups and wait for the acks: `{"ok", "total", "sent", "failed"}` (503 when any failed, 400 with no ESP-NOW devices) |
|
||||
| POST | `/devices/resolve-brightness` | Body `{"macs": [...], "zone_brightness"?}` → `{"values": {mac: brightness}}` |
|
||||
@@ -196,12 +198,14 @@ A sequence is `{name, profile_id, targets?, lanes: [[step, ...], ...], lane_opts
|
||||
| GET | `/sequences` | The current profile's sequences |
|
||||
| GET | `/sequences/<id>` | One sequence |
|
||||
| POST | `/sequences` | Create in the current profile. A non-empty `steps` without lanes becomes lane 0. Reply `{"<id>": sequence}`, 201 |
|
||||
| PUT | `/sequences/<id>` | Merge fields; stops it when it is playing |
|
||||
| DELETE | `/sequences/<id>` | Delete; stops it when it is playing |
|
||||
| PUT | `/sequences/<id>` | Merge fields; stops it when it is playing or previewing |
|
||||
| DELETE | `/sequences/<id>` | Delete; stops it when it is playing or previewing |
|
||||
| POST | `/sequences/<id>/play` | Body `{"zone_id"}` (required). A one-shot (`loop` off) plays as `/fire` with `wait: "now"`. Reply `{"ok": true, "pending": bool, ...}`. 400 for a missing zone, a sequence without steps or one from another profile |
|
||||
| POST | `/sequences/stop` | Stop playback (and any one-shot) and clear the presets on the zone's groups. `{"ok": true}` |
|
||||
| POST | `/sequences/<id>/fire` | Play it once (a one-shot) over whatever runs. Body `{"zone_id"?, "wait"?: "now" (default) \| "beat" \| "downbeat"}`; without `zone_id`, the playing sequence's zone. Reply `{"ok": true, "wait"}`. 404 for another profile's, 400 without a zone or steps |
|
||||
| POST | `/sequences/overlay/stop` | End the one-shot now; its drivers go back (as when it ends). `{"ok": true}` |
|
||||
| POST | `/sequences/<id>/preview` | Play it on the simulated drivers only (devices with `"sim": true`), alongside whatever plays live. Body `{"zone_id"?}`; without it, the playing sequence's zone. Reply `{"ok": true, "sequence_id"}`. Errors as `/fire` |
|
||||
| POST | `/sequences/preview/stop` | End the preview; the simulated drivers go back to what plays live. `{"ok": true}` |
|
||||
| POST | `/sequences/sync-phase` | Body `{"mode": "step" | "pass"}`: `step` restarts the current step's beat count, `pass` restarts the sequence. Also makes this beat bar beat 1. 409 when nothing plays |
|
||||
| GET | `/sequences/status` | Playback status (below) |
|
||||
| GET | `/sequences/<id>/export` | Sequence bundle (the sequence and its presets) |
|
||||
@@ -217,9 +221,14 @@ A sequence is `{name, profile_id, targets?, lanes: [[step, ...], ...], lane_opts
|
||||
- When it ends (or `/sequences/overlay/stop`), those drivers get the sequence's current step again. With no sequence playing they get the zone's last played preset, else off.
|
||||
- Another one-shot replaces the one playing. Drivers the new one doesn't reach go back.
|
||||
- A sequence stopped while a one-shot plays clears the zone once the one-shot is over.
|
||||
- **Previews.** `/preview` plays a sequence in a third player that reaches only simulated drivers, so a show can be built on the simulator while the real fixtures keep playing. It counts the same beats as the live sequence.
|
||||
- While it plays, the live sequence and one-shot leave the simulated drivers out: groups holding one are split into their other drivers' own groups. (Wi-Fi drivers in such a group miss those sends.)
|
||||
- It loops unless the sequence is a one-shot, which plays once. Its `animation_id` steps are skipped. It does not set the zone's brightness or the bar's downbeat.
|
||||
- When it ends (`/sequences/preview/stop`, a new preview, or an edit of the sequence), its presets are cleared from the simulated drivers and they go back to the live one-shot, the live sequence's current step, their zone's last preset, or off.
|
||||
- `/sequences/stop` leaves the preview running.
|
||||
- **Beat source.** Beats come from the mic's beat detector while audio timing is on (`/api/audio/start`) and it has a tempo lock. Otherwise they come from a clock at `audio_simulated_bpm`, whose beats also go to the drivers. Beats closer than 0.3 s (200 BPM) are dropped.
|
||||
|
||||
Status: `{"active": false, "beat_readout": "", overlay}` when idle, else `{active, advance_mode, sequence_id, zone_id, num_lanes, total_sequence_steps, lane0_current_step, lane0_lane_length, lane0_beat_in_step, lane0_beats_per_step, lane0_preset_id, lane0_preset_name, sequence_beat_at, sequence_beats_per_pass, sequence_loop_beat, beat_readout, lanes, overlay}`.
|
||||
Status: `{"active": false, "beat_readout": "", overlay, preview}` when idle, else `{active, advance_mode, sequence_id, zone_id, num_lanes, total_sequence_steps, lane0_current_step, lane0_lane_length, lane0_beat_in_step, lane0_beats_per_step, lane0_preset_id, lane0_preset_name, sequence_beat_at, sequence_beats_per_pass, sequence_loop_beat, beat_readout, lanes, overlay, preview}`. `preview` is `{"active": false}`, or `{active, sequence_id, zone_id, loop, lanes}` while one plays.
|
||||
- `lanes`: one entry per playing lane, `{step (0-based), steps, mode, started, done, pos? (chase: the target index lit first), beat_in_step and beats_in_step (beat lanes) or elapsed_ms and duration_ms (time lanes)}`.
|
||||
- `overlay`: `{active, pending, pending_id?}`, plus `{sequence_id, zone_id, drivers, progress (0–1), lanes}` while a one-shot plays.
|
||||
|
||||
@@ -298,6 +307,35 @@ Zones do not render to outputs: only the test pattern is sent.
|
||||
|
||||
The simulated rig (`/sim/`, host builds) receives Art-Net and DDP, so an output aimed at `127.0.0.1` shows on its DDP and Art-Net fixtures; see `led-simulator/README.md` (Network fixtures) and `GET /sim/api/dmx`.
|
||||
|
||||
## DMX bridges — `/dmx-bridges`, `/dmx-definitions`
|
||||
|
||||
Host builds (desktop, Docker) only. A DMX bridge has universes. Each universe sends its 512 channels to its outputs 40 times a second, and holds fixtures. Each fixture is a led-driver of its own: the controller runs one `led-fixture` process per fixture (`fixture-driver/`, led-driver's engine built for the host, started from the controller's directory or `LED_FIXTURE_BIN`), with the fixture's MAC. A fixture announces itself, is listed under `/devices` (with `"dmx_fixture": true` and `"bridge": "dmx:<id>"`), joins groups and plays presets like any driver. The bridge runs while `dmx:<id>` is in the bridge list (`PUT /settings/bridge`).
|
||||
|
||||
A bridge is `{id, name, universes: [{id, name, number, outputs: [...], fixtures: [...]}]}`:
|
||||
- output: `{type: "artnet" | "sacn" | "dmx_serial" | "sim", host, port, universe, serial_port, dmx_mode: "enttec_pro" | "open_dmx", enabled}`. `universe` (null: the universe's `number`) is the number on the wire: Art-Net 0–32767, sACN 1–63999. A blank `host` broadcasts (Art-Net) or uses the universe's multicast group (sACN). `port` null is 6454 / 5568. `dmx_serial` needs `serial_port`: an Enttec DMX USB Pro (label 6 frames) or an Open DMX cable (250000 baud 8N2, break and mark-after-break), retried every 2 s while it cannot open. `sim` (host builds) hands the universe straight to the rig simulator's page (`/sim/`), the way its LED drivers get the radio: no UDP, so it works while another program holds port 6454. It has no host or port, and its universe is 0–32767 as for Art-Net; `GET /sim/api/dmx` counts these frames in `artnet.local_packets`.
|
||||
- fixture: `{id, name, mac, definition, address}`. `definition` is a `/dmx-definitions` id; the fixture uses channels `address` to `address + channels − 1`, which must be within 512 and not overlap another fixture of the universe. A missing or empty `mac` gets a new locally administered one (`02…`); a MAC must be unicast and not used by another fixture or by a driver.
|
||||
|
||||
A definition is `{id, name, manufacturer, model, mode, channels: [names], defaults: {name: 0–255}}`, the format of the rig sim's room `dmx_definitions`. The channel names say what each slot carries:
|
||||
- `Red`, `Green`, `Blue`, `White`, or `Red 1`, `Green 1`… for each pixel (groups numbered in order): the pattern's colour for that pixel (the fixture's driver has as many LEDs as the definition has pixel groups). `White` takes the part common to red, green and blue, which is taken out of them.
|
||||
- `Dimmer`, `Intensity`, `Master Dimmer`, `Center Brightness`: 255 while the fixture's driver runs, else 0.
|
||||
- `Strobe`, `Shutter`, `Center Strobe`: 0 (open).
|
||||
- Any other: its value in `defaults` (0 when missing).
|
||||
|
||||
The rig sim's two definitions (`beamZ BCC145`, `Small Eye 7 Mover`) are added when there are none.
|
||||
|
||||
| Method | Path | Description |
|
||||
|--------|------|-------------|
|
||||
| GET | `/dmx-bridges`, `/dmx-bridges/<id>` | List, one |
|
||||
| POST | `/dmx-bridges` | Create (400 with the failed check). Reply: the bridge, 201. It does not start: add `dmx:<id>` to the bridges |
|
||||
| PUT | `/dmx-bridges/<id>` | Merge and check again. A running bridge applies it at once; fixtures whose MAC, name and pixel count are the same keep running |
|
||||
| DELETE | `/dmx-bridges/<id>` | Delete, and take `dmx:<id>` off the bridges |
|
||||
| GET | `/dmx-definitions`, `/dmx-definitions/<id>` | List, one |
|
||||
| POST | `/dmx-definitions` | Create. Reply: the definition, 201 |
|
||||
| PUT | `/dmx-definitions/<id>` | Merge and check again (400 when a fixture using it would pass channel 512). Running bridges using it apply it |
|
||||
| DELETE | `/dmx-definitions/<id>` | Delete; 409 while a fixture uses it |
|
||||
|
||||
In `GET /settings/bridge` a DMX bridge is `{addr: "dmx:<id>", kind: "dmx", status: {linked, name, universes, fixtures, running, hz, frames, packets, errors, last_error}}`; `linked` is true when every fixture's driver runs. A fixture whose process stops is started again after 1 to 10 s. Each fixture's flash (its presets and settings) is kept in `<db>/dmx/<mac>.json`.
|
||||
|
||||
## WebSocket — `/ws`
|
||||
|
||||
On connect the controller sends `{"type": "device_tcp_snapshot", "connected_ips": []}` (there are no Wi-Fi driver sessions). Each text frame is a driver message (JSON object), sent as `/presets/push` would send it: an optional `to` (MAC) addresses one driver, otherwise it is broadcast. A frame that is not a JSON object, or a failed send, gets `{"error": ...}` back. A plain GET gets 426.
|
||||
|
||||
Reference in new issue
Block a user