Skip to content

Commit

Permalink
crashdet_cancel doesnt cleanup all variables when using Octoprint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gudnimg committed Jul 14, 2023
1 parent 5295bfa commit 9e78b13
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions Firmware/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,16 +640,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 == PRINTING_TYPE_SD) {
print_stop();
}else if(saved_printing_type == PRINTING_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
Expand Down Expand Up @@ -9462,8 +9455,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;
Expand Down

0 comments on commit 9e78b13

Please sign in to comment.