The rig sim receives Art-Net (UDP 6454, answers ArtPoll) and DDP (each port the room's DDP strips use) in sim_net.c and passes changed universes and pixels to the page over /sim/ws, now with a kind byte in front of each binary frame. Rooms gain fixture types: ddp strips, artnet pixel strips, and artnet cans and movers that read named channels from the room's dmx_definitions (the qlcplus stage map's format). Overlapping DMX channels are refused. Cans and movers are decoded and drawn as in the qlcplus stage simulator (dmx.js, dmx-draw.js). In Edit mode: pick a type to add, edit port/offset/universe/address/colour order/definition, see a can's or mover's live channels, make a controller output aimed at the sim and send its test. The room dialog lists DMX definitions, with presets, a channel editor, and .qxf and stage map import. GET /sim/api/dmx shows what the receiver has had. Tests: test/api/test_sim_net.py and test/browser/dmx_decode.test.mjs. 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", "dmx.js", "dmx-draw.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
|