Quellcode durchsuchen

Add do_probe_move with Z fixes

Scott Lahteine vor 8 Jahren
Ursprung
Commit
7a4ccd7967
1 geänderte Dateien mit 27 neuen und 9 gelöschten Zeilen
  1. 27
    9
      Marlin/Marlin_main.cpp

+ 27
- 9
Marlin/Marlin_main.cpp Datei anzeigen

@@ -2127,6 +2127,28 @@ static void clean_up_after_endstop_or_probe_move() {
2127 2127
     return false;
2128 2128
   }
2129 2129
 
2130
+  static void do_probe_move(float z, float fr_mm_m) {
2131
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2132
+      if (DEBUGGING(LEVELING)) DEBUG_POS(">>> do_probe_move", current_position);
2133
+    #endif
2134
+
2135
+    // Move down until probe triggered
2136
+    do_blocking_move_to_z(LOGICAL_Z_POSITION(z), MMM_TO_MMS(fr_mm_m));
2137
+
2138
+    // Clear endstop flags
2139
+    endstops.hit_on_purpose();
2140
+
2141
+    // Get Z where the steppers were interrupted
2142
+    set_current_from_steppers_for_axis(Z_AXIS);
2143
+
2144
+    // Tell the planner where we actually are
2145
+    SYNC_PLAN_POSITION_KINEMATIC();
2146
+
2147
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
2148
+      if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position);
2149
+    #endif
2150
+  }
2151
+
2130 2152
   // Do a single Z probe and return with current_position[Z_AXIS]
2131 2153
   // at the height where the probe triggered.
2132 2154
   static float run_z_probe() {
@@ -2143,12 +2165,11 @@ static void clean_up_after_endstop_or_probe_move() {
2143 2165
     #endif
2144 2166
 
2145 2167
     #if ENABLED(PROBE_DOUBLE_TOUCH)
2146
-      do_blocking_move_to_z(-(Z_MAX_LENGTH + 10), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2147
-      endstops.hit_on_purpose();
2148
-      set_current_from_steppers_for_axis(Z_AXIS);
2149
-      SYNC_PLAN_POSITION_KINEMATIC();
2150 2168
 
2151
-      // move up the retract distance
2169
+      // Do a first probe at the fast speed
2170
+      do_probe_move(-(Z_MAX_LENGTH) - 10, Z_PROBE_SPEED_FAST);
2171
+
2172
+      // move up by the bump distance
2152 2173
       do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2153 2174
     #else
2154 2175
       // move fast, close to the bed
@@ -2156,10 +2177,7 @@ static void clean_up_after_endstop_or_probe_move() {
2156 2177
     #endif
2157 2178
 
2158 2179
     // move down slowly to find bed
2159
-    do_blocking_move_to_z(current_position[Z_AXIS] -2.0*home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_SLOW));
2160
-    endstops.hit_on_purpose();
2161
-    set_current_from_steppers_for_axis(Z_AXIS);
2162
-    SYNC_PLAN_POSITION_KINEMATIC();
2180
+    do_probe_move(-10, Z_PROBE_SPEED_SLOW);
2163 2181
 
2164 2182
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2165 2183
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);

Laden…
Abbrechen
Speichern