Unverified Commit f7b49599 authored by s-hadinger's avatar s-hadinger Committed by GitHub

fix(ethernet): move event listener earlier to avoid missing event `ETH_CONNECTED` (#9481)

* Ethernet: Move event listener earlier

* fix(ethernet): move network listener after initNetif
parent 8c75c352
......@@ -287,6 +287,8 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i
/* attach to receive events */
initNetif((Network_Interface_ID)(ESP_NETIF_ID_ETH+_eth_index));
Network.onSysEvent(onEthConnected, ARDUINO_EVENT_ETH_CONNECTED);
ret = esp_eth_start(_eth_handle);
if(ret != ESP_OK){
log_e("esp_eth_start failed: %d", ret);
......@@ -308,8 +310,6 @@ bool ETHClass::begin(eth_phy_type_t type, int32_t phy_addr, int mdc, int mdio, i
if(!perimanSetPinBus(_pin_power, ESP32_BUS_TYPE_ETHERNET_PWR, (void *)(this), -1, -1)){ goto err; }
}
Network.onSysEvent(onEthConnected, ARDUINO_EVENT_ETH_CONNECTED);
// holds a few milliseconds to let DHCP start and enter into a good state
// FIX ME -- adresses issue https://github.com/espressif/arduino-esp32/issues/5733
delay(50);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment