print IP address for LAN8720 devices
This commit is contained in:
2
Config.h
2
Config.h
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#define NUKI_HUB_VERSION "8.12-pre-10"
|
||||
#define NUKI_HUB_VERSION "8.12-pre-11"
|
||||
|
||||
#define MQTT_QOS_LEVEL 1
|
||||
#define MQTT_CLEAN_SESSIONS false
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ private:
|
||||
char* _path;
|
||||
bool _useEncryption = false;
|
||||
bool _hardwareInitialized = false;
|
||||
bool _lastConnected = false;
|
||||
|
||||
uint8_t _phy_addr;
|
||||
int _power;
|
||||
|
||||
Reference in New Issue
Block a user