diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6e0ddcf9..15fdc7c2 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1727,6 +1727,21 @@ ISR(WDT_vect) } #endif +#if defined(WATCHDOG) && defined(EMERGENCY_HANDLERS) +ISR(BADISR_vect) +{ + WRITE(BEEPER, HIGH); + eeprom_update_byte((uint8_t*)EEPROM_FW_CRASH_FLAG, (uint8_t)dump_crash_reason::bad_isr); +#ifdef EMERGENCY_DUMP + xfdump_full_dump_and_reset(dump_crash_reason::bad_isr); +#elif defined(EMERGENCY_SERIAL_DUMP) + if(emergency_serial_dump) + serial_dump_and_reset(dump_crash_reason::bad_isr); +#endif + softReset(); +} +#endif + void stack_error() { WRITE(BEEPER, HIGH); diff --git a/Firmware/xflash_dump.h b/Firmware/xflash_dump.h index f517a592..8866b1ec 100644 --- a/Firmware/xflash_dump.h +++ b/Firmware/xflash_dump.h @@ -7,6 +7,7 @@ enum class dump_crash_reason : uint8_t manual = 0, stack_error, watchdog, + bad_isr, }; #ifdef XFLASH_DUMP