esp32: Add support to build with ESP-IDF v4.1.1.

ESP-IDF v4.0.2 is still supported.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2021-02-15 21:00:01 +11:00
parent e017f276f7
commit d191d88cab
6 changed files with 48 additions and 19 deletions

View File

@@ -46,7 +46,6 @@
#include "py/stream.h"
#include "py/mperrno.h"
#include "lib/netutils/netutils.h"
#include "tcpip_adapter.h"
#include "mdns.h"
#include "modnetwork.h"
@@ -181,7 +180,12 @@ static int _socket_getaddrinfo3(const char *nodename, const char *servname,
memcpy(nodename_no_local, nodename, nodename_len - local_len);
nodename_no_local[nodename_len - local_len] = '\0';
#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 1, 0)
struct ip4_addr addr = {0};
#else
esp_ip4_addr_t addr = {0};
#endif
esp_err_t err = mdns_query_a(nodename_no_local, MDNS_QUERY_TIMEOUT_MS, &addr);
if (err != ESP_OK) {
if (err == ESP_ERR_NOT_FOUND) {