Replace millis() with esp_timer_get_time() (#423)
This commit is contained in:
@@ -155,7 +155,7 @@ ReconnectStatus EthLan8720Device::reconnect()
|
||||
|
||||
void EthLan8720Device::onDisconnected()
|
||||
{
|
||||
if(_restartOnDisconnect && (millis() > 60000)) restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
if(_restartOnDisconnect && ((esp_timer_get_time() / 1000) > 60000)) restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
reconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -153,8 +153,8 @@ ReconnectStatus WifiDevice::reconnect()
|
||||
{
|
||||
if(WiFi.getMode() & WIFI_STA){
|
||||
WiFi.mode(WIFI_OFF);
|
||||
int timeout = millis()+1200;
|
||||
while(WiFi.getMode()!= WIFI_OFF && millis()<timeout){
|
||||
int timeout = (esp_timer_get_time() / 1000)+1200;
|
||||
while(WiFi.getMode()!= WIFI_OFF && (esp_timer_get_time() / 1000)<timeout){
|
||||
delay(0);
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ ReconnectStatus WifiDevice::reconnect()
|
||||
_isReconnecting = false;
|
||||
}
|
||||
|
||||
if(!isConnected() && _disconnectTs > millis() - 120000) _wm.setEnableConfigPortal(_startAp || !_preferences->getBool(preference_network_wifi_fallback_disabled));
|
||||
if(!isConnected() && _disconnectTs > (esp_timer_get_time() / 1000) - 120000) _wm.setEnableConfigPortal(_startAp || !_preferences->getBool(preference_network_wifi_fallback_disabled));
|
||||
return isConnected() ? ReconnectStatus::Success : ReconnectStatus::Failure;
|
||||
}
|
||||
|
||||
@@ -179,8 +179,8 @@ void WifiDevice::onConnected()
|
||||
|
||||
void WifiDevice::onDisconnected()
|
||||
{
|
||||
_disconnectTs = millis();
|
||||
if(_restartOnDisconnect && (millis() > 60000)) restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
_disconnectTs = (esp_timer_get_time() / 1000);
|
||||
if(_restartOnDisconnect && ((esp_timer_get_time() / 1000) > 60000)) restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
_wm.setEnableConfigPortal(false);
|
||||
reconnect();
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ private:
|
||||
bool _startAp = false;
|
||||
bool _isReconnecting = false;
|
||||
char* _path;
|
||||
unsigned long _disconnectTs = 0;
|
||||
int64_t _disconnectTs = 0;
|
||||
|
||||
#ifndef NUKI_HUB_UPDATER
|
||||
char _ca[TLS_CA_MAX_SIZE] = {0};
|
||||
|
||||
Reference in New Issue
Block a user