From d193d0f7ac7fef41b9180e6a4636c4be587273f1 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 15 Jun 2021 16:21:56 +0200 Subject: [PATCH] serial_dump: manipulate WDT just once --- Firmware/Dcodes.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Firmware/Dcodes.cpp b/Firmware/Dcodes.cpp index 0b2943b06..09c412994 100644 --- a/Firmware/Dcodes.cpp +++ b/Firmware/Dcodes.cpp @@ -973,9 +973,12 @@ bool emergency_serial_dump = false; void serial_dump_and_reset(uint16_t sp, dump_crash_reason reason) { - // we're being called from a live state, so shut off interrupts and heaters cli(); - wdt_enable(WDTO_15MS); + + // extend WDT long enough to allow writing the entire stream + wdt_enable(WDTO_8S); + + // we're being called from a live state, so shut off interrupts and heaters WRITE(FAN_PIN, HIGH); disable_heater(); @@ -987,8 +990,6 @@ void serial_dump_and_reset(uint16_t sp, dump_crash_reason reason) SERIAL_ECHO(" "); SERIAL_ECHOLN((unsigned)reason); - // set WDT long enough to allow writing the entire stream - wdt_enable(WDTO_8S); print_mem(0, RAMEND+1, dcode_mem_t::sram); SERIAL_ECHOLNRPGM(MSG_OK);