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