feat: sequences v2, driver frame sync and submodule updates
- Sequences v2, bridges and sim-controller changes from the working tree. - Records the led-driver, led-tool and led-simulator commits above. - Includes dmx-driver/ and graphify-out/. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3f8f67823b
commit
50ca46fee6
657 files changed
+15818
-1107
No files matched your search
+3
-14
@@ -24,7 +24,7 @@ Request and response bodies are JSON (`Content-Type: application/json`) unless n
|
||||
| GET | `/` | Main UI |
|
||||
| GET | `/settings/page` | Standalone settings page |
|
||||
| GET | `/audio` | Live audio and beat page (level, tempo, bar position, tap) |
|
||||
| GET | `/settings/editor` | Driver settings editor: sends a driver settings (`PUT /devices/<id>`) and updates its code (`/drivers/ota`) over ESP-NOW |
|
||||
| GET | `/settings/editor` | Driver settings editor: sends a driver settings (`PUT /devices/<id>`) |
|
||||
| GET | `/static/<path>` | UI scripts and styles |
|
||||
| GET | `/favicon.ico` | 204 |
|
||||
|
||||
@@ -164,7 +164,7 @@ A device is `{id: MAC, name, type: "led", transport: "espnow" | "wifi", address,
|
||||
| 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` |
|
||||
| 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}` (default 3). Broadcasts a ping and collects replies: `{"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 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/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}}` |
|
||||
@@ -261,8 +261,7 @@ Pattern metadata is the `pattern` collection, keyed by name. Pattern sources are
|
||||
| GET | `/patterns/ota/file/<name>.py` | The source (`text/plain`); 400 for `on`/`off`, 404 when missing |
|
||||
| POST | `/patterns/upload` | Body `{name, code, overwrite?}`: store a source. 409 when it exists and `overwrite` is false. 201 |
|
||||
| POST | `/patterns/driver` | Body `{name, code, overwrite?, min_delay?, max_delay?, max_colors?, n1?..n8?}`: store the source and its metadata (`n1`–`n8` are parameter labels). The name must be an identifier. 201 |
|
||||
| POST | `/patterns/<name>/send` | Push the source over ESP-NOW to one driver (`{"device_id"}`) or every ESP-NOW driver, as `patterns/<name>.py`; drivers that wrote it reset to load it. `{"message", "pattern", "device_ids", "sent_count", "results"}`; 503 when none took it |
|
||||
| POST | `/devices/<id>/patterns/push` | 400: use `/patterns/<name>/send` |
|
||||
| POST | `/devices/<id>/patterns/push` | 400: not supported for ESP-NOW devices |
|
||||
|
||||
## Palettes — `/palettes`
|
||||
|
||||
@@ -301,16 +300,6 @@ Zones do not render to outputs: only the test pattern is sent.
|
||||
|
||||
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.
|
||||
|
||||
## Driver app update — `/drivers/ota`
|
||||
|
||||
Pushes led-driver `.py` files to ESP-NOW drivers, one file per request; `tools/driver_ota.py` (`make ota-drivers`) and the editor at `/settings/editor` run a whole session. The firmware embeds the driver files from its build: `/static/driver/manifest.json` lists `{path, sha, size}` and `/static/driver/<path>` serves each. The wire format is in `led-driver/src/espnow_ota.py`. One request runs at a time; another gets 409.
|
||||
|
||||
| Method | Path | Description |
|
||||
|--------|------|-------------|
|
||||
| POST | `/drivers/ota/file?mac=<macs>&sess=<n>&path=<p>&sha=<64 hex>` | Body: the raw file (up to 65536 bytes). `mac` is a comma-separated list of MACs, or `all` for every ESP-NOW device. `sess` (1–65535) is shared by every file of one update. `path` is the driver path: a root file, `patterns/…` or `lib/…`. Drivers that already have that sha256 skip it. One target gets acked unicast. Several get one broadcast, then each is asked for its missing chunks and repaired. The file is staged until commit. Reply: `{"<mac>": {"result": "same" | "written" | "error", "code"?, "repaired": n}}` |
|
||||
| POST | `/drivers/ota/commit?mac=<macs>&sess=<n>` | Drivers move their staged files into place, update `file_hashes.json` and reset if anything changed |
|
||||
| POST | `/drivers/ota/abort?mac=<macs>&sess=<n>` | Drivers delete their staged files |
|
||||
|
||||
---
|
||||
|
||||
## Driver messages
|
||||
|
||||
+2
-37
@@ -272,42 +272,7 @@ Groups: the controller sends a driver its group list when the driver announces i
|
||||
|
||||
**Wi-Fi start-up order on the C3.** With the extra link code loaded before Wi-Fi start-up, the C3 failed with `Wifi Unknown Error 0x0101` on about every other cold boot (2 of 4). Starting ESP-NOW before the pattern library and the LED driver claim memory fixed it (6 of 6 boots). `led-driver/src/main.py` now does this.
|
||||
|
||||
## 8. Driver app update over ESP-NOW
|
||||
|
||||
Pushes the led-driver `.py` files from the PC, through the controller, to the drivers. The drivers need `espnow_ota.py` first, so install the code once over USB (`led-cli -p <port> --all`). After that:
|
||||
|
||||
```bash
|
||||
python3 tools/driver_ota.py $S3 --mac <mac> --dry-run # list the files and drivers, send nothing
|
||||
python3 tools/driver_ota.py $S3 --mac <mac> # one driver
|
||||
make ota-drivers HOST=$S3 BROADCAST=1 # every ESP-NOW driver, one broadcast and repairs
|
||||
```
|
||||
|
||||
Each file prints `written`, or nothing when the driver already has it. Drivers that received files reset after the commit, and the script waits for them to ack the link again. `--bad-sha <device path>` sends a wrong hash for one file, to test the abort path.
|
||||
|
||||
| Check | Expected |
|
||||
|---|---|
|
||||
| Push with nothing changed | every file skipped, no reset |
|
||||
| Edit one pattern, push | only that file written; the driver resets, comes back and runs the new code; `file_hashes.json` has the new hash |
|
||||
| `--bad-sha patterns/<file>.py` | `ERROR badhash` and `aborted:`; no `.new` files left on the driver and the old file unchanged |
|
||||
| Controller loss at 20% (`beats: false`) | still completes, slower, with `+n repaired` on some files |
|
||||
| `--broadcast` with two or more drivers | each changed file is sent once to all of them; afterwards every driver still acks and fires beats |
|
||||
|
||||
### Results of the first run (S3 controller, two C3 drivers with 119 LEDs, channel 5)
|
||||
|
||||
| | result |
|
||||
|---|---|
|
||||
| 62 files, nothing changed | all skipped in about 7 s (about 110 ms per file, mostly the driver hashing its copy), no reset |
|
||||
| One changed pattern (7.3 KB) | written and committed; driver reset and acked again; content and manifest checked over USB |
|
||||
| 60 KB file, unicast | 4.6 s, 12.8 KB/s including both hash checks |
|
||||
| 60 KB file, unicast, 20% controller loss | 4 of 4 runs completed, 3.8 to 8.3 KB/s |
|
||||
| Wrong hash | `badhash`, aborted, nothing staged or committed |
|
||||
| 60 KB file, broadcast to both | 4.2 s, about 14 KB/s per driver (29 KB/s in total), usually no repairs (once 3) |
|
||||
| 60 KB file, broadcast to both, 20% loss | 2 of 2 completed in about 33 s; 33 to 58 of the 65 chunks needed a repair (each chunk is 4 frames with no radio retries) |
|
||||
| Beat echo round trip after the change to `esp.irq()`, 177 beats, two drivers | 2.4 / 5.5 / 23.5 ms (min / avg / max) beyond the 30 ms lead, against 9.8 / 15.0 / 25.7 ms when the driver polled; 176 of 177 echoed |
|
||||
|
||||
**Broadcast pacing.** With 12 ms between broadcast chunks (about 30 KB/s) the drivers stopped receiving ESP-NOW frames altogether. Their `esp.stats()` receive count froze, with no drops counted, while the controller's unicasts were still acked by the drivers' radios. It lasted until a reset, more than 5 minutes once, and beats stopped too. The likely cause is the C3 writing to flash while the frames keep coming. At 50 ms (`BCAST_GAP_MS` in `main/drv_ota.c`) it did not happen in 5 runs.
|
||||
|
||||
## 9. Troubleshooting
|
||||
## 8. Troubleshooting
|
||||
|
||||
- **A board on a USB-serial/JTAG port (C3, and the S3 controller) resets whenever a program opens its port,** and a C3 can land in ROM download mode (`wait usb download`). The old apt `mpremote` 0.4.0 hangs on this. Use the newer one in `~/projects/micropython/micropython/tools/mpremote/mpremote.py`, or `led-tool`, and note that `fs cp -r` fails on drivers that print timestamps (copy named files instead).
|
||||
- **Only one program can use a board's serial port at a time.** A serial logger left running while `led-cli` uploads corrupts the transfer silently: `led-cli` reports the files uploaded, but the old ones stay on the driver.
|
||||
@@ -320,7 +285,7 @@ Each file prints `written`, or nothing when the driver already has it. Drivers t
|
||||
- **Resync never triggers:** the driver ignores a digest equal to its own version; confirm with `/status` that `link.ver` changed after the missed play.
|
||||
- **Web UI is blank:** the web UI was not packed before the build; run `tools/build_web.sh` and build again (`make build` does this).
|
||||
|
||||
## 10. Cleanup
|
||||
## 9. Cleanup
|
||||
|
||||
```bash
|
||||
curl -s -X POST -d '{"percent":0}' http://$S3/test/loss
|
||||
|
||||
Reference in new issue
Block a user