Browse Source

Bed auto Leveling change: Raise Z before homing

- Added "Z_RAISE_BEFORE_HOMING" for raising Z the defined distance
before homing. This is useful to avoid Z-Probe collision when hotend is
near bed.

- Fixed the issue of Z not going bellow Z_PROBE_OFFSET when
"min_software_endstops" is true.
Now the Z_PROBE_OFFSET is not set in Z_MIN_POS, it is added after
homing.
Alex Borro 10 years ago
parent
commit
6f85a8c7aa
2 changed files with 22 additions and 12 deletions
  1. 4
    6
      Marlin/Configuration.h
  2. 18
    6
      Marlin/Marlin_main.cpp

+ 4
- 6
Marlin/Configuration.h View File

@@ -309,7 +309,10 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
309 309
   #define X_PROBE_OFFSET_FROM_EXTRUDER -25
310 310
   #define Y_PROBE_OFFSET_FROM_EXTRUDER -29
311 311
   #define Z_PROBE_OFFSET_FROM_EXTRUDER -12.35
312
-  
312
+
313
+  #define Z_RAISE_BEFORE_HOMING 4       // (in mm) Raise Z before homing (G28) for Probe Clearance.
314
+                                        // Be sure you have this distance over your Z_MAX_POS in case
315
+    
313 316
   #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min
314 317
   
315 318
   #define Z_RAISE_BEFORE_PROBING 15    //How much the extruder will be raised before traveling to the first probing point.
@@ -330,12 +333,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of
330 333
 #define Y_MAX_POS 205
331 334
 #define Y_MIN_POS 0
332 335
 #define Z_MAX_POS 200
333
-
334
-#ifndef ENABLE_AUTO_BED_LEVELING
335 336
 #define Z_MIN_POS 0
336
-#else
337
-#define Z_MIN_POS (-1*Z_PROBE_OFFSET_FROM_EXTRUDER)  //With Auto Bed Leveling, the Z_MIN MUST have the same distance as Z_PROBE
338
-#endif
339 337
 
340 338
 #define X_MAX_LENGTH (X_MAX_POS - X_MIN_POS)
341 339
 #define Y_MAX_LENGTH (Y_MAX_POS - Y_MIN_POS)

+ 18
- 6
Marlin/Marlin_main.cpp View File

@@ -920,19 +920,28 @@ static void homeaxis(int axis) {
920 920
       axis_home_dir = x_home_dir(active_extruder);
921 921
 #endif
922 922
 
923
+    current_position[axis] = 0;
924
+    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
925
+	
923 926
     // Engage Servo endstop if enabled
924 927
     #ifdef SERVO_ENDSTOPS
925
-#if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
926
-    if (axis==Z_AXIS) engage_z_probe();
927
-	else
928
-#endif
928
+      #if defined (ENABLE_AUTO_BED_LEVELING) && (PROBE_SERVO_DEACTIVATION_DELAY > 0)
929
+        if (axis==Z_AXIS) {
930
+          #if defined (Z_RAISE_BEFORE_HOMING) && (Z_RAISE_BEFORE_HOMING > 0)
931
+            destination[axis] = Z_RAISE_BEFORE_HOMING * axis_home_dir * (-1);    // Set destination away from bed
932
+            feedrate = max_feedrate[axis];
933
+            plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate, active_extruder);
934
+            st_synchronize();
935
+          #endif
936
+          engage_z_probe();
937
+        }
938
+	    else
939
+      #endif
929 940
       if (servo_endstops[axis] > -1) {
930 941
         servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]);
931 942
       }
932 943
     #endif
933 944
 
934
-    current_position[axis] = 0;
935
-    plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
936 945
     destination[axis] = 1.5 * max_length(axis) * axis_home_dir;
937 946
     feedrate = homing_feedrate[axis];
938 947
     plan_buffer_line(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS], destination[E_AXIS], feedrate/60, active_extruder);
@@ -1198,6 +1207,9 @@ void process_commands()
1198 1207
           current_position[Z_AXIS]=code_value()+add_homeing[2];
1199 1208
         }
1200 1209
       }
1210
+      #ifdef ENABLE_AUTO_BED_LEVELING
1211
+         current_position[Z_AXIS] -= Z_PROBE_OFFSET_FROM_EXTRUDER;  //Add Z_Probe offset (the distance is negative)
1212
+      #endif
1201 1213
       plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
1202 1214
 #endif // else DELTA
1203 1215
 

Loading…
Cancel
Save