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>
28 lines
957 B
C
28 lines
957 B
C
// Host test: pack a preset and a select with envelope.c and print hex
|
|
#include <stdio.h>
|
|
#include "../main/envelope.h"
|
|
|
|
static void hex(const uint8_t *b, size_t n)
|
|
{
|
|
for (size_t i = 0; i < n; i++) printf("%02x", b[i]);
|
|
printf("\n");
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
const char *json =
|
|
"{\"p\":\"chase\",\"c\":[\"#ff0000\",\"#0f8\"],\"d\":120,\"b\":200,\"a\":false,\"n1\":5,\"n2\":-3,\"n3\":0,\"n4\":7,\"n5\":0,\"n6\":300}";
|
|
const char *json2 = "{\"pattern\":\"on\",\"colors\":[\"#102030\"],\"delay\":0,\"brightness\":0,\"auto\":true}";
|
|
cJSON *p = cJSON_Parse(json), *p2 = cJSON_Parse(json2);
|
|
env_blob_t pb, sb;
|
|
uint8_t out[256];
|
|
env_blob_init(&pb); env_blob_init(&sb);
|
|
env_add_preset(&pb, "7", p);
|
|
env_add_preset(&pb, "8", p2);
|
|
env_add_select(&sb, "mirror", "7", -1);
|
|
env_add_select(&sb, "roof", "8", 12);
|
|
hex(out, env_frame(out, 128, &pb, NULL));
|
|
hex(out, env_frame(out, -1, NULL, &sb));
|
|
return 0;
|
|
}
|