@@ -384,18 +384,25 @@ void PrintJobRecovery::resume() {
384384 // Home safely with no Z raise
385385 gcode.process_subcommands_now_P (PSTR (
386386 " G28R0" // No raise during G28
387- #if IS_CARTESIAN && DISABLED(POWER_LOSS_RECOVER_ZHOME)
387+ #if IS_CARTESIAN && ( DISABLED(POWER_LOSS_RECOVER_ZHOME) || defined(POWER_LOSS_ZHOME_POS) )
388388 " XY" // Don't home Z on Cartesian unless overridden
389389 #endif
390390 ));
391391
392392 #endif
393393
394- // Pretend that all axes are homed
394+ #ifdef POWER_LOSS_ZHOME_POS
395+ // If defined move to a safe Z homing position that avoids the print
396+ constexpr xy_pos_t homepos = POWER_LOSS_ZHOME_POS;
397+ sprintf_P (cmd, PSTR (" G1 X%s Y%s F1000\n G28Z" , dtostrf (homepos.x , 1 , 3 , str_1), dtostrf (homepos.y , 1 , 3 , str_2)));
398+ gcode.process_subcommands_now (cmd);
399+ #endif
400+
401+ // Ensure that all axes are marked as homed
395402 set_all_homed ();
396403
397404 #if ENABLED(POWER_LOSS_RECOVER_ZHOME)
398- // Z has been homed so restore Z to ZsavedPos + POWER_LOSS_ZRAISE
405+ // Now move to ZsavedPos + POWER_LOSS_ZRAISE
399406 sprintf_P (cmd, PSTR (" G1 F500 Z%s" ), dtostrf (info.current_position .z + POWER_LOSS_ZRAISE, 1 , 3 , str_1));
400407 gcode.process_subcommands_now (cmd);
401408 #endif
@@ -467,7 +474,7 @@ void PrintJobRecovery::resume() {
467474
468475 // Additional purge if configured
469476 #if POWER_LOSS_PURGE_LEN
470- sprintf_P (cmd, PSTR (" G1 E%d F200 " ), (POWER_LOSS_PURGE_LEN) + (POWER_LOSS_RETRACT_LEN));
477+ sprintf_P (cmd, PSTR (" G1 E%d F3000 " ), (POWER_LOSS_PURGE_LEN) + (POWER_LOSS_RETRACT_LEN));
471478 gcode.process_subcommands_now (cmd);
472479 #endif
473480
@@ -485,7 +492,7 @@ void PrintJobRecovery::resume() {
485492 // Move back to the saved Z
486493 dtostrf (info.current_position .z , 1 , 3 , str_1);
487494 #if Z_HOME_DIR > 0 || ENABLED(POWER_LOSS_RECOVER_ZHOME)
488- sprintf_P (cmd, PSTR (" G1 Z%s F200 " ), str_1);
495+ sprintf_P (cmd, PSTR (" G1 Z%s F500 " ), str_1);
489496 #else
490497 gcode.process_subcommands_now_P (PSTR (" G1 Z0 F200" ));
491498 sprintf_P (cmd, PSTR (" G92.9 Z%s" ), str_1);
0 commit comments