Replace millis() with esp_timer_get_time() (#423)

This commit is contained in:
iranl
2024-07-15 17:16:43 +02:00
committed by GitHub
parent 8e5e47b102
commit 77ddef76af
22 changed files with 171 additions and 145 deletions

View File

@@ -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);
}
}