From 3ad40f02064f1870cdec7fe4d9ce1bd7a2ff6ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 14 May 2023 12:04:43 +0000 Subject: [PATCH] crashdet_cancel doesnt cleanup all variables when using Octoprint I would think that this should behave similarly as when stopping the print via the LCD. Changed UnconditionalSto()p to not close the SD card file if we're using Octoprint. Then there shouldnt be any file open. Some of the variables which were not reset: isPrintPaused pause_time saved_start_position saved_printing_type Bed heater may be left on? Change in memory: Flash: -28 bytes SRAM: 0 bytes --- Firmware/Marlin_main.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 331e4c245..b9f6ea304 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -635,16 +635,9 @@ void crashdet_recover() if (lcd_crash_detect_enabled()) tmc2130_sg_stop_on_crash = true; } -void crashdet_cancel() -{ - saved_printing = false; - tmc2130_sg_stop_on_crash = true; - if (saved_printing_type == PowerPanic::PRINT_TYPE_SD) { - print_stop(); - }else if(saved_printing_type == PowerPanic::PRINT_TYPE_USB){ - SERIAL_ECHOLNRPGM(MSG_OCTOPRINT_CANCEL); //for Octoprint: works the same as clicking "Abort" button in Octoprint GUI - cmdqueue_reset(); - } +/// Crash detection cancels the print +void crashdet_cancel() { + print_stop(); } #endif //TMC2130 @@ -9693,8 +9686,10 @@ void UnconditionalStop() cmdqueue_serial_disabled = false; // Reset the sd status - card.sdprinting = false; - card.closefile(); + if (card.sdprinting) { + card.sdprinting = false; + card.closefile(); + } st_reset_timer(); CRITICAL_SECTION_END;