Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9747792

Browse files
committedNov 8, 2021
Eliminates error messages with Ethernet Static IP
1 parent f5dab40 commit 9747792

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎libraries/Ethernet/src/ETH.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ bool ETHClass::begin(uint8_t phy_addr, int power, int mdc, int mdio, eth_phy_typ
368368
log_e("esp_eth_init error: %d", err);
369369
}
370370
#endif
371+
// holds a few microseconds to let DHCP start and enter into a good state
372+
// FIX ME -- adresses issue https://github.com/espressif/arduino-esp32/issues/5733
373+
delay(50);
374+
371375
return true;
372376
}
373377

@@ -385,12 +389,8 @@ bool ETHClass::config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, I
385389
info.gw.addr = 0;
386390
info.netmask.addr = 0;
387391
}
388-
389-
// this delay forces changing FreeRTOS task context
390-
// it avoids DHCP error messages by running DHCP LwIP Events correctly before setting static IP
391-
delay(50);
392-
err = tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_ETH);
393392

393+
err = tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_ETH);
394394
if(err != ESP_OK && err != ESP_ERR_TCPIP_ADAPTER_DHCP_ALREADY_STOPPED){
395395
log_e("DHCP could not be stopped! Error: %d", err);
396396
return false;

0 commit comments

Comments
 (0)
Please sign in to comment.