diff --git a/esphome/components/ethernet/ethernet_component.cpp b/esphome/components/ethernet/ethernet_component.cpp index 005712420f..8c96cca951 100644 --- a/esphome/components/ethernet/ethernet_component.cpp +++ b/esphome/components/ethernet/ethernet_component.cpp @@ -224,10 +224,17 @@ void EthernetComponent::dump_connect_params_() { ESP_LOGCONFIG(TAG, " Subnet: %s", IPAddress(ip.netmask.addr).toString().c_str()); ESP_LOGCONFIG(TAG, " Gateway: %s", IPAddress(ip.gw.addr).toString().c_str()); - ip_addr_t dns_ip = dns_getserver(0); - ESP_LOGCONFIG(TAG, " DNS1: %s", IPAddress(dns_ip.u_addr.ip4.addr).toString().c_str()); - dns_ip = dns_getserver(1); - ESP_LOGCONFIG(TAG, " DNS2: %s", IPAddress(dns_ip.u_addr.ip4.addr).toString().c_str()); +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(3, 3, 4) + const ip_addr_t *dns_ip1 = dns_getserver(0); + const ip_addr_t *dns_ip2 = dns_getserver(1); +#else + ip_addr_t tmp_ip1 = dns_getserver(0); + const ip_addr_t *dns_ip1 = &tmp_ip1; + ip_addr_t tmp_ip2 = dns_getserver(1); + const ip_addr_t *dns_ip2 = &tmp_ip2; +#endif + ESP_LOGCONFIG(TAG, " DNS1: %s", IPAddress(dns_ip1->u_addr.ip4.addr).toString().c_str()); + ESP_LOGCONFIG(TAG, " DNS2: %s", IPAddress(dns_ip2->u_addr.ip4.addr).toString().c_str()); uint8_t mac[6]; esp_eth_get_mac(mac); ESP_LOGCONFIG(TAG, " MAC Address: %02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); diff --git a/esphome/core/config.py b/esphome/core/config.py index 1dbe2ec33a..5893f086f2 100644 --- a/esphome/core/config.py +++ b/esphome/core/config.py @@ -76,7 +76,7 @@ PLATFORMIO_ESP8266_LUT = { PLATFORMIO_ESP32_LUT = { **ARDUINO_VERSION_ESP32, - "RECOMMENDED": ARDUINO_VERSION_ESP32["1.0.4"], + "RECOMMENDED": ARDUINO_VERSION_ESP32["1.0.6"], "LATEST": "espressif32", "DEV": ARDUINO_VERSION_ESP32["dev"], } diff --git a/esphome/core/util.h b/esphome/core/util.h index 8e30211be6..4b3e79353a 100644 --- a/esphome/core/util.h +++ b/esphome/core/util.h @@ -5,6 +5,11 @@ namespace esphome { +/// Macro for IDF version comparision +#ifndef ESP_IDF_VERSION_VAL +#define ESP_IDF_VERSION_VAL(major, minor, patch) ((major << 16) | (minor << 8) | (patch)) +#endif + /// Return whether the node is connected to the network (through wifi, eth, ...) bool network_is_connected(); /// Get the active network hostname