Files
ESP32-S3-LCD-1.3/include/modules/espnow_receiver.h
T
julian 5fe313b7fa Link protocol v2 receiver, ESP-NOW leg, Patrol gauge outputs, gear pulse
- protocol header v2 copied byte-identical from the 5B repo
- uart_receiver: processFrame() shared by the UART framing task and ESP-NOW,
  version check, dedupe on packet_id+timestamp, per-transport liveness,
  CONFIG cache with sequence number
- espnow_receiver: STA mode, channel hopping while silent, locks on frames
- gauge_outputs: tach on IO7 (LEDC ch2, 14-bit), coolant PWM on IO8 (LEDC
  ch4, 8-bit), config cached in NVS, overrides applied but not saved
- main: gear label from lever + engaged/target (pulses while shifting, red on
  mismatch), icons driven by A's alert bits, gauge update at 5 Hz, link stats
- wiki: temp_stage.cfd (user's old CANNY program) decoded as prior art;
  controller-link, link-redundancy, patrol-gauge-outputs, open-questions
  updated with the bench-verified v2 results and calibration procedure

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-21 19:12:38 +02:00

37 lines
877 B
C++

/**
* ESP-NOW Receiver Module (Controller B)
*
* Wireless leg of the A -> B link. Frames are byte-identical to the UART ones
* and are handed to UARTReceiver::processFrame(), which dedupes on packet_id.
*
* Channel discovery: A transmits on ESPNOW_CHANNEL unless it is associated to
* an access point. B listens on ESPNOW_CHANNEL first and, while it hears
* nothing, hops through channels 1..13 until frames arrive, then locks.
*/
#ifndef ESPNOW_RECEIVER_H
#define ESPNOW_RECEIVER_H
#include <Arduino.h>
namespace EspNowReceiver {
/**
* Bring the radio up in STA mode and register the receive callback.
* @return true if ESP-NOW is listening
*/
bool init();
/**
* Channel-hopping housekeeping. Call from loop().
*/
void tick();
bool isReady();
uint8_t currentChannel();
uint32_t framesReceived();
} // namespace EspNowReceiver
#endif // ESPNOW_RECEIVER_H