Replace millis() with esp_timer_get_time() (#423)
This commit is contained in:
14
src/main.cpp
14
src/main.cpp
@@ -38,7 +38,7 @@ bool openerEnabled = false;
|
||||
TaskHandle_t nukiTaskHandle = nullptr;
|
||||
TaskHandle_t presenceDetectionTaskHandle = nullptr;
|
||||
|
||||
unsigned long restartTs = (2^32) - 5 * 60000;
|
||||
int64_t restartTs = ((2^64) - (5 * 1000 * 60000)) / 1000;
|
||||
|
||||
#else
|
||||
#include "../../src/WebCfgServer.h"
|
||||
@@ -48,7 +48,7 @@ unsigned long restartTs = (2^32) - 5 * 60000;
|
||||
#include "../../src/RestartReason.h"
|
||||
#include "../../src/NukiNetwork.h"
|
||||
|
||||
unsigned long restartTs = 10 * 60000;
|
||||
int64_t restartTs = 10 * 1000 * 60000;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -74,7 +74,7 @@ void networkTask(void *pvParameters)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
unsigned long ts = millis();
|
||||
int64_t ts = (esp_timer_get_time() / 1000);
|
||||
if(ts > 120000 && ts < 125000 && bootloopCounter > 0)
|
||||
{
|
||||
bootloopCounter = (int8_t)0;
|
||||
@@ -97,14 +97,6 @@ void networkTask(void *pvParameters)
|
||||
webCfgServer->update();
|
||||
#endif
|
||||
|
||||
// millis() is about to overflow. Restart device to prevent problems with overflow
|
||||
if(millis() > restartTs)
|
||||
{
|
||||
Log->println(F("Restart timer expired, restarting device."));
|
||||
delay(200);
|
||||
restartEsp(RestartReason::RestartTimer);
|
||||
}
|
||||
|
||||
delay(100);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user