|
@@ -242,12 +242,16 @@ void GcodeSuite::G28() {
|
242
|
242
|
SET_SOFT_ENDSTOP_LOOSE(false); // Reset a leftover 'loose' motion state
|
243
|
243
|
|
244
|
244
|
// Disable the leveling matrix before homing
|
245
|
|
- #if HAS_LEVELING
|
246
|
|
- const bool leveling_restore_state = parser.boolval('L', TERN(RESTORE_LEVELING_AFTER_G28, planner.leveling_active, ENABLED(ENABLE_LEVELING_AFTER_G28)));
|
247
|
|
- IF_ENABLED(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session
|
248
|
|
- set_bed_leveling_enabled(false);
|
|
245
|
+ #if CAN_SET_LEVELING_AFTER_G28
|
|
246
|
+ const bool leveling_restore_state = parser.boolval('L', TERN1(RESTORE_LEVELING_AFTER_G28, planner.leveling_active));
|
249
|
247
|
#endif
|
250
|
248
|
|
|
249
|
+ // Cancel any prior G29 session
|
|
250
|
+ TERN_(PROBE_MANUALLY, g29_in_progress = false);
|
|
251
|
+
|
|
252
|
+ // Disable leveling before homing
|
|
253
|
+ TERN_(HAS_LEVELING, set_bed_leveling_enabled(false));
|
|
254
|
+
|
251
|
255
|
// Reset to the XY plane
|
252
|
256
|
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY);
|
253
|
257
|
|
|
@@ -353,13 +357,14 @@ void GcodeSuite::G28() {
|
353
|
357
|
|
354
|
358
|
const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT;
|
355
|
359
|
|
356
|
|
- if (z_homing_height && (0 LINEAR_AXIS_GANG(|| doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) {
|
|
360
|
+ if (z_homing_height && (LINEAR_AXIS_GANG(doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) {
|
357
|
361
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
358
|
362
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) by ", z_homing_height);
|
359
|
363
|
do_z_clearance(z_homing_height);
|
360
|
364
|
TERN_(BLTOUCH, bltouch.init());
|
361
|
365
|
}
|
362
|
366
|
|
|
367
|
+ // Diagonal move first if both are homing
|
363
|
368
|
TERN_(QUICK_HOME, if (doX && doY) quick_home_xy());
|
364
|
369
|
|
365
|
370
|
// Home Y (before X)
|
|
@@ -464,12 +469,10 @@ void GcodeSuite::G28() {
|
464
|
469
|
// Clear endstop state for polled stallGuard endstops
|
465
|
470
|
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state());
|
466
|
471
|
|
467
|
|
- #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
|
468
|
|
- // move to a height where we can use the full xy-area
|
469
|
|
- do_blocking_move_to_z(delta_clip_start_height);
|
470
|
|
- #endif
|
|
472
|
+ // Move to a height where we can use the full xy-area
|
|
473
|
+ TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height));
|
471
|
474
|
|
472
|
|
- TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_restore_state));
|
|
475
|
+ TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled());
|
473
|
476
|
|
474
|
477
|
restore_feedrate_and_scaling();
|
475
|
478
|
|