diff --git a/src/Ethernet.cpp b/src/Ethernet.cpp index 599404d..662bef5 100644 --- a/src/Ethernet.cpp +++ b/src/Ethernet.cpp @@ -80,8 +80,17 @@ void EthernetClass::begin(uint8_t *mac, IPAddress localIP, IPAddress dnsIP, IPAd } } // if (config(localIP, gatewayIP, netmask, dnsIP) && beginETH(mac)) { - if (beginETH(mac) && config(localIP, gatewayIP, netmask, dnsIP) ) { - hwStatus = EthernetHardwareFound; + if (beginETH(mac)) + { + if (esp_netif_dhcpc_stop(netif()) != ESP_OK) + { + log_e("Failed to stop dhcp client"); + return; + } + if (config(localIP, gatewayIP, netmask, dnsIP)) + { + hwStatus = EthernetHardwareFound; + } } const unsigned long start = millis(); while (!linkUp() && ((millis() - start) < 3000)) {