- 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>
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
// Host build: what the board's hardware files (mic.c, ota.c, littlefs) provide, without hardware
|
|
#include <string.h>
|
|
#include <sys/stat.h>
|
|
#include "esp_littlefs.h"
|
|
#include "esp_log.h"
|
|
#include "beat.h"
|
|
#include "mic.h"
|
|
#include "ota.h"
|
|
|
|
esp_err_t esp_vfs_littlefs_register(const esp_vfs_littlefs_conf_t *conf)
|
|
{
|
|
mkdir(conf->base_path, 0755);
|
|
return ESP_OK;
|
|
}
|
|
|
|
#ifndef LED_DESKTOP_ALSA
|
|
// No microphone: audio stays stopped, so the simulated-BPM clock times sequences
|
|
esp_err_t mic_start(void)
|
|
{
|
|
return beat_start(MIC_SAMPLE_RATE); // never fed: no beats detected, the BPM clock stands in
|
|
}
|
|
|
|
void mic_get_level(mic_level_t *out)
|
|
{
|
|
out->rms_dbfs = -120;
|
|
out->peak_dbfs = -120;
|
|
out->spl_db = 0;
|
|
}
|
|
|
|
esp_err_t mic_stream_open(void)
|
|
{
|
|
return ESP_ERR_NOT_SUPPORTED;
|
|
}
|
|
|
|
size_t mic_stream_read(void *buf, size_t len, TickType_t timeout)
|
|
{
|
|
(void)buf;
|
|
(void)len;
|
|
vTaskDelay(timeout ? timeout : 1);
|
|
return 0;
|
|
}
|
|
|
|
void mic_stream_close(void)
|
|
{
|
|
}
|
|
|
|
#endif // LED_DESKTOP_ALSA
|
|
|
|
void ota_confirm_later(void)
|
|
{
|
|
}
|
|
|
|
static esp_err_t ota_unsupported(httpd_req_t *req)
|
|
{
|
|
httpd_resp_set_status(req, "501 Not Implemented");
|
|
httpd_resp_set_type(req, "application/json");
|
|
return httpd_resp_sendstr(req, "{\"error\":\"firmware OTA is not available in the simulator\"}");
|
|
}
|
|
|
|
esp_err_t ota_register(httpd_handle_t server)
|
|
{
|
|
const httpd_uri_t u = { .uri = "/ota", .method = HTTP_POST, .handler = ota_unsupported };
|
|
return httpd_register_uri_handler(server, &u);
|
|
}
|