add espMillis() to replace esp_timer_get_time() / 1000
This commit is contained in:
@@ -51,6 +51,7 @@ set(SRCFILES
|
||||
../src/util/NetworkDeviceInstantiator.cpp
|
||||
../src/NukiOfficial.cpp
|
||||
../src/NukiPublisher.cpp
|
||||
../src/EspMillis.h
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE SRCFILESREC
|
||||
|
||||
7
src/EspMillis.h
Normal file
7
src/EspMillis.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
inline int64_t espMillis()
|
||||
{
|
||||
return esp_timer_get_time() / 1000;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ void NukiNetwork::readSettings()
|
||||
|
||||
bool NukiNetwork::update()
|
||||
{
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
int64_t ts = espMillis();
|
||||
_device->update();
|
||||
|
||||
if(!_mqttEnabled || _device->isApOpen())
|
||||
@@ -375,7 +375,7 @@ bool NukiNetwork::update()
|
||||
{
|
||||
forceEnableWebServer = true;
|
||||
}
|
||||
if(_restartOnDisconnect && (esp_timer_get_time() / 1000) > 60000)
|
||||
if(_restartOnDisconnect && espMillis() > 60000)
|
||||
{
|
||||
restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
}
|
||||
@@ -604,7 +604,7 @@ bool NukiNetwork::update()
|
||||
{
|
||||
uint8_t pin = gpioTs.first;
|
||||
int64_t ts = gpioTs.second;
|
||||
if(ts != 0 && (((esp_timer_get_time() / 1000) - ts) >= GPIO_DEBOUNCE_TIME))
|
||||
if(ts != 0 && ((espMillis() - ts) >= GPIO_DEBOUNCE_TIME))
|
||||
{
|
||||
_gpioTs[pin] = 0;
|
||||
|
||||
@@ -814,7 +814,7 @@ void NukiNetwork::parseGpioTopics(char* topic, int topic_len, char* data, int da
|
||||
|
||||
void NukiNetwork::gpioActionCallback(const GpioAction &action, const int &pin)
|
||||
{
|
||||
_gpioTs[pin] = (esp_timer_get_time() / 1000);
|
||||
_gpioTs[pin] = espMillis();
|
||||
}
|
||||
|
||||
void NukiNetwork::disableAutoRestarts()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "networkDevices/IPConfiguration.h"
|
||||
#include "enums/NetworkDeviceType.h"
|
||||
#include "util/NetworkUtil.h"
|
||||
#include "EspMillis.h"
|
||||
|
||||
#ifndef NUKI_HUB_UPDATER
|
||||
#include "MqttReceiver.h"
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "LockActionResult.h"
|
||||
#include "NukiOfficial.h"
|
||||
#include "NukiPublisher.h"
|
||||
#include "EspMillis.h"
|
||||
|
||||
class NukiNetworkLock : public MqttReceiver
|
||||
{
|
||||
|
||||
@@ -131,7 +131,7 @@ void NukiNetworkOpener::initialize()
|
||||
|
||||
void NukiNetworkOpener::update()
|
||||
{
|
||||
if(_resetRingStateTs != 0 && (esp_timer_get_time() / 1000) >= _resetRingStateTs)
|
||||
if(_resetRingStateTs != 0 && espMillis() >= _resetRingStateTs)
|
||||
{
|
||||
_resetRingStateTs = 0;
|
||||
publishString(mqtt_topic_lock_binary_ring, "standby", true);
|
||||
@@ -441,7 +441,7 @@ void NukiNetworkOpener::publishRing(const bool locked)
|
||||
}
|
||||
|
||||
publishString(mqtt_topic_lock_binary_ring, "ring", true);
|
||||
_resetRingStateTs = (esp_timer_get_time() / 1000) + 2000;
|
||||
_resetRingStateTs = espMillis() + 2000;
|
||||
}
|
||||
|
||||
void NukiNetworkOpener::publishState(NukiOpener::OpenerState lockState)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "NukiConstants.h"
|
||||
#include "NukiOpenerConstants.h"
|
||||
#include "NukiNetworkLock.h"
|
||||
#include "EspMillis.h"
|
||||
|
||||
class NukiNetworkOpener : public MqttReceiver
|
||||
{
|
||||
|
||||
@@ -197,7 +197,7 @@ void NukiOpenerWrapper::update()
|
||||
}
|
||||
|
||||
int64_t lastReceivedBeaconTs = _nukiOpener.getLastReceivedBeaconTs();
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
int64_t ts = espMillis();
|
||||
uint8_t queryCommands = _network->queryCommands();
|
||||
|
||||
if(_restartBeaconTimeout > 0 &&
|
||||
@@ -435,7 +435,7 @@ void NukiOpenerWrapper::updateKeyTurnerState()
|
||||
postponeBleWatchdog();
|
||||
if(_retryLockstateCount < _nrOfRetries + 1)
|
||||
{
|
||||
_nextLockStateUpdateTs = (esp_timer_get_time() / 1000) + _retryDelay;
|
||||
_nextLockStateUpdateTs = espMillis() + _retryDelay;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -638,7 +638,7 @@ void NukiOpenerWrapper::updateConfig()
|
||||
{
|
||||
++_retryConfigCount;
|
||||
Log->println(F("Invalid/Unexpected opener config and/or advanced config recieved, retrying in 10 seconds"));
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
int64_t ts = espMillis();
|
||||
_nextConfigUpdateTs = ts + 10000;
|
||||
}
|
||||
}
|
||||
@@ -675,7 +675,7 @@ void NukiOpenerWrapper::updateAuthData(bool retrieved)
|
||||
printCommandResult(result);
|
||||
if(result == Nuki::CmdResult::Success)
|
||||
{
|
||||
_waitAuthLogUpdateTs = (esp_timer_get_time() / 1000) + 5000;
|
||||
_waitAuthLogUpdateTs = espMillis() + 5000;
|
||||
delay(100);
|
||||
|
||||
std::list<NukiOpener::LogEntry> log;
|
||||
@@ -760,7 +760,7 @@ void NukiOpenerWrapper::updateKeypad(bool retrieved)
|
||||
printCommandResult(result);
|
||||
if(result == Nuki::CmdResult::Success)
|
||||
{
|
||||
_waitKeypadUpdateTs = (esp_timer_get_time() / 1000) + 5000;
|
||||
_waitKeypadUpdateTs = espMillis() + 5000;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -837,7 +837,7 @@ void NukiOpenerWrapper::updateTimeControl(bool retrieved)
|
||||
printCommandResult(result);
|
||||
if(result == Nuki::CmdResult::Success)
|
||||
{
|
||||
_waitTimeControlUpdateTs = (esp_timer_get_time() / 1000) + 5000;
|
||||
_waitTimeControlUpdateTs = espMillis() + 5000;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -951,7 +951,7 @@ void NukiOpenerWrapper::updateAuth(bool retrieved)
|
||||
|
||||
void NukiOpenerWrapper::postponeBleWatchdog()
|
||||
{
|
||||
_disableBleWatchdogTs = (esp_timer_get_time() / 1000) + 15000;
|
||||
_disableBleWatchdogTs = espMillis() + 15000;
|
||||
}
|
||||
|
||||
NukiOpener::LockAction NukiOpenerWrapper::lockActionToEnum(const char *str)
|
||||
@@ -2284,7 +2284,7 @@ void NukiOpenerWrapper::onConfigUpdateReceived(const char *value)
|
||||
jsonResult["general"] = "noChange";
|
||||
}
|
||||
|
||||
_nextConfigUpdateTs = (esp_timer_get_time() / 1000) + 300;
|
||||
_nextConfigUpdateTs = espMillis() + 300;
|
||||
|
||||
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
|
||||
_network->publishConfigCommandResult(_resbuf);
|
||||
@@ -3283,7 +3283,7 @@ void NukiOpenerWrapper::onTimeControlCommandReceived(const char *value)
|
||||
_network->publishTimeControlCommandResult(resultStr);
|
||||
}
|
||||
|
||||
_nextConfigUpdateTs = (esp_timer_get_time() / 1000) + 300;
|
||||
_nextConfigUpdateTs = espMillis() + 300;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -275,7 +275,7 @@ void NukiWrapper::update()
|
||||
}
|
||||
|
||||
int64_t lastReceivedBeaconTs = _nukiLock.getLastReceivedBeaconTs();
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
int64_t ts = espMillis();
|
||||
uint8_t queryCommands = _network->queryCommands();
|
||||
|
||||
if(_restartBeaconTimeout > 0 &&
|
||||
@@ -521,7 +521,7 @@ void NukiWrapper::updateKeyTurnerState()
|
||||
Log->print(F("Query lock state retrying in "));
|
||||
Log->print(_retryDelay);
|
||||
Log->println("ms");
|
||||
_nextLockStateUpdateTs = (esp_timer_get_time() / 1000) + _retryDelay;
|
||||
_nextLockStateUpdateTs = espMillis() + _retryDelay;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -532,7 +532,7 @@ void NukiWrapper::updateKeyTurnerState()
|
||||
|
||||
if(lockState != _lastKeyTurnerState.lockState)
|
||||
{
|
||||
_statusUpdatedTs = esp_timer_get_time() / 1000;
|
||||
_statusUpdatedTs = espMillis();
|
||||
}
|
||||
|
||||
if(lockState == NukiLock::LockState::Locked ||
|
||||
@@ -550,7 +550,7 @@ void NukiWrapper::updateKeyTurnerState()
|
||||
|
||||
updateGpioOutputs();
|
||||
}
|
||||
else if(!_nukiOfficial->getOffConnected() && (esp_timer_get_time() / 1000) < _statusUpdatedTs + 10000)
|
||||
else if(!_nukiOfficial->getOffConnected() && espMillis() < _statusUpdatedTs + 10000)
|
||||
{
|
||||
_statusUpdated = true;
|
||||
Log->println(F("Lock: Keep updating status on intermediate lock state"));
|
||||
@@ -723,7 +723,7 @@ void NukiWrapper::updateConfig()
|
||||
{
|
||||
++_retryConfigCount;
|
||||
Log->println(F("Invalid/Unexpected lock config and/or advanced config recieved, retrying in 10 seconds"));
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
int64_t ts = espMillis();
|
||||
_nextConfigUpdateTs = ts + 10000;
|
||||
}
|
||||
}
|
||||
@@ -758,7 +758,7 @@ void NukiWrapper::updateAuthData(bool retrieved)
|
||||
printCommandResult(result);
|
||||
if(result == Nuki::CmdResult::Success)
|
||||
{
|
||||
_waitAuthLogUpdateTs = (esp_timer_get_time() / 1000) + 5000;
|
||||
_waitAuthLogUpdateTs = espMillis() + 5000;
|
||||
delay(100);
|
||||
|
||||
std::list<NukiLock::LogEntry> log;
|
||||
@@ -842,7 +842,7 @@ void NukiWrapper::updateKeypad(bool retrieved)
|
||||
printCommandResult(result);
|
||||
if(result == Nuki::CmdResult::Success)
|
||||
{
|
||||
_waitKeypadUpdateTs = (esp_timer_get_time() / 1000) + 5000;
|
||||
_waitKeypadUpdateTs = espMillis() + 5000;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -918,7 +918,7 @@ void NukiWrapper::updateTimeControl(bool retrieved)
|
||||
printCommandResult(result);
|
||||
if(result == Nuki::CmdResult::Success)
|
||||
{
|
||||
_waitTimeControlUpdateTs = (esp_timer_get_time() / 1000) + 5000;
|
||||
_waitTimeControlUpdateTs = espMillis() + 5000;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1032,7 +1032,7 @@ void NukiWrapper::updateAuth(bool retrieved)
|
||||
|
||||
void NukiWrapper::postponeBleWatchdog()
|
||||
{
|
||||
_disableBleWatchdogTs = (esp_timer_get_time() / 1000) + 15000;
|
||||
_disableBleWatchdogTs = espMillis() + 15000;
|
||||
}
|
||||
|
||||
NukiLock::LockAction NukiWrapper::lockActionToEnum(const char *str)
|
||||
@@ -1118,7 +1118,7 @@ LockActionResult NukiWrapper::onLockActionReceived(const char *value)
|
||||
{
|
||||
if(_preferences->getBool(preference_official_hybrid_actions, false))
|
||||
{
|
||||
_nukiOfficial->setOffCommandExecutedTs((esp_timer_get_time() / 1000) + 2000);
|
||||
_nukiOfficial->setOffCommandExecutedTs(espMillis() + 2000);
|
||||
_offCommand = action;
|
||||
_network->publishOffAction((int)action);
|
||||
}
|
||||
@@ -2349,7 +2349,7 @@ void NukiWrapper::onConfigUpdateReceived(const char *value)
|
||||
jsonResult["general"] = "noChange";
|
||||
}
|
||||
|
||||
_nextConfigUpdateTs = (esp_timer_get_time() / 1000) + 300;
|
||||
_nextConfigUpdateTs = espMillis() + 300;
|
||||
|
||||
serializeJson(jsonResult, _resbuf, sizeof(_resbuf));
|
||||
_network->publishConfigCommandResult(_resbuf);
|
||||
@@ -2394,7 +2394,7 @@ void NukiWrapper::onGpioActionReceived(const GpioAction &action, const int &pin)
|
||||
}
|
||||
else
|
||||
{
|
||||
_nukiOfficial->setOffCommandExecutedTs((esp_timer_get_time() / 1000) + 2000);
|
||||
_nukiOfficial->setOffCommandExecutedTs(espMillis() + 2000);
|
||||
_offCommand = NukiLock::LockAction::Lock;
|
||||
_network->publishOffAction(2);
|
||||
}
|
||||
@@ -2406,7 +2406,7 @@ void NukiWrapper::onGpioActionReceived(const GpioAction &action, const int &pin)
|
||||
}
|
||||
else
|
||||
{
|
||||
_nukiOfficial->setOffCommandExecutedTs((esp_timer_get_time() / 1000) + 2000);
|
||||
_nukiOfficial->setOffCommandExecutedTs(espMillis() + 2000);
|
||||
_offCommand = NukiLock::LockAction::Unlock;
|
||||
_network->publishOffAction(1);
|
||||
}
|
||||
@@ -2418,7 +2418,7 @@ void NukiWrapper::onGpioActionReceived(const GpioAction &action, const int &pin)
|
||||
}
|
||||
else
|
||||
{
|
||||
_nukiOfficial->setOffCommandExecutedTs((esp_timer_get_time() / 1000) + 2000);
|
||||
_nukiOfficial->setOffCommandExecutedTs(espMillis() + 2000);
|
||||
_offCommand = NukiLock::LockAction::Unlatch;
|
||||
_network->publishOffAction(3);
|
||||
}
|
||||
@@ -2430,7 +2430,7 @@ void NukiWrapper::onGpioActionReceived(const GpioAction &action, const int &pin)
|
||||
}
|
||||
else
|
||||
{
|
||||
_nukiOfficial->setOffCommandExecutedTs((esp_timer_get_time() / 1000) + 2000);
|
||||
_nukiOfficial->setOffCommandExecutedTs(espMillis() + 2000);
|
||||
_offCommand = NukiLock::LockAction::LockNgo;
|
||||
_network->publishOffAction(4);
|
||||
}
|
||||
@@ -2442,7 +2442,7 @@ void NukiWrapper::onGpioActionReceived(const GpioAction &action, const int &pin)
|
||||
}
|
||||
else
|
||||
{
|
||||
_nukiOfficial->setOffCommandExecutedTs((esp_timer_get_time() / 1000) + 2000);
|
||||
_nukiOfficial->setOffCommandExecutedTs(espMillis() + 2000);
|
||||
_offCommand = NukiLock::LockAction::LockNgoUnlatch;
|
||||
_network->publishOffAction(5);
|
||||
}
|
||||
@@ -3398,7 +3398,7 @@ void NukiWrapper::onTimeControlCommandReceived(const char *value)
|
||||
_network->publishTimeControlCommandResult(resultStr);
|
||||
}
|
||||
|
||||
_nextConfigUpdateTs = (esp_timer_get_time() / 1000) + 300;
|
||||
_nextConfigUpdateTs = espMillis() + 300;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3967,7 +3967,7 @@ void NukiWrapper::notify(Nuki::EventType eventType)
|
||||
{
|
||||
if(!_nukiOfficial->getOffConnected())
|
||||
{
|
||||
if(_nukiOfficial->getOffEnabled() && _intervalHybridLockstate > 0 && (esp_timer_get_time() / 1000) > (_intervalHybridLockstate * 1000))
|
||||
if(_nukiOfficial->getOffEnabled() && _intervalHybridLockstate > 0 && espMillis() > (_intervalHybridLockstate * 1000))
|
||||
{
|
||||
Log->println("OffKeyTurnerStatusUpdated");
|
||||
_statusUpdated = true;
|
||||
@@ -3978,7 +3978,7 @@ void NukiWrapper::notify(Nuki::EventType eventType)
|
||||
{
|
||||
Log->println("KeyTurnerStatusUpdated");
|
||||
_statusUpdated = true;
|
||||
_statusUpdatedTs = esp_timer_get_time() / 1000;
|
||||
_statusUpdatedTs = espMillis();
|
||||
_network->publishStatusUpdated(_statusUpdated);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "LockActionResult.h"
|
||||
#include "NukiDeviceId.h"
|
||||
#include "NukiOfficial.h"
|
||||
#include "EspMillis.h"
|
||||
|
||||
class NukiWrapper : public Nuki::SmartlockEventHandler
|
||||
{
|
||||
|
||||
@@ -1012,7 +1012,7 @@ esp_err_t WebCfgServer::handleOtaUpload(PsychicRequest *request, const String& f
|
||||
return(ESP_FAIL);
|
||||
}
|
||||
|
||||
_otaStartTs = esp_timer_get_time() / 1000;
|
||||
_otaStartTs = espMillis();
|
||||
esp_task_wdt_config_t twdt_config =
|
||||
{
|
||||
.timeout_ms = 30000,
|
||||
@@ -3985,7 +3985,7 @@ esp_err_t WebCfgServer::buildInfoHtml(PsychicRequest *request)
|
||||
response.print("\nUpdater build date: ");
|
||||
response.print(_preferences->getString(preference_updater_date, ""));
|
||||
response.print("\nUptime (min): ");
|
||||
response.print(esp_timer_get_time() / 1000 / 1000 / 60);
|
||||
response.print(espMillis() / 1000 / 60);
|
||||
response.print("\nConfig version: ");
|
||||
response.print(_preferences->getInt(preference_config_version));
|
||||
response.print("\nLast restart reason FW: ");
|
||||
|
||||
11
src/main.cpp
11
src/main.cpp
@@ -7,6 +7,7 @@
|
||||
#include "esp_https_ota.h"
|
||||
#include "esp_task_wdt.h"
|
||||
#include "Config.h"
|
||||
#include "EspMillis.h"
|
||||
|
||||
#ifndef NUKI_HUB_UPDATER
|
||||
#include "NukiWrapper.h"
|
||||
@@ -131,7 +132,7 @@ void networkTask(void *pvParameters)
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
int64_t ts = espMillis();
|
||||
if(ts > 120000 && ts < 125000)
|
||||
{
|
||||
if(bootloopCounter > 0)
|
||||
@@ -162,10 +163,10 @@ void networkTask(void *pvParameters)
|
||||
}
|
||||
#endif
|
||||
|
||||
if((esp_timer_get_time() / 1000) - networkLoopTs > 120000)
|
||||
if(espMillis() - networkLoopTs > 120000)
|
||||
{
|
||||
Log->println("networkTask is running");
|
||||
networkLoopTs = esp_timer_get_time() / 1000;
|
||||
networkLoopTs = espMillis();
|
||||
}
|
||||
|
||||
esp_task_wdt_reset();
|
||||
@@ -212,10 +213,10 @@ void nukiTask(void *pvParameters)
|
||||
nukiOpener->update();
|
||||
}
|
||||
|
||||
if((esp_timer_get_time() / 1000) - nukiLoopTs > 120000)
|
||||
if(espMillis() - nukiLoopTs > 120000)
|
||||
{
|
||||
Log->println("nukiTask is running");
|
||||
nukiLoopTs = esp_timer_get_time() / 1000;
|
||||
nukiLoopTs = espMillis();
|
||||
}
|
||||
|
||||
esp_task_wdt_reset();
|
||||
|
||||
@@ -87,7 +87,7 @@ void EthernetDevice::initialize()
|
||||
criticalEthFailure = false;
|
||||
if(!_ipConfiguration->dhcpEnabled())
|
||||
{
|
||||
_checkIpTs = (esp_timer_get_time() / 1000) + 2000;
|
||||
_checkIpTs = espMillis() + 2000;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -126,7 +126,7 @@ void EthernetDevice::update()
|
||||
{
|
||||
Log->println(F("ETH Set static IP"));
|
||||
ETH.config(_ipConfiguration->ipAddress(), _ipConfiguration->defaultGateway(), _ipConfiguration->subnet(), _ipConfiguration->dnsServer());
|
||||
_checkIpTs = (esp_timer_get_time() / 1000) + 2000;
|
||||
_checkIpTs = espMillis() + 2000;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -213,7 +213,7 @@ bool EthernetDevice::isApOpen()
|
||||
|
||||
void EthernetDevice::onDisconnected()
|
||||
{
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && ((esp_timer_get_time() / 1000) > 60000))
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && (espMillis() > 60000))
|
||||
{
|
||||
restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "IPConfiguration.h"
|
||||
#include "../EspMillis.h"
|
||||
|
||||
class NetworkDevice
|
||||
{
|
||||
|
||||
@@ -235,7 +235,7 @@ bool WifiDevice::connect()
|
||||
{
|
||||
Log->print("No network found with SSID: ");
|
||||
Log->println(ssid);
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && ((esp_timer_get_time() / 1000) > 60000))
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && (espMillis() > 60000))
|
||||
{
|
||||
restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
}
|
||||
@@ -287,7 +287,7 @@ bool WifiDevice::connect()
|
||||
|
||||
if (status != WL_CONNECTED)
|
||||
{
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && ((esp_timer_get_time() / 1000) > 60000))
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && (espMillis() > 60000))
|
||||
{
|
||||
restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
_connecting = false;
|
||||
@@ -349,7 +349,7 @@ void WifiDevice::onDisconnected()
|
||||
if(_connected)
|
||||
{
|
||||
_connected = false;
|
||||
_disconnectTs = (esp_timer_get_time() / 1000);
|
||||
_disconnectTs = espMillis();
|
||||
Log->println(F("Wi-Fi disconnected"));
|
||||
|
||||
//QUICK RECONNECT
|
||||
@@ -377,7 +377,7 @@ void WifiDevice::onDisconnected()
|
||||
|
||||
if(!isConnected())
|
||||
{
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && ((esp_timer_get_time() / 1000) > 60000))
|
||||
if(_preferences->getBool(preference_restart_on_disconnect, false) && (espMillis() > 60000))
|
||||
{
|
||||
restartEsp(RestartReason::RestartOnDisconnectWatchdog);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user