Browse Source

Merge pull request #1253 from lobermann/Development_AutoLevelOffset

Consider negative Z Offsets when auto bed leveling is active
Bo Herrmannsen 10 years ago
parent
commit
73b7b08f2c
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      Marlin/Marlin_main.cpp

+ 8
- 1
Marlin/Marlin_main.cpp View File

@@ -3946,7 +3946,14 @@ void clamp_to_software_endstops(float target[3])
3946 3946
   if (min_software_endstops) {
3947 3947
     if (target[X_AXIS] < min_pos[X_AXIS]) target[X_AXIS] = min_pos[X_AXIS];
3948 3948
     if (target[Y_AXIS] < min_pos[Y_AXIS]) target[Y_AXIS] = min_pos[Y_AXIS];
3949
-    if (target[Z_AXIS] < min_pos[Z_AXIS]) target[Z_AXIS] = min_pos[Z_AXIS];
3949
+    
3950
+    float negative_z_offset = 0;
3951
+    #ifdef ENABLE_AUTO_BED_LEVELING
3952
+      if (Z_PROBE_OFFSET_FROM_EXTRUDER < 0) negative_z_offset = negative_z_offset + Z_PROBE_OFFSET_FROM_EXTRUDER;
3953
+      if (add_homing[Z_AXIS] < 0) negative_z_offset = negative_z_offset + add_homing[Z_AXIS];
3954
+    #endif
3955
+    
3956
+    if (target[Z_AXIS] < min_pos[Z_AXIS]+negative_z_offset) target[Z_AXIS] = min_pos[Z_AXIS]+negative_z_offset;
3950 3957
   }
3951 3958
 
3952 3959
   if (max_software_endstops) {

Loading…
Cancel
Save