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.
This commit is contained in:
Yuri D'Elia 2022-12-17 16:11:31 +01:00 committed by 3d-gussner
parent 94583c861b
commit 3b65aa06c5
3 changed files with 16 additions and 5 deletions

View file

@ -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 <a href="https://reprap.org/wiki/G-code#M603:_Stop_print">M603: Stop print</a>
*/
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

View file

@ -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()
{

View file

@ -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