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:
@@ -78,6 +78,16 @@ void printReset(const char *label, uint8_t resetFlags)
|
||||
}
|
||||
|
||||
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.println(F("Reset flag test\n"));
|
||||
|
Reference in New Issue
Block a user