From 84376301228aaaa0e2f02a0ab1c960a32af9f271 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 21 Jan 2020 16:29:12 +0100 Subject: [PATCH] Inhibit serial processing in uvlo_ Do not process serial commands when re-enabling the global isr. While printing via USB and a power panic is triggered, *any* extra command should be ignored. Abuse the "saved_printing" variable to inhibit serial processing. --- Firmware/Marlin_main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 267bbe587..9777aa269 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -10551,15 +10551,18 @@ void uvlo_() // Store the current extruder position. eeprom_update_float((float*)(EEPROM_UVLO_CURRENT_POSITION_E), current_position[E_AXIS]); eeprom_update_byte((uint8_t*)EEPROM_UVLO_E_ABS, axis_relative_modes[3]?0:1); - // Clean the input command queue. + + // Clean the input command queue, inhibit serial processing using saved_printing cmdqueue_reset(); card.sdprinting = false; -// card.closefile(); - // Enable stepper driver interrupt to move Z axis. - // This should be fine as the planner and command queues are empty and the SD card printing is disabled. - //FIXME one may want to disable serial lines at this point of time to avoid interfering with the command queue, - // though it should not happen that the command queue is touched as the plan_buffer_line always succeed without blocking. - sei(); +// card.closefile(); + saved_printing = true; + + // Enable stepper driver interrupt to move Z axis. This should be fine as the planner and + // command queues are empty, SD card printing is disabled, usb is inhibited. + sei(); + + // retract plan_buffer_line( current_position[X_AXIS], current_position[Y_AXIS],