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>
198 lines
11 KiB
HTML
198 lines
11 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<meta name="theme-color" content="#0e0f12">
|
||
<title>LED Rig Simulator</title>
|
||
<link rel="icon" href="data:,">
|
||
<link rel="stylesheet" href="/sim/styles.css">
|
||
</head>
|
||
<body>
|
||
<header class="topbar">
|
||
<div class="brand">
|
||
<span class="brand-mark" aria-hidden="true"></span>
|
||
<span class="brand-name">led-simulator</span>
|
||
</div>
|
||
<div class="chips">
|
||
<button type="button" id="add-bridge" class="secondary" hidden
|
||
title="The controller sends its ESP-NOW frames only to the bridges in its settings">Add the browser bridge</button>
|
||
</div>
|
||
<div class="room-bar">
|
||
<label class="field-inline">Room <select id="room-select" aria-label="Room"></select></label>
|
||
<button type="button" id="edit-toggle" class="secondary">Edit room</button>
|
||
<span class="zoom-tools" role="group" aria-label="Zoom">
|
||
<button type="button" id="zoom-out" class="secondary" aria-label="Zoom out" title="Zoom out (wheel)">−</button>
|
||
<button type="button" id="zoom-fit" class="secondary" title="Fit the room (0)">Fit</button>
|
||
<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>
|
||
<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, strip types & 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>
|
||
</span>
|
||
</div>
|
||
<div class="actions">
|
||
<a class="button secondary not-embedded" href="/">Controller</a>
|
||
<label class="toggle" title="Boot every strip when this page opens">
|
||
<input type="checkbox" id="auto-power"> Auto-power
|
||
</label>
|
||
</div>
|
||
</header>
|
||
|
||
<div id="banner" class="banner" hidden></div>
|
||
<div class="edit-hint" id="edit-hint">
|
||
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">
|
||
<div class="rig" id="rig">
|
||
<canvas id="rig-canvas" aria-label="LED rig"></canvas>
|
||
</div>
|
||
|
||
<aside class="drawer" id="drawer" hidden aria-label="Strip details">
|
||
<p class="drawer-empty" id="d-empty" hidden>
|
||
Select a strip to edit it, or click the floor to add one. Changes are saved to
|
||
<code>rooms/<room>.json</code> as you make them.
|
||
</p>
|
||
<div class="drawer-body" id="d-body">
|
||
<div class="drawer-head">
|
||
<div>
|
||
<div class="drawer-title" id="d-name">sim-01</div>
|
||
<div class="drawer-sub" id="d-meta">02:51:4d:00:00:01</div>
|
||
</div>
|
||
<button type="button" class="icon" id="d-close" aria-label="Close">×</button>
|
||
</div>
|
||
<dl class="facts">
|
||
<dt>State</dt><dd id="d-state">off</dd>
|
||
<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 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" 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" id="d-log-head">
|
||
<span>Serial</span>
|
||
<button type="button" class="link" id="d-clear">clear</button>
|
||
</div>
|
||
<pre class="log" id="d-log"></pre>
|
||
</div>
|
||
</aside>
|
||
</main>
|
||
|
||
<dialog id="room-dialog" aria-labelledby="r-title">
|
||
<h2 id="r-title">Room size and strip types</h2>
|
||
<div class="dialog-row">
|
||
<label>Width (m) <input id="r-width" type="number" min="0.5" max="200" step="0.1"></label>
|
||
<label>Depth (m) <input id="r-depth" type="number" min="0.5" max="200" step="0.1"></label>
|
||
</div>
|
||
<table class="defs">
|
||
<thead><tr><th>Type</th><th>LEDs</th><th>LEDs per metre</th><th></th><th></th></tr></thead>
|
||
<tbody id="r-defs"></tbody>
|
||
<tfoot>
|
||
<tr>
|
||
<td><input id="r-def-name" placeholder="name, e.g. bar-60"></td>
|
||
<td><input id="r-def-leds" type="number" min="1" max="512" step="1" value="60"></td>
|
||
<td><input id="r-def-perm" type="number" min="1" max="1000" step="1" value="60"></td>
|
||
<td colspan="2"><button type="button" id="r-add-def" class="secondary">Add type</button></td>
|
||
</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>
|
||
|
||
<dialog id="new-dialog" aria-labelledby="n-title">
|
||
<form id="new-form">
|
||
<h2 id="n-title">New room</h2>
|
||
<label>Name <input id="n-name" required pattern="[A-Za-z0-9_\-]{1,40}" title="Letters, digits, - or _"></label>
|
||
<div class="dialog-row">
|
||
<label>Width (m) <input id="n-width" type="number" min="0.5" max="200" step="0.1" required></label>
|
||
<label>Depth (m) <input id="n-depth" type="number" min="0.5" max="200" step="0.1" required></label>
|
||
</div>
|
||
<label class="check"><input type="checkbox" id="n-copy"> Copy the strips of the current room</label>
|
||
<p class="error" id="n-error"></p>
|
||
<div class="dialog-actions">
|
||
<button type="button" id="n-cancel" class="secondary">Cancel</button>
|
||
<button type="submit">Create and edit</button>
|
||
</div>
|
||
</form>
|
||
</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>
|