sleepydog-watchdog

bradzilla84/sleepydog/sleepydog-watchdog

A Watchdog timer to detect if the Arduino hangs/stops for lomger than MS milliseconds, and resets it if it does.
sleepydog-watchdog
@/sleepydog-watchdog
A Watchdog timer to detect if the Arduino hangs/stops for lomger than MS milliseconds, and resets it if it does.
MSnumber
Turn on the watchdog timer with a ~MS milliseconds timeout before reseting the Arduino.(Each type of board will have a different MAX, Check ActMS for actual timeout)
INITpulse
Reset the timer (Leave on Continuosuly or pulse more often that MS time)
sleepydog-watchdog
MS
INIT
ActMS
ActMSnumber
The estimated actual milliseconds before reset (in milliseconds) is returned
To use the node in your project you should have the bradzilla84/sleepydog library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD require "https://github.com/adafruit/Adafruit_SleepyDog"


{{#global}}
#include <Adafruit_SleepyDog.h>
{{/global}}

struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    if (isSettingUp()) {
        auto state = getState(ctx);
        auto Dog = Watchdog.enable(getValue<input_MS>(ctx));
        emitValue<output_ActMS>(ctx, Dog);
    }

    auto state = getState(ctx);

    if (isInputDirty<input_INIT>(ctx)){
        Watchdog.reset();
        return;}
}