Added watchdog support.

This commit is contained in:
Kai Lauterbach 2022-06-22 13:52:55 +02:00
parent 7fdc6d9e23
commit 930bde2619
2 changed files with 16 additions and 1 deletions

View file

@ -31,6 +31,10 @@ String DEVICE_NAME = "weatherstation";
// Restarts the firmware every n seconds // Restarts the firmware every n seconds
//#define RESET_ESP_TIMEINTERVAL // BETA STATUS //#define RESET_ESP_TIMEINTERVAL // BETA STATUS
//#define HTTP_CALL_ON_WINDSPEED_EXCEED // BETA STATUS //#define HTTP_CALL_ON_WINDSPEED_EXCEED // BETA STATUS
//#define DEBUG_WINDSPEED_MEASUREMENT // for debugging windspeed measurement only
//#define LOG_MILLIS_TO_INFLUXDB
//#define ENABLE_WATCHDOG
//#define WATCHDOG_TIMEOUT_MS 30000
const float HUMIDITY_FACTOR = 1.0; const float HUMIDITY_FACTOR = 1.0;
const float LIGHT_FACTOR = 1.0; const float LIGHT_FACTOR = 1.0;
@ -56,7 +60,7 @@ const char *INFLUXDB_TOKEN = "your api token";
#define HTTP_CALL_ON_WINDSPEED_INTERVAL_S 60 // it's required to be bigger than WIND_SENSOR_MEAS_TIME_S #define HTTP_CALL_ON_WINDSPEED_INTERVAL_S 60 // it's required to be bigger than WIND_SENSOR_MEAS_TIME_S
#define HTTP_CALL_ON_WINDSPEED_URL "http://192.168.178.100:3001/button-windspeedexceed?event=click" #define HTTP_CALL_ON_WINDSPEED_URL "http://192.168.178.100:3001/button-windspeedexceed?event=click"
// anemometer settings, to use enable SENSOR_WIND // anemometer settings
// thingiverse anemometer settings: https://www.thingiverse.com/thing:2559929/files // thingiverse anemometer settings: https://www.thingiverse.com/thing:2559929/files
#define ROTOR_LENGTH_CM 8.25 #define ROTOR_LENGTH_CM 8.25
#define ROTOR_LENGTH_M (ROTOR_LENGTH_CM / 100.0) #define ROTOR_LENGTH_M (ROTOR_LENGTH_CM / 100.0)

View file

@ -158,6 +158,12 @@ void setup()
ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT); ESP.deepSleep(POWERSAVING_SLEEP_S * 1000000, WAKE_RF_DEFAULT);
delay(100); delay(100);
#endif #endif
#ifdef ENABLE_WATCHDOG
// Enable the internal watchdog
ESP.wdtEnable(WATCHDOG_TIMEOUT_MS);
#endif
} }
//*************************************************************************// //*************************************************************************//
@ -178,6 +184,11 @@ void criticalBatCheck()
void loop() void loop()
{ {
#ifdef ENABLE_WATCHDOG
ESP.wdtFeed();
#endif
#ifdef BATTERY_POWERED #ifdef BATTERY_POWERED
delay(50); delay(50);
return; return;