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,3 @@
|
||||
/* sim-driver: GPIO numbers only (the strip's data pin is a setting with no effect here). */
|
||||
#pragma once
|
||||
typedef int gpio_num_t;
|
||||
@@ -0,0 +1,3 @@
|
||||
/* sim-driver: see driver/rmt_tx.h */
|
||||
#pragma once
|
||||
typedef struct rmt_encoder_t *rmt_encoder_handle_t;
|
||||
@@ -0,0 +1,6 @@
|
||||
/* sim-driver: the RMT types ws2812.h names; src/ws2812_sim.cpp never uses them. */
|
||||
#pragma once
|
||||
typedef struct rmt_channel_t *rmt_channel_handle_t;
|
||||
typedef struct {
|
||||
int loop_count;
|
||||
} rmt_transmit_config_t;
|
||||
@@ -0,0 +1,50 @@
|
||||
/* sim-driver: ESP-NOW goes to the page (src/espnow_sim.cpp), which is the radio between strips and the bridge. */
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_NOW_ETH_ALEN 6
|
||||
#define ESP_NOW_MAX_DATA_LEN 250
|
||||
#define ESP_ERR_ESPNOW_BASE 0x3066
|
||||
#define ESP_ERR_ESPNOW_NOT_INIT (ESP_ERR_ESPNOW_BASE + 1)
|
||||
#define ESP_ERR_ESPNOW_ARG (ESP_ERR_ESPNOW_BASE + 2)
|
||||
#define ESP_ERR_ESPNOW_NO_MEM (ESP_ERR_ESPNOW_BASE + 3)
|
||||
#define ESP_ERR_ESPNOW_FULL (ESP_ERR_ESPNOW_BASE + 4)
|
||||
#define ESP_ERR_ESPNOW_NOT_FOUND (ESP_ERR_ESPNOW_BASE + 5)
|
||||
#define ESP_ERR_ESPNOW_INTERNAL (ESP_ERR_ESPNOW_BASE + 6)
|
||||
#define ESP_ERR_ESPNOW_EXIST (ESP_ERR_ESPNOW_BASE + 7)
|
||||
|
||||
typedef struct {
|
||||
uint8_t peer_addr[ESP_NOW_ETH_ALEN];
|
||||
uint8_t lmk[16];
|
||||
uint8_t channel;
|
||||
wifi_interface_t ifidx;
|
||||
bool encrypt;
|
||||
void *priv;
|
||||
} esp_now_peer_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t *src_addr;
|
||||
uint8_t *des_addr;
|
||||
void *rx_ctrl;
|
||||
} esp_now_recv_info_t;
|
||||
|
||||
typedef void (*esp_now_recv_cb_t)(const esp_now_recv_info_t *info, const uint8_t *data, int len);
|
||||
|
||||
esp_err_t esp_now_init(void);
|
||||
esp_err_t esp_now_deinit(void);
|
||||
esp_err_t esp_now_register_recv_cb(esp_now_recv_cb_t cb);
|
||||
esp_err_t esp_now_add_peer(const esp_now_peer_info_t *peer);
|
||||
bool esp_now_is_peer_exist(const uint8_t *mac);
|
||||
esp_err_t esp_now_send(const uint8_t *mac, const uint8_t *data, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,19 @@
|
||||
/* sim-driver: the radio is always up, on the channel from the strip's settings. */
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum { WIFI_IF_STA = 0, WIFI_IF_AP = 1 } wifi_interface_t;
|
||||
typedef enum { WIFI_SECOND_CHAN_NONE = 0, WIFI_SECOND_CHAN_ABOVE, WIFI_SECOND_CHAN_BELOW } wifi_second_chan_t;
|
||||
typedef enum { WIFI_MODE_NULL = 0, WIFI_MODE_STA, WIFI_MODE_AP, WIFI_MODE_APSTA } wifi_mode_t;
|
||||
|
||||
esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
/* sim-driver: the Wi-Fi types net.h names (net.cpp itself is not built: the rig has no Wi-Fi). */
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
typedef struct {
|
||||
uint8_t bssid[6];
|
||||
uint8_t ssid[33];
|
||||
uint8_t primary;
|
||||
int8_t rssi;
|
||||
int authmode;
|
||||
} wifi_ap_record_t;
|
||||
@@ -0,0 +1,47 @@
|
||||
/* sim-driver: NVS in memory (src/nvs_sim.cpp). The store is loaded from JSON at boot and handed back
|
||||
* to the page on every commit, which keeps it as the strip's flash. */
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ESP_ERR_NVS_BASE 0x1100
|
||||
#define ESP_ERR_NVS_NOT_INITIALIZED (ESP_ERR_NVS_BASE + 0x01)
|
||||
#define ESP_ERR_NVS_NOT_FOUND (ESP_ERR_NVS_BASE + 0x02)
|
||||
#define ESP_ERR_NVS_TYPE_MISMATCH (ESP_ERR_NVS_BASE + 0x03)
|
||||
#define ESP_ERR_NVS_READ_ONLY (ESP_ERR_NVS_BASE + 0x04)
|
||||
#define ESP_ERR_NVS_INVALID_HANDLE (ESP_ERR_NVS_BASE + 0x07)
|
||||
#define ESP_ERR_NVS_INVALID_LENGTH (ESP_ERR_NVS_BASE + 0x0c)
|
||||
#define ESP_ERR_NVS_NO_FREE_PAGES (ESP_ERR_NVS_BASE + 0x0d)
|
||||
#define ESP_ERR_NVS_NEW_VERSION_FOUND (ESP_ERR_NVS_BASE + 0x10)
|
||||
|
||||
typedef uint32_t nvs_handle_t;
|
||||
typedef enum { NVS_READONLY, NVS_READWRITE } nvs_open_mode_t;
|
||||
|
||||
esp_err_t nvs_open(const char *ns, nvs_open_mode_t mode, nvs_handle_t *out);
|
||||
void nvs_close(nvs_handle_t h);
|
||||
esp_err_t nvs_commit(nvs_handle_t h);
|
||||
esp_err_t nvs_erase_key(nvs_handle_t h, const char *key);
|
||||
esp_err_t nvs_erase_all(nvs_handle_t h);
|
||||
|
||||
esp_err_t nvs_set_str(nvs_handle_t h, const char *key, const char *value);
|
||||
esp_err_t nvs_get_str(nvs_handle_t h, const char *key, char *out, size_t *len);
|
||||
esp_err_t nvs_set_blob(nvs_handle_t h, const char *key, const void *value, size_t len);
|
||||
esp_err_t nvs_get_blob(nvs_handle_t h, const char *key, void *out, size_t *len);
|
||||
esp_err_t nvs_set_u8(nvs_handle_t h, const char *key, uint8_t v);
|
||||
esp_err_t nvs_get_u8(nvs_handle_t h, const char *key, uint8_t *v);
|
||||
esp_err_t nvs_set_i32(nvs_handle_t h, const char *key, int32_t v);
|
||||
esp_err_t nvs_get_i32(nvs_handle_t h, const char *key, int32_t *v);
|
||||
esp_err_t nvs_set_u32(nvs_handle_t h, const char *key, uint32_t v);
|
||||
esp_err_t nvs_get_u32(nvs_handle_t h, const char *key, uint32_t *v);
|
||||
esp_err_t nvs_set_i64(nvs_handle_t h, const char *key, int64_t v);
|
||||
esp_err_t nvs_get_i64(nvs_handle_t h, const char *key, int64_t *v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
/* sim-driver: flash init is a no-op; the NVS store is loaded by sim_boot(). */
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "nvs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
esp_err_t nvs_flash_init(void);
|
||||
esp_err_t nvs_flash_erase(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
/* sim-driver: force-included into every C++ source (the driver's and src/'s).
|
||||
*
|
||||
* - The desktop port's headers (desktop/port/include) were written for C and have no extern "C" guards, so they
|
||||
* are included here once inside extern "C"; their #pragma once makes the sources' own includes no-ops.
|
||||
* The C library headers they use come first, outside the block, so the C++ library's versions stay intact.
|
||||
* - On the board ESP-IDF's headers also bring in stdio and esp_system, which the driver relies on.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
extern "C" {
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_mac.h"
|
||||
#include "esp_random.h"
|
||||
#include "esp_rom_sys.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_timer.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/queue.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "freertos/task.h"
|
||||
}
|
||||
Reference in new issue
Block a user