Files
renderbug-cpp/src/platform/particle/Watchdog.cpp
2021-03-29 01:10:55 -07:00

31 lines
619 B
C++

#include <Figments.h>
BootOpts bootopts;
void watchdogHandler() {
for(int i = 0; i < 8; i++) {
leds[i] = CRGB(i % 3 ? 35 : 255, 0, 0);
}
FastLED.show();
if (bootopts.lastBootWasFlash) {
System.dfu();
} else {
System.enterSafeMode();
}
}
class Watchdog : public Task {
public:
Watchdog() : Task("Watchdog") {
m_watchdog = new ApplicationWatchdog(5000, watchdogHandler, 1536);
}
void loop() override {
m_watchdog->checkin();
}
private:
ApplicationWatchdog *m_watchdog;
};
STATIC_ALLOC(Watchdog);