fix inital printing of IP address
This commit is contained in:
@@ -380,7 +380,8 @@ bool NukiNetwork::update()
|
|||||||
break;
|
break;
|
||||||
case ReconnectStatus::Success:
|
case ReconnectStatus::Success:
|
||||||
memset(WiFi_fallbackDetect, 0, sizeof(WiFi_fallbackDetect));
|
memset(WiFi_fallbackDetect, 0, sizeof(WiFi_fallbackDetect));
|
||||||
Log->println(F("Reconnect successful"));
|
Log->print(F("Reconnect successful: IP: "));
|
||||||
|
Log->println(_device->localIP());
|
||||||
break;
|
break;
|
||||||
case ReconnectStatus::Failure:
|
case ReconnectStatus::Failure:
|
||||||
Log->println(F("Reconnect failed"));
|
Log->println(F("Reconnect failed"));
|
||||||
@@ -388,6 +389,13 @@ bool NukiNetwork::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_logIp && device()->isConnected() && !_device->localIP().equals("0.0.0.0"))
|
||||||
|
{
|
||||||
|
_logIp = false;
|
||||||
|
Log->print(F("IP: "));
|
||||||
|
Log->println(_device->localIP());
|
||||||
|
}
|
||||||
|
|
||||||
if(!_device->mqttConnected() && _device->isConnected())
|
if(!_device->mqttConnected() && _device->isConnected())
|
||||||
{
|
{
|
||||||
if(_networkTimeout > 0 && (ts - _lastConnectedTs > _networkTimeout * 1000) && ts > 60000)
|
if(_networkTimeout > 0 && (ts - _lastConnectedTs > _networkTimeout * 1000) && ts > 60000)
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ private:
|
|||||||
bool _restartOnDisconnect = false;
|
bool _restartOnDisconnect = false;
|
||||||
bool _firstConnect = true;
|
bool _firstConnect = true;
|
||||||
bool _publishDebugInfo = false;
|
bool _publishDebugInfo = false;
|
||||||
|
bool _logIp = true;
|
||||||
std::vector<String> _subscribedTopics;
|
std::vector<String> _subscribedTopics;
|
||||||
std::map<String, String> _initTopics;
|
std::map<String, String> _initTopics;
|
||||||
|
|
||||||
|
|||||||
@@ -112,17 +112,7 @@ bool EthLan8720Device::supportsEncryption()
|
|||||||
|
|
||||||
bool EthLan8720Device::isConnected()
|
bool EthLan8720Device::isConnected()
|
||||||
{
|
{
|
||||||
bool connected = ETH.linkUp();
|
return ETH.linkUp();
|
||||||
|
|
||||||
if(_lastConnected == false && connected == true)
|
|
||||||
{
|
|
||||||
Serial.print(F("Ethernet connected. IP address: "));
|
|
||||||
Serial.println(ETH.localIP().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
_lastConnected = connected;
|
|
||||||
|
|
||||||
return connected;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReconnectStatus EthLan8720Device::reconnect()
|
ReconnectStatus EthLan8720Device::reconnect()
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ private:
|
|||||||
bool _startAp = false;
|
bool _startAp = false;
|
||||||
char* _path;
|
char* _path;
|
||||||
bool _hardwareInitialized = false;
|
bool _hardwareInitialized = false;
|
||||||
bool _lastConnected = false;
|
|
||||||
|
|
||||||
const std::string _deviceName;
|
const std::string _deviceName;
|
||||||
uint8_t _phy_addr;
|
uint8_t _phy_addr;
|
||||||
|
|||||||
@@ -180,17 +180,7 @@ bool W5500Device::supportsEncryption()
|
|||||||
|
|
||||||
bool W5500Device::isConnected()
|
bool W5500Device::isConnected()
|
||||||
{
|
{
|
||||||
bool connected = (Ethernet.linkStatus() == EthernetLinkStatus::LinkON && _maintainResult == 0 && _hasDHCPAddress);
|
return (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)
|
void W5500Device::initializeMacAddress(byte *mac)
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ private:
|
|||||||
bool _hasDHCPAddress = false;
|
bool _hasDHCPAddress = false;
|
||||||
char* _path;
|
char* _path;
|
||||||
W5500Variant _variant;
|
W5500Variant _variant;
|
||||||
bool _lastConnected = false;
|
|
||||||
|
|
||||||
byte _mac[6];
|
byte _mac[6];
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user