#pragma once #include #include #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);