diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 85a69cc483..df1c1d245f 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -874,6 +874,7 @@ #define HOMING_BUMP_DIVISOR { 2, 2, 4 } // Re-Bump Speed Divisor (Divides the Homing Feedrate) //#define HOMING_BACKOFF_POST_MM { 2, 2, 2 } // (linear=mm, rotational=°) Backoff from endstops after homing +//#define XY_COUNTERPART_BACKOFF_MM 0 // (mm) Backoff X after homing Y, and vice-versa //#define QUICK_HOME // If G28 contains XY do a diagonal move first //#define HOME_Y_BEFORE_X // If G28 contains XY home Y before X diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 6101022fd4..c0503c621d 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1994,6 +1994,17 @@ void prepare_line_to_destination() { } #endif + // + // Back away to prevent opposite endstop damage + // + #if !defined(SENSORLESS_BACKOFF_MM) && XY_COUNTERPART_BACKOFF_MM + if (!(axis_was_homed(X_AXIS) || axis_was_homed(Y_AXIS)) && (axis == X_AXIS || axis == Y_AXIS)) { + const AxisEnum opposite_axis = axis == X_AXIS ? Y_AXIS : X_AXIS; + const float backoff_length = -ABS(XY_COUNTERPART_BACKOFF_MM) * home_dir(opposite_axis); + do_homing_move(opposite_axis, backoff_length, homing_feedrate(opposite_axis)); + } + #endif + // Determine if a homing bump will be done and the bumps distance // When homing Z with probe respect probe clearance const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(axis));