瀏覽代碼

Patch and cleanup run_z_probe

Scott Lahteine 9 年之前
父節點
當前提交
b78590e63d
共有 1 個檔案被更改,包括 15 行新增18 行删除
  1. 15
    18
      Marlin/Marlin_main.cpp

+ 15
- 18
Marlin/Marlin_main.cpp 查看文件

@@ -2087,9 +2087,9 @@ static void clean_up_after_endstop_or_probe_move() {
2087 2087
   }
2088 2088
 
2089 2089
   #if ENABLED(DELTA)
2090
-    #define SET_CURRENT_FROM_STEPPERS() current_position[Z_AXIS] = z_before - stepper.get_axis_position_mm(Z_AXIS) + z_mm
2090
+    #define Z_FROM_STEPPERS() z_before + stepper.get_axis_position_mm(Z_AXIS) - z_mm
2091 2091
   #else
2092
-    #define SET_CURRENT_FROM_STEPPERS() current_position[Z_AXIS] = stepper.get_axis_position_mm(Z_AXIS)
2092
+    #define Z_FROM_STEPPERS() stepper.get_axis_position_mm(Z_AXIS)
2093 2093
   #endif
2094 2094
 
2095 2095
   // Do a single Z probe and return with current_position[Z_AXIS]
@@ -2104,31 +2104,28 @@ static void clean_up_after_endstop_or_probe_move() {
2104 2104
     #endif
2105 2105
 
2106 2106
     #if ENABLED(DELTA)
2107
-      float z_before = current_position[Z_AXIS];
2108
-      float z_mm = stepper.get_axis_position_mm(Z_AXIS);
2107
+      float z_before = current_position[Z_AXIS],         // Current Z
2108
+            z_mm = stepper.get_axis_position_mm(Z_AXIS); // Some tower's current position
2109 2109
     #endif
2110
-    current_position[Z_AXIS] = -(Z_MAX_LENGTH + 10);
2111
-    do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
2112
-    endstops.hit_on_purpose(); // clear endstop hit flags
2113
-    // Get the current stepper position after bumping an endstop
2114
-    SET_CURRENT_FROM_STEPPERS();
2115
-    SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are
2110
+
2111
+    do_blocking_move_to_z(-(Z_MAX_LENGTH + 10), Z_PROBE_SPEED_FAST);
2112
+    endstops.hit_on_purpose();
2113
+    current_position[Z_AXIS] = Z_FROM_STEPPERS();
2114
+    SYNC_PLAN_POSITION_KINEMATIC();
2116 2115
 
2117 2116
     // move up the retract distance
2118
-    current_position[Z_AXIS] += home_bump_mm(Z_AXIS);
2119
-    do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_FAST);
2117
+    do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), Z_PROBE_SPEED_FAST);
2120 2118
 
2121 2119
     #if ENABLED(DELTA)
2122 2120
       z_before = current_position[Z_AXIS];
2123 2121
       z_mm = stepper.get_axis_position_mm(Z_AXIS);
2124 2122
     #endif
2123
+
2125 2124
     // move back down slowly to find bed
2126
-    current_position[Z_AXIS] -= home_bump_mm(Z_AXIS) * 2;
2127
-    do_blocking_move_to_z(current_position[Z_AXIS], Z_PROBE_SPEED_SLOW);
2128
-    endstops.hit_on_purpose(); // clear endstop hit flags
2129
-    // Get the current stepper position after bumping an endstop
2130
-    SET_CURRENT_FROM_STEPPERS();
2131
-    SYNC_PLAN_POSITION_KINEMATIC(); // tell the planner where we are
2125
+    do_blocking_move_to_z(current_position[Z_AXIS] - home_bump_mm(Z_AXIS) * 2, Z_PROBE_SPEED_SLOW);
2126
+    endstops.hit_on_purpose();
2127
+    current_position[Z_AXIS] = Z_FROM_STEPPERS();
2128
+    SYNC_PLAN_POSITION_KINEMATIC();
2132 2129
 
2133 2130
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2134 2131
       if (DEBUGGING(LEVELING)) DEBUG_POS("run_z_probe", current_position);

Loading…
取消
儲存