/* * SPDX-License-Identifier: Apache-2.0 * * ESP-NOW link to led-controller: the 0x4C wire protocol the MicroPython drivers speak. The driver announces * itself at boot, takes the controller's reliable messages (acked, reassembled, deduplicated, resynced by * digest), answers pings, and passes everything else to ctrl_msg. Beats set the tempo (beat_sync). */ #pragma once #include #include "esp_err.h" typedef struct { bool running; uint8_t channel; bool master_seen; uint8_t master[6]; uint32_t msgs; // reliable messages delivered uint32_t dups; // duplicate fragments of a message already delivered uint32_t acks; uint32_t resyncs; uint32_t pings; uint32_t beats; uint32_t dropped; // frames lost to a full inbox uint32_t frames; // every ESP-NOW frame the radio delivered uint32_t sent; uint32_t send_fail; uint16_t ver; // state version of the last committed message } espnow_stats_t; /** @brief Start ESP-NOW and the link task, if enabled in settings. Call after net_start(). */ esp_err_t espnow_link_start(void); /** @brief One pass of the link without waiting: the received frames, then the timed sends. The link task runs it * in a loop; a build without that task (the browser simulator) calls it from a timer. */ void espnow_link_poll(void); /** @brief Copy the link's counters and state. */ void espnow_link_stats(espnow_stats_t *out);