Fix interrupts not enabled during setup()

This commit is contained in:
Alex Voinea 2022-12-16 16:46:08 +01:00
parent d43a7da20d
commit c5d406d12f
1 changed files with 6 additions and 4 deletions

View File

@ -84,6 +84,7 @@
#include "Prusa_farm.h"
#include <avr/wdt.h>
#include <util/atomic.h>
#include <avr/pgmspace.h>
#include "Tcodes.h"
@ -692,10 +693,11 @@ void watchdogEarlyDisable(void) {
// leaving it enabled when jumping to the program. This could cause another watchdog reset
// during setup() if not handled properly. So to avoid any issue of this kind, stop the
// watchdog timer manually.
cli();
wdt_reset();
MCUSR &= ~_BV(WDRF);
wdt_disable();
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
wdt_reset();
MCUSR &= ~_BV(WDRF);
wdt_disable();
}
}
void softReset(void) {