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
This commit is contained in:
Guðni Már Gilbert 2023-05-14 12:04:43 +00:00
parent 8615a8dad5
commit 3ad40f0206
1 changed files with 7 additions and 12 deletions

View File

@ -635,16 +635,9 @@ void crashdet_recover()
if (lcd_crash_detect_enabled()) tmc2130_sg_stop_on_crash = true; if (lcd_crash_detect_enabled()) tmc2130_sg_stop_on_crash = true;
} }
void crashdet_cancel() /// Crash detection cancels the print
{ void crashdet_cancel() {
saved_printing = false; print_stop();
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();
}
} }
#endif //TMC2130 #endif //TMC2130
@ -9693,8 +9686,10 @@ void UnconditionalStop()
cmdqueue_serial_disabled = false; cmdqueue_serial_disabled = false;
// Reset the sd status // Reset the sd status
card.sdprinting = false; if (card.sdprinting) {
card.closefile(); card.sdprinting = false;
card.closefile();
}
st_reset_timer(); st_reset_timer();
CRITICAL_SECTION_END; CRITICAL_SECTION_END;