11#ifdef ESP_NOW_MAX_DATA_LEN_V2
13#define MY_ESP_NOW_MAX_LEN ESP_NOW_MAX_DATA_LEN_V2
16#define MY_ESP_NOW_MAX_LEN ESP_NOW_MAX_DATA_LEN
22#define MY_ESP_NOW_BUFFER_SIZE (240 * 400)
23#define MY_ESP_NOW_BUFFER_COUNT (MY_ESP_NOW_BUFFER_SIZE / MY_ESP_NOW_MAX_LEN)
53 const char*
ssid =
nullptr;
56#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
70#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
152#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0)
153 LOGI(
"Setting ESP-NEW rate");
155 LOGW(
"Could not set rate");
163 Serial.print(
"channel: ");
172 LOGE(
"esp_now_deinit");
197 LOGE(
"addPeer before begin");
201 LOGI(
"Using broadcast");
207#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
214 LOGW(
"Could not set the ESP-NOW PHY rate (%d) %s.", result,
220 LOGE(
"addPeer: %d", result);
232 peer.encrypt =
false;
244 LOGW(
"Did not add own address as peer");
250 LOGE(
"addPeer - Invalid address: %s", address);
257 template <
size_t size>
260 for (
int j = 0;
j < size;
j++) {
261 const char*
peer = array[
j];
262 if (
peer !=
nullptr) {
275 for (
int j = 0;
j < N;
j++) {
277 if (
peer !=
nullptr) {
301 LOGE(
"Not all Peers seems to be removed.");
317 LOGE(
"write: invalid mac address %s",
peer);
350 "write: failed to send chunk after %d attempts (sent %zu/%zu "
383 if (size == 0)
return 0.0;
415 LOGE(
"Could not set mac address");
425 LOGE(
"Wrong mac address: %s",
addr);
448 LOGE(
"You did not start Wifi or did not provide ssid and password");
499 LOGE(
"Timeout waiting for ACK semaphore after %d retries",
504 LOGW(
"ACK semaphore timeout (attempt %d)", retry_count);
535 LOGE(
"esp_now_send queue error (rc=%d/0x%04X) after %d retries",
rc,
541 LOGW(
"esp_now_send failed (rc=%d/0x%04X) - retrying (attempt %d)",
rc,
560 LOGE(
"Transmission callback timeout after %d retries", retry_count);
564 LOGW(
"Transmission callback timeout (attempt %d)", retry_count);
579 LOGE(
"Transmission failed after %d retries", retry_count);
584 LOGI(
"Transmission failed - retrying (attempt %d)", retry_count);
602 LOGW(
"esp_now_send failed to queue (rc=%d/0x%04X) - retrying (attempt %d)",
603 rc,
rc, retry_count);
606 LOGE(
"Send queue error after %d retries", retry_count);
641 LOGE(
"esp_now_init: %d", result);
644#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0)
669 sscanf(
mac,
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &values[0], &values[1],
670 &values[2], &values[3], &values[4], &values[5]);
677 snprintf(
macStr, 18,
"%02x:%02x:%02x:%02x:%02x:%02x", array[0], array[1],
678 array[2], array[3], array[4], array[5]);
679 return (
const char*)
macStr;
711#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
717 info->rx_ctrl->rssi);
734 LOGD(
"default_send_cb - %s -> %s", this->
mac2str(mac_addr),
748 "Send Error to %s! Status: %d (Possible causes: out of range, "
749 "receiver busy/offline, channel mismatch, or buffer full)",
750 this->
mac2str(mac_addr), status);
758#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:16
#define MY_ESP_NOW_BUFFER_COUNT
Definition ESPNowStream.h:23