|
@ -242,12 +242,16 @@ void GcodeSuite::G28() { |
|
|
SET_SOFT_ENDSTOP_LOOSE(false); // Reset a leftover 'loose' motion state
|
|
|
SET_SOFT_ENDSTOP_LOOSE(false); // Reset a leftover 'loose' motion state
|
|
|
|
|
|
|
|
|
// Disable the leveling matrix before homing
|
|
|
// Disable the leveling matrix before homing
|
|
|
#if HAS_LEVELING |
|
|
#if CAN_SET_LEVELING_AFTER_G28 |
|
|
const bool leveling_restore_state = parser.boolval('L', TERN(RESTORE_LEVELING_AFTER_G28, planner.leveling_active, ENABLED(ENABLE_LEVELING_AFTER_G28))); |
|
|
const bool leveling_restore_state = parser.boolval('L', TERN1(RESTORE_LEVELING_AFTER_G28, planner.leveling_active)); |
|
|
IF_ENABLED(PROBE_MANUALLY, g29_in_progress = false); // Cancel the active G29 session
|
|
|
|
|
|
set_bed_leveling_enabled(false); |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
// Cancel any prior G29 session
|
|
|
|
|
|
TERN_(PROBE_MANUALLY, g29_in_progress = false); |
|
|
|
|
|
|
|
|
|
|
|
// Disable leveling before homing
|
|
|
|
|
|
TERN_(HAS_LEVELING, set_bed_leveling_enabled(false)); |
|
|
|
|
|
|
|
|
// Reset to the XY plane
|
|
|
// Reset to the XY plane
|
|
|
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY); |
|
|
TERN_(CNC_WORKSPACE_PLANES, workspace_plane = PLANE_XY); |
|
|
|
|
|
|
|
@ -353,13 +357,14 @@ void GcodeSuite::G28() { |
|
|
|
|
|
|
|
|
const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT; |
|
|
const float z_homing_height = parser.seenval('R') ? parser.value_linear_units() : Z_HOMING_HEIGHT; |
|
|
|
|
|
|
|
|
if (z_homing_height && (0 LINEAR_AXIS_GANG(|| doX, || doY, || TERN0(Z_SAFE_HOMING, doZ), || doI, || doJ, || doK))) { |
|
|
if (z_homing_height && (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)
|
|
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) by ", z_homing_height); |
|
|
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before homing) by ", z_homing_height); |
|
|
do_z_clearance(z_homing_height); |
|
|
do_z_clearance(z_homing_height); |
|
|
TERN_(BLTOUCH, bltouch.init()); |
|
|
TERN_(BLTOUCH, bltouch.init()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Diagonal move first if both are homing
|
|
|
TERN_(QUICK_HOME, if (doX && doY) quick_home_xy()); |
|
|
TERN_(QUICK_HOME, if (doX && doY) quick_home_xy()); |
|
|
|
|
|
|
|
|
// Home Y (before X)
|
|
|
// Home Y (before X)
|
|
@ -464,12 +469,10 @@ void GcodeSuite::G28() { |
|
|
// Clear endstop state for polled stallGuard endstops
|
|
|
// Clear endstop state for polled stallGuard endstops
|
|
|
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state()); |
|
|
TERN_(SPI_ENDSTOPS, endstops.clear_endstop_state()); |
|
|
|
|
|
|
|
|
#if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE) |
|
|
// Move to a height where we can use the full xy-area
|
|
|
// move to a height where we can use the full xy-area
|
|
|
TERN_(DELTA_HOME_TO_SAFE_ZONE, do_blocking_move_to_z(delta_clip_start_height)); |
|
|
do_blocking_move_to_z(delta_clip_start_height); |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
TERN_(HAS_LEVELING, set_bed_leveling_enabled(leveling_restore_state)); |
|
|
TERN_(CAN_SET_LEVELING_AFTER_G28, if (leveling_restore_state) set_bed_leveling_enabled()); |
|
|
|
|
|
|
|
|
restore_feedrate_and_scaling(); |
|
|
restore_feedrate_and_scaling(); |
|
|
|
|
|
|
|
|