esp_modem: Fix IDF version resolution

This commit is contained in:
Tomas Rezucha
2022-09-09 09:23:56 +02:00
parent 3c65fde2a7
commit d07237b2ce
4 changed files with 7 additions and 4 deletions

View File

@ -11,12 +11,13 @@
#include "esp_wifi.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_idf_version.h"
#include "nvs_flash.h"
#include "lwip/lwip_napt.h"
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "network_dce.h"
#if ESP_IDF_VERSION_MAJOR >= 5
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
#include "esp_mac.h"
#include "dhcpserver/dhcpserver.h"
#endif

View File

@ -1,4 +1,4 @@
version: "0.1.20"
version: "0.1.21"
description: esp modem
url: https://github.com/espressif/esp-protocols/tree/master/components/esp_modem
dependencies:

View File

@ -15,6 +15,7 @@
#pragma once
#include "esp_log.h"
#include "esp_idf_version.h"
#include "driver/uart.h"
/**
@ -23,7 +24,7 @@
*/
static inline int uart_write_bytes_compat(uart_port_t uart_num, const void* src, size_t size)
{
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 3
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)
const void *data = src;
#else
auto *data = reinterpret_cast<const char*>(src);

View File

@ -17,6 +17,7 @@
#include <inttypes.h>
#include <esp_log.h>
#include <esp_event.h>
#include "esp_idf_version.h"
#include "cxx_include/esp_modem_netif.hpp"
#include "cxx_include/esp_modem_dte.hpp"
#include "esp_netif_ppp.h"
@ -59,7 +60,7 @@ esp_err_t Netif::esp_modem_post_attach(esp_netif_t *esp_netif, void *args)
esp_netif_ppp_config_t ppp_config = { .ppp_phase_event_enabled = true, // assuming phase enabled, as earlier IDFs
.ppp_error_event_enabled = false
}; // don't provide cfg getters so we enable both events
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 4
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)
esp_netif_ppp_get_params(esp_netif, &ppp_config);
#endif // ESP-IDF >= v4.4
if (!ppp_config.ppp_error_event_enabled) {