Files
led-controller/v2/main/bench.h
T
jimmyandClaude Sonnet 5.5 a94d6a7de5 feat(v2): ESP32-S3 controller with Ethernet, I2S mic beat detection and ESP-NOW
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>
2026-10-27 17:15:28 +13:00

25 lines
916 B
C

#pragma once
#include <stdbool.h>
#include <stdint.h>
#include "cJSON.h"
#include "esp_err.h"
// Bench-test helpers: a synthetic beat generator, an echo-based latency and
// delivery measurement, and the optional GPIO marker for a logic analyzer.
// Called by espnow_tx for every beat (first copy time, and how long drivers wait before firing)
void bench_on_beat_tx(uint16_t idx, int64_t tx_us, int fire_in_ms);
// A driver echoed beat `idx` right after it fired (called from the Wi-Fi task)
void bench_on_echo(const uint8_t mac[6], uint16_t idx, int64_t rx_us);
// Send `count` synthetic beats at `bpm` (count 0 = until stopped); resets the results
esp_err_t bench_start(float bpm, int count);
void bench_stop(void);
// True while the synthetic generator runs; mic beats are muted meanwhile so they cannot mix in
bool bench_running(void);
// Results so far; caller owns the object
cJSON *bench_results(void);