sim: fixture editor for DDP and Art-Net/DMX fixtures
The rig sim receives Art-Net (UDP 6454, answers ArtPoll) and DDP (each port the room's DDP strips use) in sim_net.c and passes changed universes and pixels to the page over /sim/ws, now with a kind byte in front of each binary frame. Rooms gain fixture types: ddp strips, artnet pixel strips, and artnet cans and movers that read named channels from the room's dmx_definitions (the qlcplus stage map's format). Overlapping DMX channels are refused. Cans and movers are decoded and drawn as in the qlcplus stage simulator (dmx.js, dmx-draw.js). In Edit mode: pick a type to add, edit port/offset/universe/address/colour order/definition, see a can's or mover's live channels, make a controller output aimed at the sim and send its test. The room dialog lists DMX definitions, with presets, a channel editor, and .qxf and stage map import. GET /sim/api/dmx shows what the receiver has had. Tests: test/api/test_sim_net.py and test/browser/dmx_decode.test.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2fdd55323b
commit
35207a868a
16 files changed
+2859
-118
No files matched your search
+45
-3
@@ -62,6 +62,8 @@ strip types in `definitions`, and `fixtures` keyed by id, each placed by positio
|
||||
`leds × pitch_m` long. `leds` on a fixture overrides its type's count (1–512).
|
||||
- **`mac`** identifies the driver. Each bar's flash is kept per MAC, so a bar in two rooms (a copied room, say) is
|
||||
the same bar with the same presets. New bars get a MAC no room uses yet.
|
||||
- A fixture's **`type`** is `espnow` (the default: a bar with its own driver), `ddp` or `artnet`; see
|
||||
[Network fixtures](#network-fixtures).
|
||||
- The first run makes the `default` room: 16 bars × 119 LEDs in 2 columns × 8 rows, pixel 0 at the centre line,
|
||||
`sim-01` … `sim-16` = `02:51:4d:00:00:01` … `…:10`. The rig's bridge is `02:51:4d:00:00:00`.
|
||||
|
||||
@@ -89,6 +91,43 @@ controller's rig layout:
|
||||
A bar whose LED count changes keeps running with the old count until it is power-cycled, as `num_leds` is read at
|
||||
boot.
|
||||
|
||||
### Network fixtures
|
||||
|
||||
Besides the ESP-NOW bars, a room can hold fixtures that something sends to over the network: the controller's own
|
||||
Outputs, QLC+, or any DDP or Art-Net sender. The controller's sim receives them over UDP (`sim_net.c`: Art-Net on
|
||||
6454, DDP on each port the active room's DDP strips use, 4048 by default) and passes each changed universe or
|
||||
DDP buffer to the page at up to 40 frames a second. It answers ArtPoll, so QLC+ lists the node. If QLC+ on the same
|
||||
machine already holds 6454, set `LED_SIM_ARTNET_PORT` to another port (`0` turns Art-Net off).
|
||||
|
||||
| `type` | `kind` | Fields | What it is |
|
||||
| --- | --- | --- | --- |
|
||||
| `ddp` | | `def`, `leds`, `port` (4048), `offset` (first pixel), `color_order` | an LED strip fed by DDP |
|
||||
| `artnet` | `pixels` | `def`, `leds`, `universe`, `address` (1–512), `color_order` | an LED strip fed by Art-Net: the first universe from `address`, then 170 pixels a universe from channel 1, as the controller's Art-Net output sends them |
|
||||
| `artnet` | `can` | `dmx_def`, `universe`, `address`, `direction` | a par can |
|
||||
| `artnet` | `mover` | `dmx_def`, `universe`, `address`, `zero`, `pan_reverse` | a moving head; `zero` is its heading at pan centre |
|
||||
|
||||
Cans and movers behave as in the qlcplus stage simulator (technicalkiwi/qlcplus `simulator/`). Their channels come
|
||||
from the room's **`dmx_definitions`**: `{name: {manufacturer, model, mode, channels: [name, ...]}}`, the same shape
|
||||
as a qlcplus `stage/map.json`. The channel names choose what each slot does: `Dimmer`, `Strobe`, `Red`, `Green`,
|
||||
`Blue`, `White`, `Macro`, `Speed` for cans; `Pan`, `Pan Fine`, `Tilt`, `Tilt Fine`, `Pan/Tilt Speed`, `Zoom`,
|
||||
`Focus`, `Lens Rotate`, `Center Brightness`, `Center Strobe`, `Red 1` … `White 7`, `Colour Macro`,
|
||||
`Colour Temperature`, `Static Effect`, `Dynamic Effect` for movers (`web/dmx.js`). Art-Net fixtures may not share
|
||||
DMX channels; the room is refused if they do.
|
||||
|
||||
On the page, in Edit mode:
|
||||
|
||||
- Pick the type beside **Add** (ESP-NOW bar, DDP strip, Art-Net pixel strip, DMX can, DMX mover). A click on the
|
||||
floor adds that type. New DDP strips start after the last one on port 4048, Art-Net pixel strips on the first
|
||||
free universe, and cans and movers at the first free DMX address.
|
||||
- The side panel edits the port and first pixel, the universe and address, the colour order, the DMX definition,
|
||||
and a mover's pan zero and reversal. For a can or mover it lists the channels with their live values.
|
||||
- **Create controller output** (DDP and Art-Net pixel strips) adds an Output to the controller aimed at the sim
|
||||
(`127.0.0.1`), and **Send test** runs its red, green, blue, white, black test. Outputs send from pixel 0 and
|
||||
channel 1, so the button needs First pixel 0 or DMX address 1.
|
||||
- **Size, strip types & DMX…** also lists the DMX definitions: add a preset (the qlcplus beamZ BCC145 and Small Eye
|
||||
7 mover), write one (one channel name per line), import a QLC+ fixture definition (`.qxf`, one definition per
|
||||
mode), or import a qlcplus `stage/map.json` (its definitions, and its cans and movers placed in the room).
|
||||
|
||||
### API (on the controller)
|
||||
|
||||
| | |
|
||||
@@ -99,8 +138,9 @@ boot.
|
||||
| `POST /sim/api/rooms` | `{name, width, depth, copy_from?}` makes a room |
|
||||
| `GET`, `PUT`, `DELETE /sim/api/rooms/<name>` | one room: read it, replace it (validated), delete it (not the active one) |
|
||||
| `POST /sim/api/room` | `{name}` switches the rig to that room |
|
||||
| `GET /sim/api/next-mac` | a MAC no room uses |
|
||||
| `WS /sim/ws` | the page's radio: binary `dst_mac + packet` down, `src_mac + packet` up; text `{"t":"flash"}` up |
|
||||
| `POST /sim/api/next-mac` | `{taken: [mac, ...]}`: a MAC no room or the page uses |
|
||||
| `GET /sim/api/dmx[?data=1]` | what the Art-Net and DDP receiver has had: packets per universe and port, the last sender; `data=1` adds the bytes as hex |
|
||||
| `WS /sim/ws` | the page's radio. Down, binary: `0x00 + dst_mac + packet` (ESP-NOW), `0x01 + u16 universe + 512 bytes` (Art-Net), `0x02 + u16 port + u32 offset + RGB` (DDP), little-endian. Up: binary `src_mac + packet`; text `{"t":"flash"}` |
|
||||
|
||||
## How it fits together
|
||||
|
||||
@@ -113,14 +153,16 @@ led-controller (host build) ──"browser" bridge──▶ WS /sim/ws ──▶
|
||||
| Where | What |
|
||||
| --- | --- |
|
||||
| `sim-controller/components/sim/sim_rig.c` | serves the page and the wasm from `www_dist/sim.pack`, the page's WebSocket, rooms and flash |
|
||||
| `sim-controller/components/sim/sim_net.c` | receives Art-Net and DDP for the network fixtures and passes them to the page |
|
||||
| `main/bridge.c` | the `browser` bridge kind next to UDP and serial |
|
||||
| `tools/build_sim_web.sh` | packs `web/` and `web/wasm/` into `www_dist/sim.pack`. It is empty when the drivers are not built, so `make desktop` works without Emscripten. |
|
||||
| `../sim-driver/` | the Emscripten build of the driver (`led_driver`) and the pattern engine for the gallery (`led_fx`) |
|
||||
| `web/app.js` | the room canvas, editor, power control, packet routing by MAC, and placements for `POST /devices/layout` |
|
||||
| `web/driver-worker.js` | loads `led_driver.mjs` and boots one bar |
|
||||
| `web/dmx.js`, `web/dmx-draw.js` | the DMX decoder and the can and mover drawing, ported from the qlcplus stage simulator |
|
||||
| `web/gallery.js` | one `led_fx` instance per pattern, each stepped every 10 ms of its own clock |
|
||||
|
||||
Not simulated: the drivers' Wi-Fi, their own web UI and HTTP API, DDP and USB. Bars do not hear each other's
|
||||
Not simulated: the drivers' Wi-Fi, their own web UI and HTTP API, DDP to the bars themselves, sACN and USB. Bars do not hear each other's
|
||||
ESP-NOW.
|
||||
|
||||
## Headless (older)
|
||||
|
||||
Reference in new issue
Block a user