port to platformio
This commit is contained in:
30
src/platform/particle/Watchdog.cpp
Normal file
30
src/platform/particle/Watchdog.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#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);
|
Reference in New Issue
Block a user