From a0dc66f7bfab6815c4a64a1fbf02dd82d1d75d11 Mon Sep 17 00:00:00 2001
From: Bernhard <bkubicek@x201.(none)>
Date: Sat, 26 Nov 2011 12:04:06 +0100
Subject: [PATCH] Home retract distance configureable per axis.

---
 Marlin/Configuration.h | 5 +++++
 Marlin/Marlin.pde      | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h
index 17a8854638..7bd94f6403 100644
--- a/Marlin/Configuration.h
+++ b/Marlin/Configuration.h
@@ -207,6 +207,11 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E
 #define HOMING_FEEDRATE {50*60, 50*60, 4*60, 0}  // set the homing speeds (mm/min)
 
+//homing hits the endstop, then retracts by this distance, before it tries to slowly bump again:
+#define X_HOME_RETRACT_MM 5 
+#define Y_HOME_RETRACT_MM 5 
+#define Z_HOME_RETRACT_MM 1 
+
 #define AXIS_RELATIVE_MODES {false, false, false, false}
 
 #define MAX_STEP_FREQUENCY 40000 // Max step frequency for Ultimaker (5000 pps / half step)
diff --git a/Marlin/Marlin.pde b/Marlin/Marlin.pde
index d94f810c1d..d765d222b6 100644
--- a/Marlin/Marlin.pde
+++ b/Marlin/Marlin.pde
@@ -469,10 +469,10 @@ inline bool code_seen(char code)
     \
     current_position[LETTER##_AXIS] = 0;\
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);\
-    destination[LETTER##_AXIS] = -5 * LETTER##_HOME_DIR;\
+    destination[LETTER##_AXIS] = -LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
     prepare_move(); \
     \
-    destination[LETTER##_AXIS] = 10 * LETTER##_HOME_DIR;\
+    destination[LETTER##_AXIS] = 2*LETTER##_HOME_RETRACT_MM * LETTER##_HOME_DIR;\
     feedrate = homing_feedrate[LETTER##_AXIS]/2 ;  \
     prepare_move(); \
     \
-- 
GitLab