diff --git a/Config.h b/Config.h index f1d34de..647bba9 100644 --- a/Config.h +++ b/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 \ No newline at end of file diff --git a/networkDevices/EthLan8720Device.cpp b/networkDevices/EthLan8720Device.cpp index fe9abc4..98f2e60 100644 --- a/networkDevices/EthLan8720Device.cpp +++ b/networkDevices/EthLan8720Device.cpp @@ -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; } diff --git a/networkDevices/EthLan8720Device.h b/networkDevices/EthLan8720Device.h index 1a32c5b..005fe6b 100644 --- a/networkDevices/EthLan8720Device.h +++ b/networkDevices/EthLan8720Device.h @@ -72,6 +72,7 @@ private: char* _path; bool _useEncryption = false; bool _hardwareInitialized = false; + bool _lastConnected = false; uint8_t _phy_addr; int _power;