|
|
@ -1,5 +1,6 @@ |
|
|
#include "ESPNOWRadio.h" |
|
|
#include "ESPNOWRadio.h" |
|
|
#include <esp_now.h> |
|
|
#include <esp_now.h> |
|
|
|
|
|
#include <esp_mac.h> |
|
|
#include <WiFi.h> |
|
|
#include <WiFi.h> |
|
|
#include <esp_wifi.h> |
|
|
#include <esp_wifi.h> |
|
|
|
|
|
|
|
|
@ -11,12 +12,20 @@ static uint8_t rx_buf[256]; |
|
|
static uint8_t last_rx_len = 0; |
|
|
static uint8_t last_rx_len = 0; |
|
|
|
|
|
|
|
|
// callback when data is sent
|
|
|
// callback when data is sent
|
|
|
|
|
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 5, 0) |
|
|
|
|
|
static void OnDataSent(const esp_now_send_info_t *tx_info, esp_now_send_status_t status) { |
|
|
|
|
|
#else |
|
|
static void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { |
|
|
static void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) { |
|
|
|
|
|
#endif |
|
|
is_send_complete = true; |
|
|
is_send_complete = true; |
|
|
ESPNOW_DEBUG_PRINTLN("Send Status: %d", (int)status); |
|
|
ESPNOW_DEBUG_PRINTLN("Send Status: %d", (int)status); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) |
|
|
|
|
|
static void OnDataRecv(const esp_now_recv_info_t *info, const uint8_t *data, int len) { |
|
|
|
|
|
#else |
|
|
static void OnDataRecv(const uint8_t *mac, const uint8_t *data, int len) { |
|
|
static void OnDataRecv(const uint8_t *mac, const uint8_t *data, int len) { |
|
|
|
|
|
#endif |
|
|
ESPNOW_DEBUG_PRINTLN("Recv: len = %d", len); |
|
|
ESPNOW_DEBUG_PRINTLN("Recv: len = %d", len); |
|
|
memcpy(rx_buf, data, len); |
|
|
memcpy(rx_buf, data, len); |
|
|
last_rx_len = len; |
|
|
last_rx_len = len; |
|
|
|