Skip to content

Commit

Permalink
watchdog cleanup
Browse files Browse the repository at this point in the history
more watchdog work; now an 8S timer in freakout / inactive mode, as
there are many built-in delays while resyncing
  • Loading branch information
jaustindavid committed Aug 3, 2014
1 parent b01036e commit 2dc2f71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Wiiceiver/Wiiceiver.ino
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ bool waitForActivity(void) {

chuck.update();
while (! chuck.isActive() && timer > millis()) {
wdt_reset();
delay(20);
chuck.update();
}
Expand Down Expand Up @@ -308,6 +309,7 @@ bool startChuck() {
Serial.print("(Re)starting the nunchuck: #");
Serial.println(tries);
#endif
wdt_reset();
chuck.setup();
chuck.readEEPROM();
tries ++;
Expand All @@ -321,6 +323,7 @@ bool startChuck() {

// pretty much what it sounds like
void handleInactivity() {
watchdog_setup(WDTO_8S);
#ifdef DEBUGGING
Serial.print(millis());
Serial.println(": handling inactivity");
Expand All @@ -347,13 +350,15 @@ void handleInactivity() {
#endif
while (chuck.Y > 0.1 || chuck.Y < -0.1) {
chuck.update();
wdt_reset();
delay(20);
}

#ifdef DEBUGGING
Serial.print(millis());
Serial.println(": finished inactivity -- chuck is active");
#endif
#endif
watchdog_setup(WDTO_250MS);
} // handleInactivity()


Expand Down

0 comments on commit 2dc2f71

Please sign in to comment.