Channel 11 defaults, ESP-NOW driver config and rig/desktop updates
Moves the controller, bridge and led-driver default ESP-NOW channel to 11 and updates the led-driver and led-tool submodule pointers. Includes the rest of the working tree: web UI, desktop and sim-controller changes, API and bridge code, graphify output, and the .gitea and fixture-driver folders. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
35207a868a
commit
edf35e9c71
280 files changed
+24043
-1756
No files matched your search
@@ -3,12 +3,17 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#else
|
||||
#define EMSCRIPTEN_KEEPALIVE
|
||||
#endif
|
||||
|
||||
#include "esp_mac.h"
|
||||
#include "esp_now.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "settings.h"
|
||||
#include "sim.h"
|
||||
|
||||
static esp_now_recv_cb_t s_cb;
|
||||
static bool s_init;
|
||||
@@ -54,10 +59,15 @@ esp_err_t esp_now_send(const uint8_t *mac, const uint8_t *data, size_t len)
|
||||
if (!buf) return ESP_ERR_ESPNOW_NO_MEM;
|
||||
memcpy(buf, mac, 6);
|
||||
memcpy(buf + 6, data, len);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
MAIN_THREAD_ASYNC_EM_ASM({
|
||||
if (Module.simTx) Module.simTx(HEAPU8.slice($0, $0 + $1));
|
||||
_free($0);
|
||||
}, buf, (int)(6 + len));
|
||||
#else
|
||||
sim_host_tx(buf, 6 + len);
|
||||
free(buf);
|
||||
#endif
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "cJSON.h"
|
||||
#include "nvs.h"
|
||||
@@ -145,11 +147,16 @@ esp_err_t nvs_commit(nvs_handle_t h)
|
||||
json = sim_nvs_dump();
|
||||
}
|
||||
if (json) {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// The page saves it; the main runtime thread frees the copy once the hook has run
|
||||
MAIN_THREAD_ASYNC_EM_ASM({
|
||||
if (Module.simFlash) Module.simFlash(UTF8ToString($0));
|
||||
_free($0);
|
||||
}, json);
|
||||
#else
|
||||
sim_host_flash(json);
|
||||
free(json);
|
||||
#endif
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,16 @@ int sim_nvs_load(const char *json);
|
||||
/** The NVS store as JSON. The caller frees it. */
|
||||
char *sim_nvs_dump(void);
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
/* The native build (fixture-driver/) instead of the page's hooks */
|
||||
/** A frame the driver sends: dest MAC (6) + packet */
|
||||
void sim_host_tx(const uint8_t *frame, size_t len);
|
||||
/** The driver committed its flash: the whole store as JSON (sim_nvs_dump) */
|
||||
void sim_host_flash(const char *json);
|
||||
/** esp_restart(): does not return */
|
||||
void sim_host_restart(void);
|
||||
#endif
|
||||
|
||||
/** Copy the strip's last written frame (RGB, pixel 0 first) into out. Returns the LED count. */
|
||||
int sim_frame(uint8_t *out, int cap);
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_mac.h"
|
||||
@@ -76,7 +78,11 @@ void esp_log_write(esp_log_level_t level, const char *tag, const char *fmt, ...)
|
||||
va_start(args, fmt);
|
||||
vsnprintf(text, sizeof(text), fmt, args);
|
||||
va_end(args);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
printf("%c (%u) %s: %s\n", letters[level], esp_log_timestamp(), tag, text);
|
||||
#else
|
||||
fprintf(stderr, "%c (%u) %s: %s\n", letters[level], esp_log_timestamp(), tag, text); // stdout is the pipe
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *esp_err_to_name(esp_err_t code)
|
||||
@@ -148,9 +154,13 @@ uint32_t esp_get_minimum_free_heap_size(void)
|
||||
void esp_restart(void)
|
||||
{
|
||||
// The page terminates this worker and boots a fresh one with the flash the driver last committed
|
||||
#ifdef __EMSCRIPTEN__
|
||||
MAIN_THREAD_ASYNC_EM_ASM({
|
||||
if (Module.simRestart) Module.simRestart();
|
||||
});
|
||||
#else
|
||||
sim_host_restart();
|
||||
#endif
|
||||
for (;;) {
|
||||
usleep(1000000);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user