New ESP-IDF project in v2/ that replaces the Pi and the UART bridge: - W5500 Ethernet, INMP441 beat/tempo detector (from esp32-eth), ESP-NOW master - LittleFS data store and a JSON API over the Pi's db/*.json collections, with /db import and export; web UI minified and gzipped at build time - Zone play/stop as 0x4C GROUP_CMD, preset push/send as CMD (binary v2 envelope, byte-identical to src/util/binary_envelope.py), sequencer and scenes, driver registration from the boot hello - Reliable bulk link: acks with retransmit, fragments, state-version digest and resync; beat frames sent twice with a lead so drivers fire together - Bench tooling: lossy-link mode, synthetic beats with echo measurement, USB and logic-analyzer latency scripts, and docs/BENCH_TEST.md Needs the matching led-driver changes (p2p branch) to receive the link and beat frames. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include "cJSON.h"
|
|
#include "esp_err.h"
|
|
|
|
// JSON "database": one file per collection under /db, each an object of
|
|
// id -> record, mirroring the Pi's db/*.json. Collections stay in memory and
|
|
// are written back (via a temp file and rename) whenever they change.
|
|
|
|
// Mount the www and db partitions and load every collection
|
|
esp_err_t store_init(void);
|
|
|
|
// Borrowed pointer to the collection object (id -> record); never NULL for a known name
|
|
cJSON *store_coll(const char *name);
|
|
bool store_known(const char *name);
|
|
|
|
// Replace a whole collection with a parsed object (takes ownership) and persist it
|
|
esp_err_t store_replace(const char *name, cJSON *obj);
|
|
esp_err_t store_save(const char *name);
|
|
|
|
// Next numeric string id for a collection ("1" when empty); writes into buf
|
|
void store_next_id(const char *name, char *buf, size_t len);
|
|
|
|
// Settings are one flat object (the "settings" collection itself)
|
|
cJSON *store_settings(void);
|
|
|
|
// Recursive lock around every read or write of the collections (HTTP handlers and the sequencer)
|
|
void store_lock(void);
|
|
void store_unlock(void);
|