1
0
mirror of https://github.com/Optiboot/optiboot.git synced 2025-08-19 09:02:05 +03:00

Add code and comment about resetting watchdog.

Which is needed if the bootloader will be invoked by the
sketch as a service ('J' command.)
This commit is contained in:
WestfW
2018-09-14 02:48:09 -07:00
parent e0f998df41
commit 20a79ce310

View File

@@ -78,6 +78,16 @@ void printReset(const char *label, uint8_t resetFlags)
} }
void setup() { void setup() {
#if 1
/*
* if we're going to allow the bootloader to be called as a service ('j" command),
* then we need to disable the WDT when the sketch starts. Essentially, there is no
* way to tell a watchdog that occurs during the sketch from the watchdog that will
* re-start the sketch when the bootloader is called from the application.
*/
MCUSR = ~(1 << WDRF); // allow us to disable WD
wdt_disable();
#endif
Serial.begin(9600); // Initialize serial port Serial.begin(9600); // Initialize serial port
Serial.println(F("Reset flag test\n")); Serial.println(F("Reset flag test\n"));