print IP address for LAN8720 devices
This commit is contained in:
@@ -69,6 +69,7 @@ void EthLan8720Device::initialize()
|
||||
{
|
||||
delay(250);
|
||||
|
||||
WiFi.setHostname(_hostname.c_str());
|
||||
_hardwareInitialized = ETH.begin(_phy_addr, _power, _mdc, _mdio, _type, _clock_mode, _use_mac_from_efuse);
|
||||
|
||||
if(_restartOnDisconnect)
|
||||
@@ -102,7 +103,17 @@ bool EthLan8720Device::supportsEncryption()
|
||||
|
||||
bool EthLan8720Device::isConnected()
|
||||
{
|
||||
return ETH.linkUp();
|
||||
bool connected = ETH.linkUp();
|
||||
|
||||
if(_lastConnected == false && connected == true)
|
||||
{
|
||||
Serial.print("Ethernet connected. IP address: ");
|
||||
Serial.println(ETH.localIP().toString());
|
||||
}
|
||||
|
||||
_lastConnected = connected;
|
||||
|
||||
return connected;
|
||||
}
|
||||
|
||||
ReconnectStatus EthLan8720Device::reconnect()
|
||||
@@ -111,7 +122,7 @@ ReconnectStatus EthLan8720Device::reconnect()
|
||||
{
|
||||
return ReconnectStatus::CriticalFailure;
|
||||
}
|
||||
delay(3000);
|
||||
delay(200);
|
||||
return isConnected() ? ReconnectStatus::Success : ReconnectStatus::Failure;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user