feat: esp-idf v5.5 support
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
## Tested on
|
## Tested on
|
||||||
|
|
||||||
1. [ESP8266 RTOS_SDK v3.4](https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/index.html#)
|
1. [ESP8266 RTOS_SDK v3.4](https://docs.espressif.com/projects/esp8266-rtos-sdk/en/latest/index.html#)
|
||||||
2. [ESP32 ESP-IDF v5.4](https://docs.espressif.com/projects/esp-idf/en/release-v5.4/esp32/index.html)
|
2. [ESP32 ESP-IDF v5.5](https://docs.espressif.com/projects/esp-idf/en/release-v5.5/esp32/index.html)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
1.8.0
|
1.9.0
|
23
zh_espnow.c
23
zh_espnow.c
@ -48,7 +48,12 @@ static esp_err_t _zh_espnow_init_resources(const zh_espnow_init_config_t *config
|
|||||||
static esp_err_t _zh_espnow_validate_config(const zh_espnow_init_config_t *config);
|
static esp_err_t _zh_espnow_validate_config(const zh_espnow_init_config_t *config);
|
||||||
static esp_err_t _zh_espnow_register_callbacks(bool battery_mode);
|
static esp_err_t _zh_espnow_register_callbacks(bool battery_mode);
|
||||||
static esp_err_t _zh_espnow_create_task(const zh_espnow_init_config_t *config);
|
static esp_err_t _zh_espnow_create_task(const zh_espnow_init_config_t *config);
|
||||||
|
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 5 && ESP_IDF_VERSION_MINOR >= 5
|
||||||
|
static void _zh_espnow_send_cb(const esp_now_send_info_t *esp_now_info, esp_now_send_status_t status);
|
||||||
|
#else
|
||||||
static void _zh_espnow_send_cb(const uint8_t *mac_addr, esp_now_send_status_t status);
|
static void _zh_espnow_send_cb(const uint8_t *mac_addr, esp_now_send_status_t status);
|
||||||
|
#endif
|
||||||
#if defined CONFIG_IDF_TARGET_ESP8266 || ESP_IDF_VERSION_MAJOR == 4
|
#if defined CONFIG_IDF_TARGET_ESP8266 || ESP_IDF_VERSION_MAJOR == 4
|
||||||
static void _zh_espnow_recv_cb(const uint8_t *mac_addr, const uint8_t *data, int data_len);
|
static void _zh_espnow_recv_cb(const uint8_t *mac_addr, const uint8_t *data, int data_len);
|
||||||
#else
|
#else
|
||||||
@ -277,6 +282,23 @@ static esp_err_t _zh_espnow_register_callbacks(bool battery_mode)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ESP_IDF_VERSION_MAJOR >= 5 && ESP_IDF_VERSION_MINOR >= 5
|
||||||
|
static void IRAM_ATTR _zh_espnow_send_cb(const esp_now_send_info_t *esp_now_info, esp_now_send_status_t status)
|
||||||
|
{
|
||||||
|
if (esp_now_info == NULL)
|
||||||
|
{
|
||||||
|
ZH_ESPNOW_LOGE("Send callback received NULL MAC address.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
|
||||||
|
ZH_ESPNOW_LOGI("ESP-NOW send callback: %s for MAC %02X:%02X:%02X:%02X:%02X:%02X.", (status == ESP_NOW_SEND_SUCCESS) ? "SUCCESS" : "FAIL", MAC2STR(esp_now_info->des_addr));
|
||||||
|
xEventGroupSetBitsFromISR(_event_group_handle, (status == ESP_NOW_SEND_SUCCESS) ? DATA_SEND_SUCCESS : DATA_SEND_FAIL, &xHigherPriorityTaskWoken);
|
||||||
|
if (xHigherPriorityTaskWoken == pdTRUE)
|
||||||
|
{
|
||||||
|
portYIELD_FROM_ISR();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#else
|
||||||
static void IRAM_ATTR _zh_espnow_send_cb(const uint8_t *mac_addr, esp_now_send_status_t status)
|
static void IRAM_ATTR _zh_espnow_send_cb(const uint8_t *mac_addr, esp_now_send_status_t status)
|
||||||
{
|
{
|
||||||
if (mac_addr == NULL)
|
if (mac_addr == NULL)
|
||||||
@ -292,6 +314,7 @@ static void IRAM_ATTR _zh_espnow_send_cb(const uint8_t *mac_addr, esp_now_send_s
|
|||||||
portYIELD_FROM_ISR();
|
portYIELD_FROM_ISR();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined CONFIG_IDF_TARGET_ESP8266 || ESP_IDF_VERSION_MAJOR == 4
|
#if defined CONFIG_IDF_TARGET_ESP8266 || ESP_IDF_VERSION_MAJOR == 4
|
||||||
static void IRAM_ATTR _zh_espnow_recv_cb(const uint8_t *mac_addr, const uint8_t *data, int data_len)
|
static void IRAM_ATTR _zh_espnow_recv_cb(const uint8_t *mac_addr, const uint8_t *data, int data_len)
|
||||||
|
Reference in New Issue
Block a user