Browse Source

✨ XY_COUNTERPART_BACKOFF_MM

studiodyne 2 years ago
parent
commit
458e1aea41
2 changed files with 12 additions and 0 deletions
  1. 1
    0
      Marlin/Configuration_adv.h
  2. 11
    0
      Marlin/src/module/motion.cpp

+ 1
- 0
Marlin/Configuration_adv.h View File

@@ -874,6 +874,7 @@
874 874
 #define HOMING_BUMP_DIVISOR { 2, 2, 4 }       // Re-Bump Speed Divisor (Divides the Homing Feedrate)
875 875
 
876 876
 //#define HOMING_BACKOFF_POST_MM { 2, 2, 2 }  // (linear=mm, rotational=°) Backoff from endstops after homing
877
+//#define XY_COUNTERPART_BACKOFF_MM 0         // (mm) Backoff X after homing Y, and vice-versa
877 878
 
878 879
 //#define QUICK_HOME                          // If G28 contains XY do a diagonal move first
879 880
 //#define HOME_Y_BEFORE_X                     // If G28 contains XY home Y before X

+ 11
- 0
Marlin/src/module/motion.cpp View File

@@ -1994,6 +1994,17 @@ void prepare_line_to_destination() {
1994 1994
       }
1995 1995
     #endif
1996 1996
 
1997
+    //
1998
+    // Back away to prevent opposite endstop damage
1999
+    //
2000
+    #if !defined(SENSORLESS_BACKOFF_MM) && XY_COUNTERPART_BACKOFF_MM
2001
+      if (!(axis_was_homed(X_AXIS) || axis_was_homed(Y_AXIS)) && (axis == X_AXIS || axis == Y_AXIS)) {
2002
+        const AxisEnum opposite_axis = axis == X_AXIS ? Y_AXIS : X_AXIS;
2003
+        const float backoff_length = -ABS(XY_COUNTERPART_BACKOFF_MM) * home_dir(opposite_axis);
2004
+        do_homing_move(opposite_axis, backoff_length, homing_feedrate(opposite_axis));
2005
+      }
2006
+    #endif
2007
+
1997 2008
     // Determine if a homing bump will be done and the bumps distance
1998 2009
     // When homing Z with probe respect probe clearance
1999 2010
     const bool use_probe_bump = TERN0(HOMING_Z_WITH_PROBE, axis == Z_AXIS && home_bump_mm(axis));

Loading…
Cancel
Save