prepare API-changes with ESP-idf>4

This commit is contained in:
Staars 2020-11-07 18:54:04 +01:00
parent ee8845123a
commit 255a489127
1 changed files with 5 additions and 0 deletions

View File

@ -204,8 +204,13 @@ IPAddress ETHClass::gatewayIP()
IPAddress ETHClass::dnsIP(uint8_t dns_no) IPAddress ETHClass::dnsIP(uint8_t dns_no)
{ {
#ifdef ESP_IDF_VERSION_VAL //idf_version.h header file is only available in ESP-IDF v4.0 -> this is equal to: #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)
const ip_addr_t *dns_ip = dns_getserver(dns_no);
return IPAddress(dns_ip->u_addr.ip4.addr);
#else
ip_addr_t dns_ip = dns_getserver(dns_no); ip_addr_t dns_ip = dns_getserver(dns_no);
return IPAddress(dns_ip.u_addr.ip4.addr); return IPAddress(dns_ip.u_addr.ip4.addr);
#endif
} }
IPAddress ETHClass::broadcastIP() IPAddress ETHClass::broadcastIP()