From f93774b267bb390625a108ec922e221919005ae2 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Thu, 17 Mar 2022 14:45:56 +0100 Subject: [PATCH] Changes needed to compile again with new idf --- src/espwifistack.cpp | 17 +++++++++++------ src/espwifistack.h | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/espwifistack.cpp b/src/espwifistack.cpp index 4e8bce1..eacdf41 100644 --- a/src/espwifistack.cpp +++ b/src/espwifistack.cpp @@ -13,6 +13,7 @@ // esp-idf includes #include #include +#include #include #include #include @@ -20,6 +21,7 @@ #include #endif #include +#include #ifdef CONFIG_ETH_ENABLED #include @@ -962,14 +964,14 @@ tl::expected set_base_mac_addr(mac_t mac_addr) } } -tl::expected get_ip_info(tcpip_adapter_if_t tcpip_if) +tl::expected get_ip_info(esp_netif_t *esp_netif) { - tcpip_adapter_ip_info_t ip; - if (const auto result = tcpip_adapter_get_ip_info(tcpip_if, &ip); result == ESP_OK) + esp_netif_ip_info_t ip; + if (const auto result = esp_netif_get_ip_info(esp_netif, &ip); result == ESP_OK) return ip; else { - ESP_LOGE(TAG, "tcpip_adapter_get_ip_info() failed with %s", esp_err_to_name(result)); + ESP_LOGE(TAG, "esp_netif_get_ip_info() failed with %s", esp_err_to_name(result)); return tl::make_unexpected(fmt::format("tcpip_adapter_get_ip_info() failed with {}", esp_err_to_name(result))); } } @@ -2233,9 +2235,12 @@ esp_err_t wifi_set_ap_ip(const config &config, const static_ip_config &ip) lease.start_ip.addr = ip.ip.value() + (1 << 24); lease.end_ip.addr = ip.ip.value() + (11 << 24); - if (const auto result = tcpip_adapter_dhcps_option(ESP_NETIF_OP_SET, ESP_NETIF_REQUESTED_IP_ADDRESS, &lease, sizeof(dhcps_lease_t)); result != ESP_OK) + if (const auto result = esp_netif_dhcps_option(esp_netifs[ESP_IF_WIFI_AP], + ESP_NETIF_OP_SET, + ESP_NETIF_REQUESTED_IP_ADDRESS, + &lease, sizeof(dhcps_lease_t)); result != ESP_OK) { - ESP_LOGE(TAG, "tcpip_adapter_dhcps_option() failed with %s", esp_err_to_name(result)); + ESP_LOGE(TAG, "esp_netif_dhcps_option() failed with %s", esp_err_to_name(result)); return result; } } diff --git a/src/espwifistack.h b/src/espwifistack.h index b450188..b7709b5 100644 --- a/src/espwifistack.h +++ b/src/espwifistack.h @@ -94,7 +94,7 @@ mac_or_error get_default_mac_addr(); mac_or_error get_custom_mac_addr(); mac_or_error get_base_mac_addr(); tl::expected set_base_mac_addr(mac_t mac_addr); -tl::expected get_ip_info(tcpip_adapter_if_t tcpip_if); +tl::expected get_ip_info(esp_netif_t *esp_netif); tl::expected get_hostname_for_interface(esp_interface_t interf); tl::expected get_hostname_for_interface(esp_netif_t *esp_netif);