feat: browser simulator served by the controller, desktop build, browser bridge

- led-simulator: the rig runs the C++ led-driver as WebAssembly (sim-driver/),
  one single-threaded worker per bar, no cross-origin isolation needed. Rooms
  (one JSON per room) with an on-page editor, and a pattern gallery. The
  Python server, Pyodide boot and ring buffer are removed.
- sim-controller sim_rig.c: serves /sim/ from an embedded pack, the page's
  WebSocket and the rooms/flash API. The desktop build embeds it too.
- bridge.c: a "browser" bridge kind that carries ESP-NOW frames to the page;
  devices announced through it are marked sim.
- UI: Simulator in the Menu, split view with resize and pop-out, swipe
  between controller and rig on phones; SIM/REAL badges in Devices.
- Fades: preset pushes and Wi-Fi driver bodies always carry fade and
  beat_time, so "off" no longer inherits an earlier fade.
- Also the sequences-v2 work in progress: desktop port, bridge firmware,
  serial bridge, Wi-Fi drivers, sequence timeline, audio and API changes.
- led-driver: ESP-NOW link, beat sync, control messages, sim hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-16 19:32:46 +13:00
1 parent 698c1463c0
commit 581b751904
506 files changed
+42336 -3599

No files matched your search

+66 -49
View File
@@ -359,14 +359,13 @@
<div id="sequences-modal" class="modal">
<div class="modal-content">
<div class="modal-head">
<h2>Sequences &amp; animations</h2>
<h2>Sequences</h2>
<div class="modal-top-actions">
<button type="button" class="btn btn-secondary" id="sequences-close-btn">Close</button>
</div>
</div>
<div class="modal-actions">
<button type="button" class="btn btn-primary" id="sequence-add-btn">Add sequence</button>
<button type="button" class="btn btn-primary" id="animation-add-btn">Add animation</button>
<button type="button" class="btn btn-secondary" id="sequences-open-presets-btn">Presets</button>
</div>
<div id="sequences-list" class="profiles-list"></div>
@@ -388,42 +387,48 @@
<label for="sequence-editor-name">Name</label>
<input type="text" id="sequence-editor-name" placeholder="Sequence name" style="width:100%;max-width:24rem;">
</div>
<div class="preset-editor-field">
<label for="sequence-editor-kind">Kind</label>
<select id="sequence-editor-kind" class="zone-device-add-select">
<option value="sequence">Sequence</option>
<option value="animation">Animation (one shot)</option>
</select>
<div id="sequence-editor-kind-hint" class="muted-text"></div>
</div>
<div class="preset-editor-field">
<label for="sequence-editor-mode">Steps last (lanes can override)</label>
<select id="sequence-editor-mode" class="zone-device-add-select">
<option value="beats">Beats</option>
<option value="time">Time (seconds)</option>
</select>
</div>
<div id="sequence-editor-beats-panel" style="margin:0 0 0.75rem 0;">
<label style="display:block;">
<input type="checkbox" id="sequence-editor-loop" checked>
Loop
</label>
</div>
<details class="seq-targets-panel" open>
<summary><strong>Targets</strong> <span class="muted-text">— the drivers this sequence plays to, in order. Lanes, steps and chases pick from them.</span></summary>
<div id="sequence-editor-targets" class="profiles-list"></div>
<div class="modal-actions">
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-add-target-btn">Add target</button>
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-per-driver-btn" title="One target for each driver in this zone's groups">One per driver</button>
<!-- Timeline: tracks (targets) down, beats or seconds across, clips dragged in from the browser -->
<div id="seq-tl" class="tl">
<div class="tl-transport">
<div class="tl-tgroup">
<button type="button" class="tl-tbtn" id="tl-play" title="Save, then play it in the current zone">&#9654;</button>
<button type="button" class="tl-tbtn" id="tl-stop" title="Stop the sequence">&#9632;</button>
</div>
<div class="tl-lcd" title="Playhead position and tempo"><span id="tl-pos">1.1</span><span id="tl-bpm">120 BPM</span></div>
<div class="tl-tgroup tl-seg" id="tl-units" title="Clips last beats, or seconds">
<button type="button" data-v="beats">Beats</button>
<button type="button" data-v="time">Seconds</button>
</div>
<!-- What clips are measured in; the Beats/Seconds buttons set it -->
<select id="sequence-editor-mode" hidden>
<option value="beats">Beats</option>
<option value="time">Seconds</option>
</select>
<label class="tl-tfield">Snap <select id="tl-snap"></select></label>
<label class="tl-tfield tl-loop-toggle" title="On: loops, every track restarting at the end of the loop bar. Off: a one-shot that plays once in seconds, then the zone goes back to its last looping preset or sequence."><input type="checkbox" id="sequence-editor-loop" checked> Loop</label>
<div class="tl-tgroup">
<button type="button" class="tl-tbtn" id="tl-zoom-out" title="Zoom out">&minus;</button>
<button type="button" class="tl-tbtn" id="tl-zoom-in" title="Zoom in">+</button>
</div>
</div>
</details>
<div class="modal-actions">
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-view-btn">Show grid</button>
<div class="tl-notice" id="tl-notice" hidden></div>
<div class="tl-main">
<div class="tl-arrange">
<div class="tl-scroll" id="tl-scroll"><div class="tl-canvas" id="tl-canvas"></div></div>
<div class="tl-addtrack">
<select id="tl-add-track" class="zone-device-add-select"></select>
<button type="button" class="btn btn-secondary btn-small" id="tl-per-driver" title="One track for each driver in this zone's groups">One track per driver</button>
</div>
</div>
<aside class="tl-browser">
<div class="tl-browser-head"><span>Browser</span><button type="button" class="tl-tbtn" id="tl-browser-refresh" title="Reload presets">&#8635;</button></div>
<input type="search" id="tl-browser-search" placeholder="Search presets" autocomplete="off">
<div class="tl-browser-list" id="tl-browser-list"></div>
</aside>
</div>
<div class="tl-inspector" id="tl-inspector"></div>
</div>
<div id="sequence-editor-grid" class="seq-grid" hidden></div>
<div id="sequence-editor-lanes"></div>
<div class="modal-actions preset-editor-modal-actions">
<button type="button" class="btn btn-secondary btn-small" id="sequence-editor-add-lane-btn">Add lane</button>
<button type="button" class="btn btn-danger" id="sequence-editor-delete-btn">Delete</button>
</div>
</div>
@@ -464,11 +469,6 @@
<label for="preset-fade-input">Fade in (ms)</label>
<input type="number" id="preset-fade-input" placeholder="0" min="0" max="10000" step="50" value="0" title="Crossfade from what the strip showed when this preset is selected (needs updated drivers)">
</div>
<div class="preset-editor-field">
<label for="preset-beat-time-input" title="Delay and timing parameters count quarter beats instead of ms, so the preset follows the tempo">
<input type="checkbox" id="preset-beat-time-input"> Times in ¼ beats
</label>
</div>
<div class="preset-editor-field">
<label for="preset-background-input">Background</label>
<div class="profiles-actions" style="gap: 0.4rem;">
@@ -993,12 +993,9 @@
</div>
</div>
<ul>
<li><strong>Sequences</strong> (Edit mode): build multi-step shows with one or more <strong>lanes</strong> (each lane targets a device group).</li>
<li>Add presets as steps per lane; open from the zone editor to attach a sequence to a zone.</li>
<li><strong>Targets</strong>: list the drivers the sequence plays to (groups or single drivers; <em>One per driver</em> fills it from the zone). Each lane picks its targets, and a step can light just some of them.</li>
<li><strong>Lane options</strong>: timing in beats or seconds (beat and time lanes run side by side), <em>Start after</em> to offset a lane, <em>Speed</em> ¼×–4×, and <em>Chase</em> to move each step to the next target (forward, reverse, bounce, random).</li>
<li><strong>Animations</strong>: a one-shot clip. Its zone tile (⚡) plays it once over whatever runs, then the drivers go back; the sequence underneath keeps time. A step can fire an animation too.</li>
<li><strong>Show grid</strong>: all lanes on one time line, with the playing steps lit; click a cell to change it.</li>
<li><strong>Sequences</strong> (Edit mode): open from the zone editor to attach a sequence to a zone.</li>
<li><strong>Timeline</strong>: like music editing software. Each <strong>track</strong> is a group (or some drivers); time runs across in bars and beats (or seconds). Drag presets from the <em>Browser</em> onto a track, drag clips to move them and their edges to resize; scroll over the tracks to zoom. Click a track name to pick its groups (<em>One track per driver</em> fills them from the zone). Old sequences made with lanes, chases or speeds open as one pass of what they played. With <em>Loop</em> on, drag the end of the loop bar to set where every track restarts. ▶ saves and plays it, with a playhead.</li>
<li><strong>One-shots</strong>: a sequence with <em>Loop</em> off. On a zone (⚡) it plays once over whatever runs, then the zone goes back to its last looping preset or sequence; a looping sequence underneath keeps time. A sequence can play a one-shot as a clip too, for as long as the clip is drawn. Zones can mix looping presets, looping sequences and one-shots.</li>
<li><strong>Beat</strong> / <strong>Downbeat</strong> toggle (header): when starting a sequence, wait for beat or downbeat before step 1.</li>
<li>Tap <kbd>S</kbd> or the BPM button during playback to sync step timing to music (with Audio running).</li>
</ul>
@@ -1235,6 +1232,24 @@
<div id="network-status" class="muted-text">Loading…</div>
</div>
<!-- Bridges: USB boards and network boards that carry the radio frames (hidden where not supported) -->
<div class="settings-section" id="bridge-section" hidden>
<h3>Bridges</h3>
<small>Every ESP-NOW frame goes to each bridge, and a frame that several bridges hear arrives once. A USB board is its port (<code>/dev/ttyACM1</code>); a network board is <code>host:port</code> (UDP).</small>
<div id="bridge-list"></div>
<form id="bridge-add-form">
<div class="form-group">
<label for="bridge-add-input">Add a bridge</label>
<input type="text" id="bridge-add-input" list="bridge-ports" placeholder="/dev/ttyACM1 or 192.168.1.50:8766" maxlength="79" autocomplete="off">
<datalist id="bridge-ports"></datalist>
</div>
<div class="btn-group">
<button type="button" class="btn btn-secondary btn-full" id="bridge-refresh-btn">Refresh</button>
<button type="submit" class="btn btn-primary btn-full">Add</button>
</div>
</form>
</div>
<!-- Network -->
<div class="settings-section">
<h3>Network</h3>
@@ -1259,9 +1274,9 @@
<small>8 to 63 characters (WPA2). Leave empty for an open network.</small>
</div>
<div class="form-group">
<label for="bridge-input">Simulator bridge</label>
<input type="text" id="bridge-input" placeholder="off (drivers over the radio)" maxlength="63" autocomplete="off">
<small><code>host:port</code> of led-simulator (UDP, port 8766). While set, the controller talks to the simulated drivers instead of the radio. Leave empty for the real rig.</small>
<label for="bridge-input">Bridges</label>
<input type="text" id="bridge-input" placeholder="off (drivers over the radio)" maxlength="400" autocomplete="off">
<small>Comma-separated: USB boards (<code>/dev/ttyACM1</code>) and <code>host:port</code> (UDP, e.g. led-simulator on port 8766). While any are set, the controller sends its frames to them instead of the radio. Applied on the next restart; the list above applies at once.</small>
</div>
<div class="form-group">
<label>Static IPs</label>
@@ -1384,10 +1399,12 @@
<script src="/static/patterns.js"></script>
<script src="/static/presets.js"></script>
<script src="/static/sequences.js"></script>
<script src="/static/seq_timeline.js"></script>
<script src="/static/devices.js"></script>
<script src="/static/audio.js"></script>
<script src="/static/numpad.js"></script>
<script src="/static/outputs.js"></script>
<script src="/static/list_search.js"></script>
<script src="/static/sim_split.js"></script>
</body>
</html>