🚸 Fix, Improve Power-Loss Recovery (#22828)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
MOHAMMAD RASIM
2022-02-09 21:29:34 +03:00
committed by Scott Lahteine
parent 11071c7472
commit 3e18cf2b6a
8 changed files with 51 additions and 28 deletions

View File

@ -395,9 +395,10 @@ void GcodeSuite::G28() {
TERN_(HOME_Z_FIRST, if (doZ) homeaxis(Z_AXIS));
const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT;
const bool seenR = parser.seenval('R');
const float z_homing_height = seenR ? parser.value_linear_units() : Z_HOMING_HEIGHT;
if (z_homing_height && (LINEAR_AXIS_GANG(doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) {
if (z_homing_height && (seenR || LINEAR_AXIS_GANG(doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) {
// Raise Z before homing any other axes and z is not already high enough (never lower z)
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Raise Z (before homing) by ", z_homing_height);
do_z_clearance(z_homing_height);
@ -451,7 +452,11 @@ void GcodeSuite::G28() {
stepper.set_separate_multi_axis(false);
#endif
TERN(Z_SAFE_HOMING, home_z_safely(), homeaxis(Z_AXIS));
#if ENABLED(Z_SAFE_HOMING)
if (TERN1(POWER_LOSS_RECOVERY, !parser.seen_test('H'))) home_z_safely(); else homeaxis(Z_AXIS);
#else
homeaxis(Z_AXIS);
#endif
probe.move_z_after_homing();
}
#endif