From 3b65aa06c564c9f81f5bd01d043b804c59655608 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 17 Dec 2022 16:11:31 +0100 Subject: [PATCH] TM: Clear the Stopped state when stopping the current print We allow resuming from the LCD via start print and resume print, it makes sense to clear the error on stop too. For this reason distinguish whether the action is performed automatically or manually (ie: interactively). The error is only cleared when the command is run interactively. --- Firmware/Marlin_main.cpp | 6 +++--- Firmware/ultralcd.cpp | 12 +++++++++++- Firmware/ultralcd.h | 3 ++- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index c37009020..f2c4a75c9 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -678,7 +678,7 @@ void crashdet_cancel() saved_printing = false; tmc2130_sg_stop_on_crash = true; if (saved_printing_type == PRINTING_TYPE_SD) { - lcd_print_stop(); + 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(); @@ -7913,7 +7913,7 @@ Sigma_Exit: ### M603 - Stop print M603: Stop print */ case 603: { - lcd_print_stop(); + print_stop(); } break; @@ -9743,7 +9743,7 @@ void ThermalStop(bool allow_pause) } } else { // We got a hard thermal error and/or there is no print going on. Just stop. - lcd_print_stop(); + print_stop(); } // Report the status on the serial, switch to a busy state diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 0aa5b6237..74ca71445 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -6067,7 +6067,7 @@ void lcd_print_stop_finish() axis_relative_modes = E_AXIS_MASK; //XYZ absolute, E relative } -void lcd_print_stop() +void print_stop(bool interactive) { // UnconditionalStop() will internally cause planner_abort_hard(), meaning we _cannot_ plan any // more move in this call! Any further move must happen inside lcd_print_stop_finish(), which is @@ -6086,11 +6086,21 @@ void lcd_print_stop() pause_time = 0; isPrintPaused = false; + if (interactive) { + // acknowledged by the user from the LCD: resume processing USB commands again + Stopped = false; + } + // return to status is required to continue processing in the main loop! lcd_commands_type = LcdCommands::StopPrint; lcd_return_to_status(); } +void lcd_print_stop() +{ + print_stop(true); +} + #ifdef TEMP_MODEL void lcd_temp_model_cal() { diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 467acb3fc..f45935fc2 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -47,7 +47,8 @@ void lcd_sdcard_stop(); void lcd_pause_print(); void lcd_pause_usb_print(); void lcd_resume_print(); -void lcd_print_stop(); +void lcd_print_stop(); // interactive print stop +void print_stop(bool interactive=false); #ifdef TEMP_MODEL void lcd_temp_model_cal(); #endif //TEMP_MODEL