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
This commit is contained in:
parent
8c75c35290
commit
f7b4959994
1 changed files with 2 additions and 2 deletions
|
|
@ -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 */
|
/* attach to receive events */
|
||||||
initNetif((Network_Interface_ID)(ESP_NETIF_ID_ETH+_eth_index));
|
initNetif((Network_Interface_ID)(ESP_NETIF_ID_ETH+_eth_index));
|
||||||
|
|
||||||
|
Network.onSysEvent(onEthConnected, ARDUINO_EVENT_ETH_CONNECTED);
|
||||||
|
|
||||||
ret = esp_eth_start(_eth_handle);
|
ret = esp_eth_start(_eth_handle);
|
||||||
if(ret != ESP_OK){
|
if(ret != ESP_OK){
|
||||||
log_e("esp_eth_start failed: %d", ret);
|
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; }
|
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
|
// 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
|
// FIX ME -- adresses issue https://github.com/espressif/arduino-esp32/issues/5733
|
||||||
delay(50);
|
delay(50);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue