|
6 | 6 | #include <AsyncJson.h> |
7 | 7 | #include <ESPAsyncWebServer.h> |
8 | 8 | #include <LittleFS.h> |
9 | | -#include <esp_task_wdt.h> |
10 | 9 | #include <og3/constants.h> |
11 | 10 | #include <og3/ha_app.h> |
12 | 11 | #include <og3/html_table.h> |
13 | 12 | #include <og3/oled_wifi_info.h> |
14 | 13 | #include <og3/shtc3.h> |
15 | 14 | #include <og3/units.h> |
16 | 15 | #include <og3/variable.h> |
| 16 | +#include <og3/wifi_watchdog.h> |
17 | 17 |
|
18 | 18 | #include <algorithm> |
19 | 19 | #include <array> |
|
24 | 24 | #include "svelteesp32async.h" |
25 | 25 | #include "watering.h" |
26 | 26 |
|
27 | | -#define SW_VERSION "0.9.4" |
| 27 | +#define SW_VERSION "0.9.5" |
28 | 28 |
|
29 | 29 | namespace { |
30 | 30 |
|
@@ -91,6 +91,8 @@ og3::PeriodicTaskScheduler climate_scheduler( |
91 | 91 | }, |
92 | 92 | &s_app.tasks()); |
93 | 93 |
|
| 94 | +og3::WifiWatchdog s_watchdog(&s_app, std::chrono::seconds(5), std::chrono::seconds(1)); |
| 95 | + |
94 | 96 | // s_reservior monitors the water level of the reservoir: the float, and the number of seconds |
95 | 97 | // the pumps have run since the float detected low water level. |
96 | 98 | og3::ReservoirCheck s_reservoir(kWaterPin, &s_app); |
@@ -473,19 +475,7 @@ void setup() { |
473 | 475 |
|
474 | 476 | // Run the og3 application setup code. |
475 | 477 | s_app.setup(); |
476 | | - |
477 | | - // Initialize Watchdog Timer with 5 second timeout |
478 | | - esp_task_wdt_init(5, true); |
479 | | - esp_task_wdt_add(NULL); // Add current thread (loopTask) to WDT |
480 | | - |
481 | | - // Disable WDT during OTA |
482 | | - ArduinoOTA.onStart([]() { esp_task_wdt_delete(NULL); }); |
483 | | - ArduinoOTA.onEnd([]() { esp_task_wdt_add(NULL); }); |
484 | | - ArduinoOTA.onError([](ota_error_t error) { esp_task_wdt_add(NULL); }); |
485 | 478 | } |
486 | 479 |
|
487 | 480 | // This is called repeaedly when code is running. |
488 | | -void loop() { |
489 | | - s_app.loop(); |
490 | | - esp_task_wdt_reset(); // Reset watchdog timer |
491 | | -} |
| 481 | +void loop() { s_app.loop(); } |
0 commit comments