Skip to content

Commit

Permalink
✨ XY_COUNTERPART_BACKOFF_MM
Browse files Browse the repository at this point in the history
  • Loading branch information
studiodyne authored and thinkyhead committed Dec 16, 2022
1 parent 3d03f96 commit 1f72c83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 1f72c83

Please sign in to comment.