Skip to content

Commit bfe63c4

Browse files
committed
PLR: XY home height
1 parent dc6f23e commit bfe63c4

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Marlin/Configuration_adv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,10 @@
18081808
//#define POWER_LOSS_RETRACT_LEN 10 // (mm) Length of filament to retract on fail
18091809
#endif
18101810

1811+
// (ms) Absolute height for XY homing to prevent collision with printed objects.
1812+
// Zero means no raise above stored position
1813+
#define POWER_LOSS_XYHOME_HEIGHT 0
1814+
18111815
// Enable if Z homing is needed for proper recovery. 99.9% of the time this should be disabled!
18121816
//#define POWER_LOSS_RECOVER_ZHOME
18131817
#if ENABLED(POWER_LOSS_RECOVER_ZHOME)

Marlin/src/feature/powerloss.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ PrintJobRecovery recovery;
8888
#ifndef POWER_LOSS_PURGE_LEN
8989
#define POWER_LOSS_PURGE_LEN 0
9090
#endif
91+
#ifndef POWER_LOSS_XYHOME_HEIGHT
92+
#define POWER_LOSS_XYHOME_HEIGHT 0
93+
#endif
9194

9295
// Allow power-loss recovery to be aborted
9396
#define PLR_CAN_ABORT
@@ -439,9 +442,9 @@ void PrintJobRecovery::resume() {
439442

440443
// If Z homing goes to max then just move back to the "raised" position
441444
PROCESS_SUBCOMMANDS_NOW(TS(
442-
F( "G28R0\n" // Home all axes (no raise)
443-
"G1F1200Z") // Move Z down to (raised) height
444-
, p_float_t(z_now, 3)
445+
F( "G28R"), p_float_t(_MAX(POWER_LOSS_XYHOME_HEIGHT - z_now, 0), 3), // Home all axes with optional raise
446+
F("\nG1F3000X"), p_float_t(resume_pos.x, 3), 'Y', p_float_t(resume_pos.y, 3), // Return XY to original place to prevent collision while descending
447+
F("\nG1F1200Z"), p_float_t(z_now, 3) // Move Z down to (raised) height
445448
));
446449

447450
#elif DISABLED(BELTPRINTER)
@@ -463,8 +466,12 @@ void PrintJobRecovery::resume() {
463466
PROCESS_SUBCOMMANDS_NOW(TS(F("G1F600Z"), p_float_t(z_now, 3)));
464467
}
465468

466-
// Home XY with no Z raise
467-
PROCESS_SUBCOMMANDS_NOW(F("G28R0XY")); // No raise during G28
469+
470+
PROCESS_SUBCOMMANDS_NOW(TS(
471+
F( "G28XYR"), p_float_t(_MAX(POWER_LOSS_XYHOME_HEIGHT - z_now, 0), 3), // Home XY with optional Z raise
472+
F("\nG1F3000X"), p_float_t(resume_pos.x, 3), 'Y', p_float_t(resume_pos.y, 3), // Return XY to original place to prevent collision while descending
473+
F("\nG1F1200Z"), p_float_t(z_now, 3) // Move Z down to (raised) height
474+
));
468475

469476
#endif
470477

0 commit comments

Comments
 (0)