From 6e2f016655586137977d87c87c09656bfb0e1a15 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 a3b292512..9e64dd7bd 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -666,7 +666,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(); @@ -7848,7 +7848,7 @@ Sigma_Exit: ### M603 - Stop print M603: Stop print */ case 603: { - lcd_print_stop(); + print_stop(); } break; @@ -9611,7 +9611,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 747a89a63..b3a7f5175 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -5906,7 +5906,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 @@ -5925,11 +5925,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 937e950d6..761111d04 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -46,7 +46,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