Files
powerpods/main/esp_now_core.h
T
skrueckenandCursor 178ab46cec Make controller input best-effort and harden OTA rollback.
Accel/tap use fire-and-forget ESP-NOW with a 10 ms FreeRTOS-safe cadence, OTA recovers from seq gaps and auto-reboots after success, and bootloader app rollback confirms after a stable boot.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-01 22:16:28 +01:00

45 lines
1.7 KiB
C

#ifndef ESP_NOW_CORE_H
#define ESP_NOW_CORE_H
#include "app_config.h"
#include "esp_err.h"
#include "esp_now_messages.pb.h"
#include <stdbool.h>
#include <stdint.h>
void esp_now_core_store_config(const app_config_t *config);
const app_config_t *esp_now_core_get_config(void);
bool esp_now_core_is_master(void);
uint8_t esp_now_core_network(void);
uint8_t esp_now_core_wifi_channel(void);
const uint8_t *esp_now_core_own_mac(void);
uint32_t esp_now_core_now_ms(void);
bool esp_now_core_mac_equal(const uint8_t *a, const uint8_t *b);
void esp_now_core_mac_to_str(const uint8_t *mac, char *out, size_t out_len);
esp_err_t esp_now_core_ensure_peer(const uint8_t *mac);
esp_err_t esp_now_core_ensure_broadcast_peer(void);
esp_err_t esp_now_core_send(const uint8_t *dest_mac,
const alox_EspNowMessage *msg);
/** Like send but does not wait for esp_now send-done (lower latency). */
esp_err_t esp_now_core_send_fast(const uint8_t *dest_mac,
const alox_EspNowMessage *msg);
/**
* Fire-and-forget without failure logs — for high-rate gaming input
* (accel/tap) where drops are expected under load.
*/
esp_err_t esp_now_core_send_best_effort(const uint8_t *dest_mac,
const alox_EspNowMessage *msg);
esp_err_t esp_now_core_send_wait(const uint8_t *dest_mac,
const alox_EspNowMessage *msg);
/** OTA payloads: wait for send-done with extra NO_MEM backoff (queue drain). */
esp_err_t esp_now_core_send_reliable(const uint8_t *dest_mac,
const alox_EspNowMessage *msg);
esp_err_t esp_now_core_init_radio(uint8_t channel);
void esp_now_core_init_send_done(void);
#endif