PFW-446 Stop print fix (recursion in lcd_update)

This commit is contained in:
Robert Pelnar 2018-07-19 14:23:45 +02:00
parent 6db1c6dc3b
commit 42d2f31248

View file

@ -6044,13 +6044,15 @@ static void lcd_sd_updir()
menu_top = 0;
}
void lcd_print_stop() {
void lcd_print_stop()
{
cancel_heatup = true;
#ifdef MESH_BED_LEVELING
mbl.active = false;
#endif
// Stop the stoppers, update the position from the stoppers.
if (mesh_bed_leveling_flag == false && homing_flag == false) {
if (mesh_bed_leveling_flag == false && homing_flag == false)
{
planner_abort_hard();
// Because the planner_abort_hard() initialized current_position[Z] from the stepper,
// Z baystep is no more applied. Reset it.
@ -6059,20 +6061,16 @@ void lcd_print_stop() {
// Clean the input command queue.
cmdqueue_reset();
lcd_setstatuspgm(_T(MSG_PRINT_ABORTED));
lcd_update(2);
card.sdprinting = false;
card.closefile();
stoptime = millis();
unsigned long t = (stoptime - starttime - pause_time) / 1000; //time in s
pause_time = 0;
save_statistics(total_filament_used, t);
lcd_return_to_status();
lcd_ignore_click(true);
lcd_commands_step = 0;
lcd_commands_type = LCD_COMMAND_STOP_PRINT;
// Turn off the print fan
SET_OUTPUT(FAN_PIN);
WRITE(FAN_PIN, 0);