Files
jimmyandClaude Opus 5.5 581b751904 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>
2026-11-16 19:32:46 +13:00

142 lines
6.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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">
<span class="chip" id="bridge-chip" title="The rig's bridge: frames from the controller come in as from this MAC">bridge</span>
<span class="chip" id="controller-chip">controller: –</span>
<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>
<span class="chip" id="strips-chip">strips: –</span>
</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 id="edit-tools" class="edit-tools" hidden>
<button type="button" id="room-settings" class="secondary">Size &amp; strip types…</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>
<a class="button secondary" href="/sim/gallery" target="_blank" rel="noopener">Pattern gallery</a>
<button type="button" id="power-on-all">Power on all</button>
<button type="button" id="power-cycle-all">Power cycle all</button>
<button type="button" id="power-off-all" class="secondary">Power off all</button>
<label class="toggle" title="Boot every strip when this page opens">
<input type="checkbox" id="auto-power"> Power on when opened
</label>
</div>
</header>
<div id="banner" class="banner" hidden></div>
<div class="edit-hint" id="edit-hint">
Click the floor to add a strip · drag a strip to move it (Alt: no snap) · drag its end circle to turn it (Shift: no snap) · Delete removes the selected strip
</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/&lt;room&gt;.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>
<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>
</form>
<div class="drawer-actions">
<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">
<span>Serial</span>
<button type="button" class="link" id="d-clear">clear</button>
</div>
<pre class="log" id="d-log"></pre>
</div>
</aside>
</main>
<footer class="hint" id="hint">Loading…</footer>
<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>
<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/app.js"></script>
</body>
</html>