Browse Source

Merge pull request #4368 from AnHardt/run-z-probe-delta

Revert to position-difference method in run_z_probe()
Scott Lahteine 9 years ago
parent
commit
2c239b1bd3
1 changed files with 17 additions and 3 deletions
  1. 17
    3
      Marlin/Marlin_main.cpp

+ 17
- 3
Marlin/Marlin_main.cpp View File

2064
     return false;
2064
     return false;
2065
   }
2065
   }
2066
 
2066
 
2067
+  #if ENABLED(DELTA)
2068
+    #define SET_CURRENT_FROM_STEPPERS() current_position[Z_AXIS] = z_before - stepper.get_axis_position_mm(Z_AXIS) + z_mm
2069
+  #else
2070
+    #define SET_CURRENT_FROM_STEPPERS() current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS)
2071
+  #endif
2072
+
2067
   // Do a single Z probe and return with current_position[Z_AXIS]
2073
   // Do a single Z probe and return with current_position[Z_AXIS]
2068
   // at the height where the probe triggered.
2074
   // at the height where the probe triggered.
2069
   static float run_z_probe() {
2075
   static float run_z_probe() {
2075
       planner.bed_level_matrix.set_to_identity();
2081
       planner.bed_level_matrix.set_to_identity();
2076
     #endif
2082
     #endif
2077
 
2083
 
2084
+    #if ENABLED(DELTA)
2085
+      float z_before = current_position[Z_AXIS];
2086
+      float z_mm = stepper.get_axis_position_mm(Z_AXIS);
2087
+    #endif
2078
     current_position[Z_AXIS] = -(Z_MAX_LENGTH + 10);
2088
     current_position[Z_AXIS] = -(Z_MAX_LENGTH + 10);
2079
     do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
2089
     do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
2080
     endstops.hit_on_purpose(); // clear endstop hit flags
2090
     endstops.hit_on_purpose(); // clear endstop hit flags
2081
     // Get the current stepper position after bumping an endstop
2091
     // Get the current stepper position after bumping an endstop
2082
-    current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
2083
-    SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are      feedrate_mm_m = homing_feedrate_mm_m[Z_AXIS];
2092
+    SET_CURRENT_FROM_STEPPERS();
2093
+    SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are
2084
 
2094
 
2085
     // move up the retract distance
2095
     // move up the retract distance
2086
     current_position[Z_AXIS] += home_bump_mm(Z_AXIS);
2096
     current_position[Z_AXIS] += home_bump_mm(Z_AXIS);
2087
     do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
2097
     do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
2088
 
2098
 
2099
+    #if ENABLED(DELTA)
2100
+      z_before = current_position[Z_AXIS];
2101
+      z_mm = stepper.get_axis_position_mm(Z_AXIS);
2102
+    #endif
2089
     // move back down slowly to find bed
2103
     // move back down slowly to find bed
2090
     current_position[Z_AXIS] -= home_bump_mm(Z_AXIS) * 2;
2104
     current_position[Z_AXIS] -= home_bump_mm(Z_AXIS) * 2;
2091
     do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_SLOW);
2105
     do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_SLOW);
2092
     endstops.hit_on_purpose(); // clear endstop hit flags
2106
     endstops.hit_on_purpose(); // clear endstop hit flags
2093
     // Get the current stepper position after bumping an endstop
2107
     // Get the current stepper position after bumping an endstop
2094
-    current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS);
2108
+    SET_CURRENT_FROM_STEPPERS();
2095
     SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are
2109
     SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are
2096
 
2110
 
2097
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2111
     #if ENABLED(DEBUG_LEVELING_FEATURE)

Loading…
Cancel
Save