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:
jimmyandClaude Opus 5.5 committed 2026-11-17 18:13:58 +13:00
1 parent 2fdd55323b
commit 35207a868a
16 files changed
+2859 -118

No files matched your search

+69 -11
View File
@@ -27,9 +27,18 @@
<button type="button" id="zoom-in" class="secondary" aria-label="Zoom in" title="Zoom in (wheel)">+</button>
</span>
<span id="edit-tools" class="edit-tools" hidden>
<button type="button" id="add-strip">Add strip</button>
<span class="add-group" role="group" aria-label="Add a fixture">
<select id="add-type" aria-label="Fixture type" title="What a click on the floor adds">
<option value="espnow">ESP-NOW bar</option>
<option value="ddp">DDP strip</option>
<option value="artnet">Art-Net pixel strip</option>
<option value="can">DMX can</option>
<option value="mover">DMX mover</option>
</select>
<button type="button" id="add-strip">Add</button>
</span>
<button type="button" id="centre-strips" class="secondary" title="Move all the strips so they sit in the middle of the room">Centre strips</button>
<button type="button" id="room-settings" class="secondary">Size &amp; strip types…</button>
<button type="button" id="room-settings" class="secondary">Size, strip types &amp; DMX…</button>
<button type="button" id="room-new" class="secondary">New room…</button>
<button type="button" id="room-delete" class="secondary">Delete room</button>
<span class="muted" id="save-state"></span>
@@ -45,7 +54,7 @@
<div id="banner" class="banner" hidden></div>
<div class="edit-hint" id="edit-hint">
Add strip or click the floor to add one · drag the floor to select the strips in a box (Shift: add to the selection; zoomed in, a plain drag pans instead) ·Shift-click a strip to add or remove it · drag a selected strip to move them all (Alt: no snap) · drag its end circle to turn it (Shift: no snap) · Delete removes the selection · wheel or +/− zooms, right-drag, middle-drag or Space-drag pans
Pick a type and press Add, or click the floor to add one · drag the floor to select the strips in a box (Shift: add to the selection; zoomed in, a plain drag pans instead) ·Shift-click a strip to add or remove it · drag a selected strip to move them all (Alt: no snap) · drag its end circle to turn it (Shift: no snap) · Delete removes the selection · wheel or +/− zooms, right-drag, middle-drag or Space-drag pans
</div>
<main class="stage">
@@ -71,22 +80,41 @@
<dt>Position</dt><dd id="d-pos">–</dd>
<dt>Packets</dt><dd id="d-packets">–</dd>
</dl>
<div class="net-actions" id="d-net" hidden>
<button type="button" id="d-mkout" class="secondary" title="Add a controller output (Outputs) that sends to this fixture">Create controller output</button>
<button type="button" id="d-testout" class="secondary" hidden>Send test</button>
<p class="note" id="d-out-note"></p>
</div>
<table class="channels" id="d-channels" hidden>
<thead><tr><th>Ch</th><th>Name</th><th>Value</th></tr></thead>
<tbody></tbody>
</table>
<p class="note" id="d-note" hidden></p>
<form class="edit-form" id="d-edit" hidden onsubmit="return false">
<label>Label <input id="e-label" maxlength="47"></label>
<label>Strip type <select id="e-def"></select></label>
<label>LEDs <input id="e-leds" type="number" min="1" max="512" step="1" title="Empty: the strip type's count"></label>
<label>Pixel 0 x (m) <input id="e-x" type="number" step="0.05"></label>
<label>Pixel 0 y (m) <input id="e-y" type="number" step="0.05"></label>
<label>Heading (°) <input id="e-dir" type="number" step="15" title="Degrees clockwise from up: 90 runs right, -90 runs left"></label>
<button type="button" id="d-delete" class="danger">Remove strip</button>
<label data-for="strip">Strip type <select id="e-def"></select></label>
<label data-for="strip">LEDs <input id="e-leds" type="number" min="1" max="512" step="1" title="Empty: the strip type's count"></label>
<label data-for="ddp">DDP port <input id="e-port" type="number" min="1" max="65535" step="1"></label>
<label data-for="ddp">First pixel <input id="e-offset" type="number" min="0" max="4095" step="1" title="Where this strip starts in what arrives on the port (pixels)"></label>
<label data-for="artnet">Universe <input id="e-universe" type="number" min="0" max="32767" step="1"></label>
<label data-for="artnet">DMX address <input id="e-address" type="number" min="1" max="512" step="1"></label>
<label data-for="pixels">Colour order <select id="e-order">
<option>rgb</option><option>rbg</option><option>grb</option><option>gbr</option><option>brg</option><option>bgr</option>
</select></label>
<label data-for="dmx">DMX definition <select id="e-dmxdef"></select></label>
<label data-for="mover">Pan zero (°) <input id="e-zero" type="number" step="15" title="Heading at pan centre, degrees clockwise from up"></label>
<label data-for="mover" class="check"><input type="checkbox" id="e-panrev"> Pan reversed</label>
<label><span><span id="e-x-name">Pixel 0 x</span> (m)</span> <input id="e-x" type="number" step="0.05"></label>
<label><span><span id="e-y-name">Pixel 0 y</span> (m)</span> <input id="e-y" type="number" step="0.05"></label>
<label data-for="heading">Heading (°) <input id="e-dir" type="number" step="15" title="Degrees clockwise from up: 90 runs right, -90 runs left"></label>
<button type="button" id="d-delete" class="danger">Remove</button>
</form>
<div class="drawer-actions">
<div class="drawer-actions" id="d-power">
<button type="button" id="d-on">Power on</button>
<button type="button" id="d-reset">Reset</button>
<button type="button" id="d-off" class="secondary">Power off</button>
</div>
<div class="log-head">
<div class="log-head" id="d-log-head">
<span>Serial</span>
<button type="button" class="link" id="d-clear">clear</button>
</div>
@@ -113,6 +141,34 @@
</tr>
</tfoot>
</table>
<h3>DMX definitions</h3>
<p class="muted small">The channel list of each can or mover, in DMX order, as in the qlcplus stage map. Names such as
Dimmer, Strobe, Red, Green, Blue, White, Macro, Speed, Pan, Tilt, Zoom, Focus or "Red 1" pick what each channel does.</p>
<table class="defs" id="r-dmx-table">
<thead><tr><th>Definition</th><th>Mode</th><th>Channels</th><th></th><th></th></tr></thead>
<tbody id="r-dmx"></tbody>
</table>
<div class="dialog-row dmx-add">
<select id="r-dmx-preset" aria-label="Preset">
<option value="">Add a preset…</option>
</select>
<button type="button" id="r-dmx-new" class="secondary">New definition</button>
<label class="button secondary file">Import QLC+ .qxf <input type="file" id="r-dmx-qxf" accept=".qxf,.xml" hidden></label>
<label class="button secondary file" title="A qlcplus stage/map.json: its definitions and fixtures are added to this room">Import stage map <input type="file" id="r-dmx-map" accept=".json" hidden></label>
</div>
<div class="dmx-edit" id="r-dmx-edit" hidden>
<div class="dialog-row">
<label>Name <input id="r-dmx-name" maxlength="60"></label>
<label>Mode <input id="r-dmx-mode" maxlength="60"></label>
</div>
<label>Channels, one per line <textarea id="r-dmx-chans" rows="10" spellcheck="false"></textarea></label>
<p class="error" id="r-dmx-error"></p>
<div class="dialog-actions">
<button type="button" id="r-dmx-cancel" class="secondary">Cancel</button>
<button type="button" id="r-dmx-save">Save definition</button>
</div>
</div>
<p class="error" id="r-error"></p>
<div class="dialog-actions"><button type="button" id="r-close">Done</button></div>
</dialog>
@@ -134,6 +190,8 @@
</dialog>
<script src="/sim/layout.js"></script>
<script src="/sim/dmx.js"></script>
<script src="/sim/dmx-draw.js"></script>
<script src="/sim/app.js"></script>
</body>
</html>