diff --git a/networkDevices/EthLan8720Device.cpp b/networkDevices/EthLan8720Device.cpp index 98f2e60..f9eb6a4 100644 --- a/networkDevices/EthLan8720Device.cpp +++ b/networkDevices/EthLan8720Device.cpp @@ -107,7 +107,7 @@ bool EthLan8720Device::isConnected() if(_lastConnected == false && connected == true) { - Serial.print("Ethernet connected. IP address: "); + Serial.print(F("Ethernet connected. IP address: ")); Serial.println(ETH.localIP().toString()); } diff --git a/networkDevices/W5500Device.cpp b/networkDevices/W5500Device.cpp index 93c3343..08eec47 100644 --- a/networkDevices/W5500Device.cpp +++ b/networkDevices/W5500Device.cpp @@ -164,7 +164,17 @@ bool W5500Device::supportsEncryption() bool W5500Device::isConnected() { - return Ethernet.linkStatus() == EthernetLinkStatus::LinkON && _maintainResult == 0 && _hasDHCPAddress; + bool connected = (Ethernet.linkStatus() == EthernetLinkStatus::LinkON && _maintainResult == 0 && _hasDHCPAddress); + + if(_lastConnected == false && connected == true) + { + Serial.print(F("Ethernet connected. IP address: ")); + Serial.println(Ethernet.localIP().toString()); + } + + _lastConnected = connected; + + return connected; } void W5500Device::initializeMacAddress(byte *mac) diff --git a/networkDevices/W5500Device.h b/networkDevices/W5500Device.h index d6dbd16..12a964d 100644 --- a/networkDevices/W5500Device.h +++ b/networkDevices/W5500Device.h @@ -71,6 +71,7 @@ private: bool _hasDHCPAddress = false; char* _path; W5500Variant _variant; + bool _lastConnected = false; byte _mac[6]; }; \ No newline at end of file