From 571906a494ac07d3450854b15b3068ecc5eb0655 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 28 Jan 2020 21:55:16 +0100 Subject: [PATCH 1/2] Do not update saved_target if there's no current_block There is a chance that current_block can be NULL despite the queue being non-empty. This can happen early after a block has been queued, but before the isr has picked it up for processing, and/or when the current block is at the last step and is being discarded. Check for current_block directly to avoid this race. --- Firmware/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 20a269af5..9d00d42bd 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -10529,7 +10529,7 @@ void uvlo_() // save the global state at planning time uint16_t feedrate_bckp; - if (blocks_queued()) + if (current_block) { memcpy(saved_target, current_block->gcode_target, sizeof(saved_target)); feedrate_bckp = current_block->gcode_feedrate; @@ -11129,7 +11129,7 @@ void stop_and_save_print_to_ram(float z_move, float e_move) #endif // save the global state at planning time - if (blocks_queued()) + if (current_block) { memcpy(saved_target, current_block->gcode_target, sizeof(saved_target)); saved_feedrate2 = current_block->gcode_feedrate; From 1db024f17af6ed22f7836ebb553f6b7fe5215227 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 28 Jan 2020 22:03:38 +0100 Subject: [PATCH 2/2] Always raise the extruder 25mm during power recovery Avoids oozed material (drooping more than ~1mm) to scrape and potentially detach the print. --- Firmware/Marlin_main.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 9d00d42bd..abd4c3685 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -10798,10 +10798,13 @@ void recover_print(uint8_t automatic) { // Recover position, temperatures and extrude_multipliers bool mbl_was_active = recover_machine_state_after_power_panic(); - // Attempt to lift the print head on the first recovery, so one may remove the excess priming material. - bool raise_z = (eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1); - if(raise_z && (current_position[Z_AXIS]<25)) - enquecommand_P(PSTR("G1 Z25 F800")); + // Lift the print head 25mm, first to avoid collisions with oozed material with the print, + // and second also so one may remove the excess priming material. + if(eeprom_read_byte((uint8_t*)EEPROM_UVLO) == 1) + { + sprintf_P(cmd, PSTR("G1 Z%.3f F800"), current_position[Z_AXIS] + 25); + enquecommand(cmd); + } // Home X and Y axes. Homing just X and Y shall not touch the babystep and the world2machine // transformation status. G28 will not touch Z when MBL is off.