Fix for interval reset
This commit is contained in:
parent
73670f5b14
commit
01108980dd
2 changed files with 11 additions and 11 deletions
|
@ -10,7 +10,7 @@
|
||||||
#define DELAY_LOOP_MS 50
|
#define DELAY_LOOP_MS 50
|
||||||
#define POWERSAVING_SLEEP_S 600
|
#define POWERSAVING_SLEEP_S 600
|
||||||
#define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover
|
#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 WIND_SENSOR_MEAS_TIME_S 15
|
||||||
#define INITIAL_WEBSERVER_TIME 20
|
#define INITIAL_WEBSERVER_TIME 20
|
||||||
|
|
||||||
|
|
|
@ -141,16 +141,6 @@ void setup()
|
||||||
//It's magic! leave in
|
//It's magic! leave in
|
||||||
delay(100);
|
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
|
#ifdef BATTERY_POWERED
|
||||||
debug("battery powered");
|
debug("battery powered");
|
||||||
_loop();
|
_loop();
|
||||||
|
@ -262,6 +252,16 @@ void _loop() {
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifndef BATTERY_POWERED
|
||||||
if (UPDATE_SENSOR_INTERVAL_S * 1000 / DELAY_LOOP_MS > update_sensor_cnt) {
|
if (UPDATE_SENSOR_INTERVAL_S * 1000 / DELAY_LOOP_MS > update_sensor_cnt) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue