Fix for interval reset

This commit is contained in:
Kai Lauterbach 2022-05-25 20:14:22 +02:00
parent 73670f5b14
commit 01108980dd
2 changed files with 11 additions and 11 deletions

View File

@ -10,7 +10,7 @@
#define DELAY_LOOP_MS 50
#define POWERSAVING_SLEEP_S 600
#define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover
#define RESET_ESP_TIME_INTERVAL_MS 3600000
#define RESET_ESP_TIME_INTERVAL_MS 1200000 // (60*60*6*1000) // reset every 6 hours
#define WIND_SENSOR_MEAS_TIME_S 15
#define INITIAL_WEBSERVER_TIME 20

View File

@ -141,16 +141,6 @@ void setup()
//It's magic! leave in
delay(100);
#ifdef RESET_ESP_TIMEINTERVAL
// if millis() reached interval (1h) restart ESP
if (millis() >= RESET_ESP_TIME_INTERVAL_MS)
{
debug("Resetting firmware intentionally");
// Push reset button after flashing once or do a manual power cycle to get the functionality working.
ESP.restart();
}
#endif
#ifdef BATTERY_POWERED
debug("battery powered");
_loop();
@ -262,6 +252,16 @@ void _loop() {
}
#endif
#ifdef RESET_ESP_TIME_INTERVAL
// if millis() reached interval (1h) restart ESP
if (RESET_ESP_TIME_INTERVAL_MS <= millis())
{
debug("Resetting firmware intentionally");
// Push reset button after flashing once or do a manual power cycle to get the functionality working.
ESP.restart();
}
#endif
#ifndef BATTERY_POWERED
if (UPDATE_SENSOR_INTERVAL_S * 1000 / DELAY_LOOP_MS > update_sensor_cnt) {
return;