feat(ui): driver settings and code updates over ESP-NOW
Settings gets a Driver tab (/settings/editor). It sends a driver its settings through PUT /devices/<id>, which now forwards name too, and runs the tools/driver_ota.py session from the browser. The firmware embeds the led-driver files and a manifest of their hashes, because crypto.subtle is unavailable over plain HTTP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2f0c26e9b8
commit
06953028ab
11 files changed
+421
-8
No files matched your search
+3
-2
@@ -24,6 +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 | `/static/<path>` | UI scripts and styles |
|
||||
| GET | `/favicon.ico` | 204 |
|
||||
|
||||
@@ -153,7 +154,7 @@ 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 `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` 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 |
|
||||
@@ -270,7 +271,7 @@ On connect the controller sends `{"type": "device_tcp_snapshot", "connected_ips"
|
||||
|
||||
## 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`) runs a whole session. The wire format is in `led-driver/src/espnow_ota.py`. One request runs at a time; another gets 409.
|
||||
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 |
|
||||
|--------|------|-------------|
|
||||
|
||||
Reference in new issue
Block a user