Add an external watchdog module

This commit is contained in:
Quency-D committed 2026-01-22 15:03:40 +08:00
1 parent 5986f512c2
commit e902293246
10 files changed
+96 -3

No files matched your search

+7
View File
@@ -110,6 +110,10 @@ void setup() {
board.begin();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.begin();
#endif
#ifdef DISPLAY_CLASS
DisplayDriver* disp = NULL;
if (display.begin()) {
@@ -228,4 +232,7 @@ void loop() {
ui_task.loop();
#endif
rtc_clock.tick();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.loop();
#endif
}
+11 -1
View File
@@ -29,6 +29,10 @@ void setup() {
board.begin();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.begin();
#endif
// For power saving
lastActive = millis(); // mark last active time since boot
@@ -124,11 +128,17 @@ void loop() {
ui_task.loop();
#endif
rtc_clock.tick();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.loop();
#endif
if (the_mesh.getNodePrefs()->powersaving_enabled && // To check if power saving is enabled
the_mesh.millisHasNowPassed(lastActive + nextSleepinSecs * 1000)) { // To check if it is time to sleep
if (!the_mesh.hasPendingWork()) { // No pending work. Safe to sleep
#ifdef HAS_EX_WATCHDOG
board.sleep(ex_watchdog.getIntervalMs()>1800?1800:ex_watchdog.getIntervalMs()); // To sleep. Wake up after 30 minutes or when receiving a LoRa packet
#else
board.sleep(1800); // To sleep. Wake up after 30 minutes or when receiving a LoRa packet
#endif
lastActive = millis();
nextSleepinSecs = 5; // Default: To work for 5s and sleep again
} else {
+7
View File
@@ -24,6 +24,10 @@ void setup() {
board.begin();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.begin();
#endif
#ifdef DISPLAY_CLASS
if (display.begin()) {
display.startFrame();
@@ -111,4 +115,7 @@ void loop() {
ui_task.loop();
#endif
rtc_clock.tick();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.loop();
#endif
}
+7
View File
@@ -559,6 +559,10 @@ void setup() {
board.begin();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.begin();
#endif
if (!radio_init()) { halt(); }
fast_rng.begin(radio_get_rng_seed());
@@ -588,4 +592,7 @@ void setup() {
void loop() {
the_mesh.loop();
rtc_clock.tick();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.loop();
#endif
}
+7
View File
@@ -58,6 +58,10 @@ void setup() {
board.begin();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.begin();
#endif
#ifdef DISPLAY_CLASS
if (display.begin()) {
display.startFrame();
@@ -145,4 +149,7 @@ void loop() {
ui_task.loop();
#endif
rtc_clock.tick();
#ifdef HAS_EX_WATCHDOG
ex_watchdog.loop();
#endif
}