Skip to content

Commit d71dda4

Browse files
authored
Use a watchdog timer for safety when pumping water (gemini) (#34)
1 parent 73886d7 commit d71dda4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <AsyncJson.h>
66
#include <ESPAsyncWebServer.h>
77
#include <LittleFS.h>
8+
#include <esp_task_wdt.h>
89
#include <og3/constants.h>
910
#include <og3/ha_app.h>
1011
#include <og3/html_table.h>
@@ -22,7 +23,7 @@
2223
#include "svelteesp32async.h"
2324
#include "watering.h"
2425

25-
#define SW_VERSION "0.9.2"
26+
#define SW_VERSION "0.9.3"
2627

2728
namespace {
2829

@@ -471,7 +472,14 @@ void setup() {
471472

472473
// Run the og3 application setup code.
473474
s_app.setup();
475+
476+
// Initialize Watchdog Timer with 5 second timeout
477+
esp_task_wdt_init(5, true);
478+
esp_task_wdt_add(NULL); // Add current thread (loopTask) to WDT
474479
}
475480

476481
// This is called repeaedly when code is running.
477-
void loop() { s_app.loop(); }
482+
void loop() {
483+
s_app.loop();
484+
esp_task_wdt_reset(); // Reset watchdog timer
485+
}

0 commit comments

Comments
 (0)