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
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* led-controller as a desktop program: the firmware's app_main (sim-controller/components/sim/sim_main.c)
|
||||
* with its settings from the command line or the environment. No ESP-IDF is needed to build or run it.
|
||||
*
|
||||
* led-controller [--db DIR] [--port N]
|
||||
*
|
||||
* The bridges (the USB bridge board, /dev/ttyACM1, or host:port over UDP such as led-simulator) are kept in
|
||||
* the store's settings: set them in the web UI under Settings > Network > Bridges. The environment works
|
||||
* too: LED_CONTROLLER_DB, LED_CONTROLLER_HTTP_PORT. Without a bridge the program runs, but its ESP-NOW frames
|
||||
* go nowhere.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void app_main(void);
|
||||
|
||||
static void set_from_env(const char *from, const char *to)
|
||||
{
|
||||
const char *v = getenv(from);
|
||||
if (v && v[0] && !(getenv(to) && getenv(to)[0])) {
|
||||
setenv(to, v, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void usage(FILE *out)
|
||||
{
|
||||
fprintf(out,
|
||||
"usage: led-controller [--db DIR] [--port N]\n"
|
||||
" --db DIR store directory (default /db)\n"
|
||||
" --port N web UI and API port (default 8080)\n"
|
||||
" bridges are set in the web UI (Settings > Network > Bridges)\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
for (int i = 1; i < argc; i++) {
|
||||
const char *a = argv[i];
|
||||
if (!strcmp(a, "-h") || !strcmp(a, "--help")) {
|
||||
usage(stdout);
|
||||
return 0;
|
||||
}
|
||||
if ((!strcmp(a, "--db") || !strcmp(a, "--port")) && i + 1 < argc) {
|
||||
const char *val = argv[++i];
|
||||
setenv(!strcmp(a, "--db") ? "LED_SIM_DB" : "LED_SIM_HTTP_PORT", val, 1);
|
||||
continue;
|
||||
}
|
||||
fprintf(stderr, "led-controller: unknown option %s\n", a);
|
||||
usage(stderr);
|
||||
return 2;
|
||||
}
|
||||
set_from_env("LED_CONTROLLER_DB", "LED_SIM_DB");
|
||||
set_from_env("LED_CONTROLLER_HTTP_PORT", "LED_SIM_HTTP_PORT");
|
||||
app_main(); // runs until the process is stopped
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user