Browse Source

Limit Switch locations based on MIN/MAX limits and homing direction

fixes #246
Added statements to set the limit switch positions to the maximum travel if homing in the positive direction as well as bed center at (0,0) if defined.
Relocated code based on feedback.
ZetaPhoenix 13 years ago
parent
commit
c6caa45ae2
2 changed files with 54 additions and 48 deletions
  1. 6
    48
      Marlin/Configuration.h
  2. 48
    0
      Marlin/Configuration_adv.h

+ 6
- 48
Marlin/Configuration.h View File

@@ -204,55 +204,13 @@ const bool Z_ENDSTOPS_INVERTING = true; // set to true to invert the logic of th
204 204
 #define Z_MAX_LENGTH (Z_MAX_POS - Z_MIN_POS)
205 205
 
206 206
 // The position of the homing switches
207
-// Auto switch code by ZetaPhoenix
208
-//#define MANUAL_HOME_POSITIONS  //If defined, manualy programed locations will be loaded
209
-//#define BED_CENTER_AT_0_0
210
-
211
-#ifdef MANUAL_HOME_POSITION  //Manual limit switch locations
212
-  #define X_HOME_POS 0
213
-  #define Y_HOME_POS 0
214
-  #define Z_HOME_POS 0
215
-
216
-//Set min/max homing switch positions based upon direction and min/max travel limits
217
-#else
218
-  //X axis
219
-  #if X_HOME_DIR == -1
220
-    #ifdef BED_CENTER_AT_0_0
221
-      #define X_HOME_POS X_MAX_LENGTH * -0.5
222
-    #else
223
-      #define X_HOME_POS X_MIN_POS
224
-    #endif //BED_CENTER_AT_0_0
225
-  #else    
226
-    #ifdef BED_CENTER_AT_0_0
227
-      #define X_HOME_POS X_MAX_LENGTH * 0.5
228
-    #else
229
-      #define X_HOME_POS X_MAX_POS
230
-    #endif //BED_CENTER_AT_0_0
231
-  #endif //X_HOME_DIR == -1
232
-  
233
-  //Y axis
234
-  #if Y_HOME_DIR == -1
235
-    #ifdef BED_CENTER_AT_0_0
236
-      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
237
-    #else
238
-      #define Y_HOME_POS Y_MIN_POS
239
-    #endif //BED_CENTER_AT_0_0
240
-  #else    
241
-    #ifdef BED_CENTER_AT_0_0
242
-      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
243
-    #else
244
-      #define Y_HOME_POS Y_MAX_POS
245
-    #endif //BED_CENTER_AT_0_0
246
-  #endif //Y_HOME_DIR == -1
247
-  
248
-  // Z axis
249
-  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
250
-    #define Z_HOME_POS Z_MIN_POS
251
-  #else    
252
-    #define Z_HOME_POS Z_MAX_POS
253
-  #endif //Z_HOME_DIR == -1
254
-#endif //End auto min/max positions
207
+//#define MANUAL_HOME_POSITIONS  // If defined, manualy programed locations will be used
208
+//#define BED_CENTER_AT_0_0  // If defined the center of the bed is defined as (0,0)
255 209
 
210
+//Manual homing switch locations:
211
+#define MANUAL_X_HOME_POS 0
212
+#define MANUAL_Y_HOME_POS 0
213
+#define MANUAL_Z_HOME_POS 0
256 214
 
257 215
 //// MOVEMENT SETTINGS
258 216
 #define NUM_AXIS 4 // The axis order in all axis related arrays is X, Y, Z, E

+ 48
- 0
Marlin/Configuration_adv.h View File

@@ -76,6 +76,54 @@
76 76
 
77 77
 #define ENDSTOPS_ONLY_FOR_HOMING // If defined the endstops will only be used for homing
78 78
 
79
+
80
+//// AUTOSET LOCATIONS OF LIMIT SWITCHES
81
+//// Added by ZetaPhoenix 09-15-2012
82
+#ifdef MANUAL_HOME_POSITION  //Use manual limit switch locations
83
+  #define X_HOME_POS MANUAL_X_HOME_POS
84
+  #define Y_HOME_POS MANUAL_Y_HOME_POS
85
+  #define Z_HOME_POS MANUAL_Z_HOME_POS
86
+#else //Set min/max homing switch positions based upon homing direction and min/max travel limits
87
+  //X axis
88
+  #if X_HOME_DIR == -1
89
+    #ifdef BED_CENTER_AT_0_0
90
+      #define X_HOME_POS X_MAX_LENGTH * -0.5
91
+    #else
92
+      #define X_HOME_POS X_MIN_POS
93
+    #endif //BED_CENTER_AT_0_0
94
+  #else    
95
+    #ifdef BED_CENTER_AT_0_0
96
+      #define X_HOME_POS X_MAX_LENGTH * 0.5
97
+    #else
98
+      #define X_HOME_POS X_MAX_POS
99
+    #endif //BED_CENTER_AT_0_0
100
+  #endif //X_HOME_DIR == -1
101
+  
102
+  //Y axis
103
+  #if Y_HOME_DIR == -1
104
+    #ifdef BED_CENTER_AT_0_0
105
+      #define Y_HOME_POS Y_MAX_LENGTH * -0.5
106
+    #else
107
+      #define Y_HOME_POS Y_MIN_POS
108
+    #endif //BED_CENTER_AT_0_0
109
+  #else    
110
+    #ifdef BED_CENTER_AT_0_0
111
+      #define Y_HOME_POS Y_MAX_LENGTH * 0.5
112
+    #else
113
+      #define Y_HOME_POS Y_MAX_POS
114
+    #endif //BED_CENTER_AT_0_0
115
+  #endif //Y_HOME_DIR == -1
116
+  
117
+  // Z axis
118
+  #if Z_HOME_DIR == -1 //BED_CENTER_AT_0_0 not used
119
+    #define Z_HOME_POS Z_MIN_POS
120
+  #else    
121
+    #define Z_HOME_POS Z_MAX_POS
122
+  #endif //Z_HOME_DIR == -1
123
+#endif //End auto min/max positions
124
+//END AUTOSET LOCATIONS OF LIMIT SWITCHES -ZP
125
+
126
+
79 127
 //#define Z_LATE_ENABLE // Enable Z the last moment. Needed if your Z driver overheats.
80 128
 
81 129
 // A single Z stepper driver is usually used to drive 2 stepper motors.

Loading…
Cancel
Save