feat(v2): move web UI into v2, remove legacy MicroPython app
Move the web assets and templates under v2/web, drop the old src/, lib/ and scripts, and update firmware, tools, docs and db files. Add the audio page, LED test scripts and VPN autoconnect script. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6c16998691
commit
71bd320661
193 files changed
+5605
-18860
No files matched your search
@@ -1,68 +1,43 @@
|
||||
# led-controller
|
||||
|
||||
LED controller web app for managing profiles, **zones**, presets, and colour palettes, and sending commands to LED devices. Outbound paths include:
|
||||
ESP32-S3 controller for LED drivers: W5500 Ethernet, web UI, I2S microphone beat detection and an ESP-NOW link to the drivers. The firmware lives in [`v2/`](v2/); see [`v2/docs/BENCH_TEST.md`](v2/docs/BENCH_TEST.md) for the bench tests.
|
||||
|
||||
- **Serial → ESP-NOW bridge**: JSON lines over UART to an ESP32 that forwards ESP-NOW frames (configure `serial_port` and baud in `settings.json` / Settings model).
|
||||
- **Wi-Fi LED drivers**: TCP JSON lines (default port **8765** on the Pi; drivers discover the controller via **UDP 8766** broadcast).
|
||||
|
||||
## Run
|
||||
|
||||
- One-time setup for port 80 without root: `sudo scripts/setup-port80.sh`
|
||||
- Start app: `pipenv run run` (override listen port with the **`PORT`** environment variable)
|
||||
- Dev watcher (auto-restart on `src/` changes): `pipenv run dev`
|
||||
- Regenerate **`docs/help.pdf`** from **`docs/help.md`**: `pipenv run help-pdf` (requires **pandoc** and **chromium** on the host)
|
||||
|
||||
## UI modes
|
||||
|
||||
- **Run mode**: focused control view. Select zones/presets and apply profiles. Editing actions are hidden.
|
||||
- **Edit mode**: management view. Shows **Zones**, Presets, Patterns, Colour Palette, and Send Presets controls, plus per-tile preset edit/remove and drag-reorder.
|
||||
|
||||
## Profiles
|
||||
|
||||
- Applying a profile updates session scope and refreshes the active zone content.
|
||||
- In **Run mode**, Profiles supports apply-only behaviour (no create/clone/delete).
|
||||
- In **Edit mode**, Profiles supports create/clone/delete.
|
||||
- Creating a profile always creates a populated `default` zone (starter presets).
|
||||
- Optional **DJ zone** seeding creates:
|
||||
- `dj` zone bound to device name `dj`
|
||||
- starter DJ presets (rainbow, single colour, transition)
|
||||
|
||||
## Preset colours and palette linking
|
||||
|
||||
- In preset editor, selecting a colour picker value auto-adds it when the picker closes.
|
||||
- Use **From Palette** to add a palette-linked preset colour.
|
||||
- Linked colours are stored as palette references and shown with a `P` badge.
|
||||
- When profile palette colours change, linked preset colours update across that profile.
|
||||
|
||||
## Brightness and search
|
||||
|
||||
- The header **Brightness** slider sets the server-wide `global_brightness` (saved via `PUT /settings`, broadcast to connected drivers, and re-sent when a Wi-Fi driver reconnects).
|
||||
- The Devices, Zones and Presets modals have a client-side search filter.
|
||||
|
||||
## API docs
|
||||
|
||||
- Main API reference: `docs/API.md`
|
||||
- User guide: `docs/help.md`
|
||||
- Full specification: `docs/SPECIFICATION.md`
|
||||
|
||||
## Driver pattern modules
|
||||
|
||||
Pattern **`.py`** sources live under **`led-driver/src/patterns`**. The Pi app resolves that path via `util.driver_patterns.driver_patterns_dir()`. If you deploy without that tree next to the app, set **`LED_CONTROLLER_PATTERNS_DIR`** to the directory that contains those files.
|
||||
|
||||
## Animation engine (Pi-side)
|
||||
|
||||
`src/engine/` lets the Pi drive LEDs itself, in addition to the ESP32 drivers:
|
||||
|
||||
- **Pixel generator**: runs the **unchanged** `led-driver/src/patterns/*.py` under CPython (a `utime` shim plus a NeoPixel-like buffer) with the same preset JSON the drivers get, and streams each frame to **pixel outputs**: DDP, Art-Net, sACN (E1.31), or USB-DMX (Enttec Pro / Open DMX). Configure outputs in **Outputs** (edit mode) and add an output's name to a zone's devices.
|
||||
- **Preset sequencer**: **Sequences** play timed chains of presets on a zone, switching both the pixel outputs and the zone's ESP32 drivers. Sequences resume after a restart.
|
||||
- ESP32 firmware is unchanged; drivers still get presets + `select`.
|
||||
|
||||
CLI (run from `src/`):
|
||||
## Build and flash
|
||||
|
||||
```bash
|
||||
python -m engine.cli --output "ddp://192.168.1.60?pixels=300" --test
|
||||
python -m engine.cli --output "artnet://192.168.1.61?universe=0&pixels=170" --preset 16
|
||||
python -m engine.cli --pattern rainbow --n1 2 --leds 60 # terminal preview
|
||||
make build # minify the web UI from v2/web, then build the firmware (ESP-IDF in Docker)
|
||||
make flash # flash over USB
|
||||
make ota HOST=<ip> # update firmware (web UI included) over Ethernet, no USB (POST /ota)
|
||||
make monitor # serial console
|
||||
make test # driver unit tests and the C/Python envelope cross-check
|
||||
```
|
||||
|
||||
Tests: `pipenv run pytest tests/engine_tests`.
|
||||
`make` lists every target. The web UI sources are in `v2/web/` (`static/`, `templates/`, `audio.html`).
|
||||
|
||||
## Other directories
|
||||
|
||||
- `led-driver/` (submodule): MicroPython firmware for the ESP32 LED drivers.
|
||||
- `led-tool/` (submodule): `led-cli`, configures drivers over serial and updates the controller over Ethernet (`led-cli --ota HOST`).
|
||||
- `led-simulator/` (submodule), `espnow-sender/`: test helpers.
|
||||
- `db/`: stored zones, presets and devices, importable with `PUT /db/<name>`.
|
||||
|
||||
## Docs
|
||||
|
||||
- API reference: `docs/API.md`
|
||||
- User guide: `docs/help.md` (`scripts/build_help_pdf.sh` regenerates `docs/help.pdf`)
|
||||
- Specification: `docs/SPECIFICATION.md`
|
||||
|
||||
## Network
|
||||
|
||||
The controller advertises `<hostname>.local` over mDNS (default `led-controller`, plus an `_http._tcp` service). Both settings below come from `/settings` and apply on reboot.
|
||||
|
||||
`static_ips` is a list of networks to try, in order, each time the Ethernet link comes up. The first entry whose gateway answers ARP is used; if none does (or the list is empty) the controller uses DHCP. `netmask` defaults to `255.255.255.0`, `dns` to the gateway.
|
||||
|
||||
```bash
|
||||
curl -X PUT http://led-controller.local/settings/settings -H 'Content-Type: application/json' -d '{
|
||||
"hostname": "stage",
|
||||
"static_ips": [
|
||||
{"ip": "192.168.1.50", "netmask": "255.255.255.0", "gw": "192.168.1.1"},
|
||||
{"ip": "10.0.0.50", "netmask": "255.255.255.0", "gw": "10.0.0.1"}
|
||||
]}'
|
||||
```
|
||||
Reference in new issue
Block a user