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:
1 parent
698c1463c0
commit
581b751904
506 files changed
+42336
-3599
No files matched your search
+22
-18
@@ -2,8 +2,9 @@ import pytest
|
||||
|
||||
# Test MACs from v1; no real driver has them
|
||||
ESPNOW_MAC = "aabbccddeeff"
|
||||
WIFI_MAC = "102030405060"
|
||||
WIFI_MAC2 = "102030405061"
|
||||
# Wi-Fi drivers are keyed by their mDNS hostname (12 characters or fewer), not a MAC
|
||||
WIFI_ID = "pytest-drv"
|
||||
WIFI_ID2 = "pytest-drv2"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -17,12 +18,12 @@ def espnow_dev(c):
|
||||
|
||||
@pytest.fixture
|
||||
def wifi_dev(c):
|
||||
c.delete(f"/devices/{WIFI_MAC}")
|
||||
c.delete(f"/devices/{WIFI_ID}")
|
||||
resp = c.post("/devices", json={"name": "pytest-wifi", "type": "led", "transport": "wifi",
|
||||
"address": "192.168.50.10", "mac": WIFI_MAC})
|
||||
"address": WIFI_ID})
|
||||
assert resp.status_code == 201, resp.text
|
||||
yield resp
|
||||
c.delete(f"/devices/{WIFI_MAC}")
|
||||
c.delete(f"/devices/{WIFI_ID}")
|
||||
|
||||
|
||||
def test_list(c):
|
||||
@@ -55,28 +56,31 @@ def test_get_espnow_has_no_connection_state(c, espnow_dev):
|
||||
|
||||
|
||||
def test_create_wifi(c, wifi_dev):
|
||||
rec = wifi_dev.json()[WIFI_MAC]
|
||||
rec = wifi_dev.json()[WIFI_ID]
|
||||
assert rec["transport"] == "wifi"
|
||||
assert rec["address"] == "192.168.50.10"
|
||||
assert c.get(f"/devices/{WIFI_MAC}").json().get("connected") is False
|
||||
assert rec["id"] == WIFI_ID
|
||||
assert rec["address"] == f"{WIFI_ID}.local"
|
||||
assert c.get(f"/devices/{WIFI_ID}").json().get("connected") is False
|
||||
|
||||
|
||||
def test_create_second_wifi_same_name(c, wifi_dev):
|
||||
resp = c.post("/devices", json={"name": "pytest-wifi", "transport": "wifi",
|
||||
"address": "192.168.50.11", "mac": WIFI_MAC2})
|
||||
resp = c.post("/devices", json={"name": "pytest-wifi", "transport": "wifi", "address": WIFI_ID2})
|
||||
assert resp.status_code == 201
|
||||
assert resp.json()[WIFI_MAC2]["name"] == "pytest-wifi"
|
||||
assert c.delete(f"/devices/{WIFI_MAC2}").status_code == 200
|
||||
assert resp.json()[WIFI_ID2]["name"] == "pytest-wifi"
|
||||
assert c.delete(f"/devices/{WIFI_ID2}").status_code == 200
|
||||
|
||||
|
||||
def test_create_duplicate_mac(c, wifi_dev):
|
||||
resp = c.post("/devices", json={"name": "pytest-wifi-dupmac", "transport": "wifi",
|
||||
"address": "192.168.50.99", "mac": WIFI_MAC})
|
||||
resp = c.post("/devices", json={"name": "pytest-wifi-dupmac", "transport": "wifi", "address": WIFI_ID})
|
||||
assert resp.status_code == 409
|
||||
|
||||
|
||||
def test_create_wifi_requires_mac(c):
|
||||
resp = c.post("/devices", json={"name": "no-mac-wifi", "transport": "wifi", "address": "192.168.50.12"})
|
||||
def test_create_wifi_requires_hostname(c):
|
||||
assert c.post("/devices", json={"name": "no-host-wifi", "transport": "wifi"}).status_code == 400
|
||||
|
||||
|
||||
def test_create_wifi_rejects_ip_address(c):
|
||||
resp = c.post("/devices", json={"name": "ip-wifi", "transport": "wifi", "address": "192.168.50.12"})
|
||||
assert resp.status_code == 400
|
||||
|
||||
|
||||
@@ -89,8 +93,8 @@ def test_rename_blank(c, espnow_dev):
|
||||
|
||||
|
||||
def test_rename(c, espnow_dev, wifi_dev):
|
||||
for mac in (ESPNOW_MAC, WIFI_MAC):
|
||||
resp = c.put(f"/devices/{mac}", json={"name": "renamed"})
|
||||
for dev in (ESPNOW_MAC, WIFI_ID):
|
||||
resp = c.put(f"/devices/{dev}", json={"name": "renamed"})
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["name"] == "renamed"
|
||||
|
||||
|
||||
Reference in new issue
Block a user