From c3756106688cae9dbb08e95ae5294e11a8cae749 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Thu, 10 Jun 2021 17:02:41 +0200 Subject: [PATCH] Move "WDR dump" inside EMERGENGENCY_DUMP --- Firmware/Marlin_main.cpp | 12 ++++++++++-- Firmware/ultralcd.cpp | 11 +++++------ Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h | 2 +- Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h | 2 +- Firmware/xflash_dump.cpp | 9 +-------- Firmware/xyzcal.cpp | 4 ++-- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index dd713737..50d5bee3 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -1667,12 +1667,20 @@ void setup() KEEPALIVE_STATE(NOT_BUSY); #ifdef WATCHDOG wdt_enable(WDTO_4S); -#ifdef XFLASH_DUMP +#ifdef EMERGENCY_DUMP WDTCSR |= (1 << WDIE); -#endif //XFLASH_DUMP +#endif //EMERGENCY_DUMP #endif //WATCHDOG } +#if defined(WATCHDOG) && defined(EMERGENCY_DUMP) +ISR(WDT_vect) +{ + WRITE(BEEPER, 1); + eeprom_update_byte((uint8_t*)EEPROM_CRASH_ACKNOWLEDGED, 0); + xfdump_full_dump_and_reset(dump_crash_source::watchdog); +} +#endif void trace(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index ba8f42e7..f9303b48 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -1811,16 +1811,15 @@ static void lcd_dump_memory() xfdump_dump(); lcd_return_to_status(); } +#endif //MENU_DUMP -#ifdef DEBUG_BUILD +#if defined(WATCHDOG) && defined(EMERGENCY_DUMP) && defined(DEBUG_BUILD) static void lcd_wdr_crash() { while (1); } #endif -#endif //MENU_DUMP - //! @brief Show Support Menu //! @@ -2015,11 +2014,11 @@ static void lcd_support_menu() #ifdef MENU_DUMP MENU_ITEM_FUNCTION_P(_i("Dump memory"), lcd_dump_memory); -#ifdef DEBUG_BUILD - MENU_ITEM_FUNCTION_P(PSTR("WDR crash"), lcd_wdr_crash); -#endif //DEBUG_BUILD #endif //MENU_DUMP #ifdef DEBUG_BUILD +#if defined(WATCHDOG) && defined(EMERGENCY_DUMP) + MENU_ITEM_FUNCTION_P(PSTR("WDR crash"), lcd_wdr_crash); +#endif MENU_ITEM_SUBMENU_P(PSTR("Debug"), lcd_menu_debug);////MSG_DEBUG c=18 #endif /* DEBUG_BUILD */ diff --git a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h index ab65d024..b03fe726 100644 --- a/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3-EINSy10a-E3Dv6full.h @@ -142,7 +142,7 @@ // Offline crash dumper //#define XFLASH_DUMP // enable dump functionality (including D20/D21/D22) //#define MENU_DUMP // enable "Memory dump" in Settings menu -//#define EMERGENCY_DUMP // trigger crash on stack corruption +//#define EMERGENCY_DUMP // trigger crash on stack corruption and WDR // Filament sensor #define FILAMENT_SENSOR diff --git a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h index 48154903..934c0913 100644 --- a/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h +++ b/Firmware/variants/1_75mm_MK3S-EINSy10a-E3Dv6full.h @@ -144,7 +144,7 @@ // Offline crash dumper //#define XFLASH_DUMP // enable dump functionality (including D20/D21/D22) //#define MENU_DUMP // enable "Memory dump" in Settings menu -//#define EMERGENCY_DUMP // trigger crash on stack corruption +//#define EMERGENCY_DUMP // trigger crash on stack corruption and WDR // Filament sensor #define FILAMENT_SENSOR diff --git a/Firmware/xflash_dump.cpp b/Firmware/xflash_dump.cpp index 66a85112..5667e41c 100644 --- a/Firmware/xflash_dump.cpp +++ b/Firmware/xflash_dump.cpp @@ -6,14 +6,7 @@ #include "xflash_dump.h" #ifdef XFLASH_DUMP #include "xflash.h" -#include "Marlin.h" - -ISR(WDT_vect) -{ - WRITE(BEEPER, 1); - eeprom_update_byte((uint8_t*)EEPROM_CRASH_ACKNOWLEDGED, 0); - xfdump_full_dump_and_reset(dump_crash_source::watchdog); -} +#include "Marlin.h" // for softReset bool xfdump_check_state() { diff --git a/Firmware/xyzcal.cpp b/Firmware/xyzcal.cpp index 06544f19..bc335307 100644 --- a/Firmware/xyzcal.cpp +++ b/Firmware/xyzcal.cpp @@ -163,9 +163,9 @@ void xyzcal_meassure_leave(void) ENABLE_STEPPER_DRIVER_INTERRUPT(); #ifdef WATCHDOG wdt_enable(WDTO_4S); -#ifdef XFLASH_DUMP +#ifdef EMERGENCY_DUMP WDTCSR |= (1 << WDIE); -#endif //XFLASH_DUMP +#endif //EMERGENCY_DUMP #endif //WATCHDOG sm4_stop_cb = 0; sm4_update_pos_cb = 0;