feat: simulator bridge, rig seed and web UI (in progress)

Work in progress from the same tree as the controller's sequences-v2 changes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-11 14:10:55 +13:00
1 parent 4fc3345fc9
commit 4d8aeb5df8
26 files changed
+3907 -288

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
"""Boot one simulated led-driver inside Pyodide (run by web/driver-worker.js).
The worker has already written the strip's flash into ``LED_SIM_FLASH``
(``led-driver/src`` including ``patterns/``, plus this strip's
``settings.json`` and ``presets.json``) and the stubs into ``LED_SIM_STUBS``.
This then runs the real ``main.py`` as ``__main__``, as the board does at
power-on: settings, presets, startup preset, ESP-NOW hello, main loop.
"""
import gc
import os
import runpy
import sys
import time
def boot():
flash = os.environ.get("LED_SIM_FLASH", "/flash")
stubs = os.environ.get("LED_SIM_STUBS", "/stubs")
# Stubs replace the hardware modules; the flash root plays the device's
# "/" (cwd), where main.py, settings.json, presets.json and patterns/ live.
for p in (flash, stubs):
while p in sys.path:
sys.path.remove(p)
sys.path[:0] = [stubs, flash]
os.chdir(flash)
import _simlink
# No threads and no event loop turns while main.py runs: sleeps block on
# Atomics.wait, and the ping-reply "thread" runs from the main loop.
time.sleep = _simlink.real_sleep
import _thread
_thread.start_new_thread = _simlink.start_new_thread
if not hasattr(gc, "mem_free"):
gc.mem_free = lambda: 256 * 1024
gc.mem_alloc = lambda: 64 * 1024
import settings as led_settings
led_settings.Settings.SETTINGS_FILE = flash.rstrip("/") + "/settings.json"
runpy.run_path(flash.rstrip("/") + "/main.py", run_name="__main__")
boot()