Fix interrupts not enabled during setup()
This commit is contained in:
parent
d43a7da20d
commit
c5d406d12f
|
|
@ -84,6 +84,7 @@
|
||||||
#include "Prusa_farm.h"
|
#include "Prusa_farm.h"
|
||||||
|
|
||||||
#include <avr/wdt.h>
|
#include <avr/wdt.h>
|
||||||
|
#include <util/atomic.h>
|
||||||
#include <avr/pgmspace.h>
|
#include <avr/pgmspace.h>
|
||||||
|
|
||||||
#include "Tcodes.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
|
// 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
|
// during setup() if not handled properly. So to avoid any issue of this kind, stop the
|
||||||
// watchdog timer manually.
|
// watchdog timer manually.
|
||||||
cli();
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
wdt_reset();
|
wdt_reset();
|
||||||
MCUSR &= ~_BV(WDRF);
|
MCUSR &= ~_BV(WDRF);
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void softReset(void) {
|
void softReset(void) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue