13#ifdef ESP_NOW_MAX_DATA_LEN_V2
15#define MY_ESP_NOW_MAX_LEN ESP_NOW_MAX_DATA_LEN_V2
18#define MY_ESP_NOW_MAX_LEN ESP_NOW_MAX_DATA_LEN
24#define MY_ESP_NOW_BUFFER_SIZE (240 * 400)
25#define MY_ESP_NOW_BUFFER_COUNT (MY_ESP_NOW_BUFFER_SIZE / MY_ESP_NOW_MAX_LEN)
55 const char*
ssid =
nullptr;
58#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
72#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
185#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
186 LOGI(
"Setting ESP-NEW rate");
188 LOGW(
"Could not set rate");
203 LOGE(
"esp_now_deinit");
239 LOGE(
"addPeer before begin");
243 LOGI(
"Using broadcast");
249#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
256 LOGW(
"Could not set the ESP-NOW PHY rate (%d) %s.", result,
262 LOGE(
"addPeer: %d", result);
274 peer.encrypt =
false;
286 LOGW(
"Did not add own address as peer");
292 LOGE(
"addPeer - Invalid address: %s", address);
299 template <
size_t size>
302 for (
int j = 0;
j < size;
j++) {
303 const char*
peer = array[
j];
304 if (
peer !=
nullptr) {
317 for (
int j = 0;
j < N;
j++) {
319 if (
peer !=
nullptr) {
343 LOGE(
"Not all Peers seems to be removed.");
359 LOGE(
"write: invalid mac address %s",
peer);
392 "write: failed to send chunk after %d attempts (sent %zu/%zu "
425 if (size == 0)
return 0.0;
457 LOGE(
"Could not set mac address");
467 LOGE(
"Wrong mac address: %s",
addr);
486 LOGE(
"You did not start Wifi or did not provide ssid and password");
501 for (
int i = 0; i < 30; i++) {
511 LOGE(
"You did not start Wifi or did not provide ssid and password");
563 LOGE(
"Timeout waiting for ACK semaphore after %d retries",
568 LOGW(
"ACK semaphore timeout (attempt %d)", retry_count);
599 LOGE(
"esp_now_send queue error (rc=%d/0x%04X) after %d retries",
rc,
605 LOGW(
"esp_now_send failed (rc=%d/0x%04X) - retrying (attempt %d)",
rc,
624 LOGE(
"Transmission callback timeout after %d retries", retry_count);
628 LOGW(
"Transmission callback timeout (attempt %d)", retry_count);
643 LOGE(
"Transmission failed after %d retries", retry_count);
648 LOGI(
"Transmission failed - retrying (attempt %d)", retry_count);
666 LOGW(
"esp_now_send failed to queue (rc=%d/0x%04X) - retrying (attempt %d)",
667 rc,
rc, retry_count);
670 LOGE(
"Send queue error after %d retries", retry_count);
698 LOGE(
"esp_wifi_init: %s (ensure NVS and netif are initialized)",
722 LOGE(
"esp_now_init: %d", result);
725#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
750 sscanf(
mac,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &values[0], &values[1],
751 &values[2], &values[3], &values[4], &values[5]);
758 snprintf(
macStr, 18,
"%02x:%02x:%02x:%02x:%02x:%02x", array[0], array[1],
759 array[2], array[3], array[4], array[5]);
760 return (
const char*)
macStr;
792#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
795 const bool broadcast =
798 info->rx_ctrl->rssi);
815 LOGD(
"default_send_cb - %s -> %s", this->
mac2str(mac_addr),
829 "Send Error to %s! Status: %d (Possible causes: out of range, "
830 "receiver busy/offline, channel mismatch, or buffer full)",
831 this->
mac2str(mac_addr), status);
839#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
#define LOGW(...)
Definition AudioLoggerIDF.h:29
#define TRACED()
Definition AudioLoggerIDF.h:31
#define LOGI(...)
Definition AudioLoggerIDF.h:28
#define LOGD(...)
Definition AudioLoggerIDF.h:27
#define LOGE(...)
Definition AudioLoggerIDF.h:30
#define MY_ESP_NOW_MAX_LEN
Definition ESPNowStream.h:18
#define MY_ESP_NOW_BUFFER_COUNT
Definition ESPNowStream.h:25
#define portMAX_DELAY
Definition QueueZephyr.h:14
#define pdMS_TO_TICKS(ms)
Definition QueueZephyr.h:17
#define pdTRUE
Definition QueueZephyr.h:20
uint32_t TickType_t
Definition QueueZephyr.h:11