From da72bc90b7259070a67dbbf3e569de0ae75e8b34 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Tue, 9 Nov 2021 05:23:29 -0300 Subject: [PATCH] eliminates error messages when using Ethernet Static IP (#5836) Summary Only affects ETH (not WiFi) This PR solves #5733 by allowing the DHCP IDF server to complete its tasks and only then it sets a static IP. This also solves another related failure reported in this issue (#5733 (comment)). fix #5733 Impact Adds a delay in order to wait for DHCP to actually terminate before setting the static IP configuration in ETH. --- libraries/Ethernet/src/ETH.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/Ethernet/src/ETH.cpp b/libraries/Ethernet/src/ETH.cpp index f6a9174c1..33e86691b 100644 --- a/libraries/Ethernet/src/ETH.cpp +++ b/libraries/Ethernet/src/ETH.cpp @@ -368,6 +368,10 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ log_e("esp_eth_init error: %d", err); } #endif + // holds a few microseconds to let DHCP start and enter into a good state + // FIX ME -- adresses issue https://github.com/espressif/arduino-esp32/issues/5733 + delay(50); + return true; } @@ -396,7 +400,8 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I if(err != ERR_OK){ log_e("STA IP could not be configured! Error: %d", err); return false; -} + } + if(info.ip.addr){ staticIP = true; } else { -- GitLab