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

+15 -3
View File
@@ -283,7 +283,6 @@ document.addEventListener('DOMContentLoaded', () => {
const presetBrightnessInput = document.getElementById('preset-brightness-input');
const presetDelayInput = document.getElementById('preset-delay-input');
const presetFadeInput = document.getElementById('preset-fade-input');
const presetBeatTimeInput = document.getElementById('preset-beat-time-input');
const presetDelayField = presetDelayInput ? presetDelayInput.closest('.preset-editor-field') : null;
const presetBackgroundInput = document.getElementById('preset-background-input');
const presetBackgroundButton = document.getElementById('preset-background-btn');
@@ -750,7 +749,6 @@ document.addEventListener('DOMContentLoaded', () => {
presetBrightnessInput.value = preset.brightness || 0;
presetDelayInput.value = preset.delay || 0;
if (presetFadeInput) presetFadeInput.value = preset.fade || preset.f || 0;
if (presetBeatTimeInput) presetBeatTimeInput.checked = !!(preset.beat_time || preset.tb);
if (presetBackgroundInput) {
const rawBgRef = preset.background_palette_ref ?? preset.backgroundPaletteRef;
let bgRef = null;
@@ -988,7 +986,6 @@ document.addEventListener('DOMContentLoaded', () => {
brightness: presetBrightnessInput ? parseInt(presetBrightnessInput.value, 10) || 0 : 0,
delay: presetDelayInput ? parseInt(presetDelayInput.value, 10) || 0 : 0,
fade: presetFadeInput ? Math.max(0, Math.min(10000, parseInt(presetFadeInput.value, 10) || 0)) : 0,
beat_time: !!(presetBeatTimeInput && presetBeatTimeInput.checked),
background: presetBackgroundInput ? presetBackgroundInput.value : '#000000',
background_palette_ref: currentBackgroundPaletteRef != null ? currentBackgroundPaletteRef : null,
auto: presetManualModeInput ? !presetManualModeInput.checked : true,
@@ -2008,6 +2005,9 @@ const sendPresetViaEspNow = async (
n5: coercePresetInt(preset.n5),
n6: presetWireN6(preset),
manual_beat_n: coerceManualBeatN(preset),
// Always sent: a driver applies a preset over the one it runs, so a missing fade would carry over
fade: Math.max(0, Math.min(10000, Number(preset.fade ?? preset.f) || 0)),
beat_time: preset.beat_time === true || preset.tb === true || preset.tb === 1,
},
},
};
@@ -2142,6 +2142,18 @@ async function sendZonePresetSelection(zoneId, tabData, presetId, preset, allPre
? await zm.resolveDeviceNamesForZonePreset(tabData, pid)
: [];
const groupIds = zoneGroupIdsFromTabData(tabData);
// Tell the controller first: a looping preset takes over the zone from a looping sequence, and a
// one-shot sequence goes back to this preset when it ends. The drivers get it from the push below.
try {
await fetch(`/zones/${encodeURIComponent(String(zoneId))}/play`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
body: JSON.stringify({ preset_id: pid, drivers: false }),
});
} catch (e) {
console.warn('zone play:', e);
}
document.querySelectorAll('#presets-list-zone .sequence-tile-main.active').forEach((b) => b.classList.remove('active'));
await sendPresetViaEspNow(pid, body, names, false, false, '2', {
select: true,
groupIds,