- 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>
30 lines
1.4 KiB
Bash
Executable File
30 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Pack the simulated rig's page (led-simulator/web) and the drivers built to WebAssembly (led-simulator/web/wasm,
|
|
# from `make sim-wasm`) into www_dist/sim.pack, which the host builds embed and serve at /sim/
|
|
# (sim-controller/components/sim/sim_rig.c). Same format as www.pack: "WWW1", then per file u16 name length,
|
|
# u32 data length, name, gzipped data; a zero name length ends it.
|
|
# Without the wasm the pack is empty, and /sim/ says how to build it.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
SRC=led-simulator/web
|
|
OUT=www_dist
|
|
mkdir -p "$OUT"
|
|
python3 - "$SRC" "$OUT/sim.pack" <<'PY'
|
|
import gzip, os, struct, sys
|
|
src, out_path = sys.argv[1], sys.argv[2]
|
|
files = ["index.html", "app.js", "layout.js", "styles.css", "driver-worker.js",
|
|
"gallery.html", "gallery.js", "gallery.css",
|
|
"wasm/led_driver.mjs", "wasm/led_driver.wasm", "wasm/led_fx.mjs", "wasm/led_fx.wasm"]
|
|
out = bytearray(b"WWW1")
|
|
if not os.path.isfile(os.path.join(src, "wasm/led_driver.wasm")):
|
|
print("sim.pack: no drivers built (make sim-wasm): the rig is left out")
|
|
else:
|
|
for name in files:
|
|
data = gzip.compress(open(os.path.join(src, name), "rb").read(), 9, mtime=0)
|
|
out += struct.pack("<HI", len(name), len(data)) + name.encode() + data
|
|
print("sim.pack: %d files" % len(files))
|
|
out += struct.pack("<H", 0)
|
|
open(out_path, "wb").write(out)
|
|
print("sim.pack: %d bytes" % len(out))
|
|
PY
|