Sfoglia il codice sorgente

Add do_probe_move with Z fixes

Scott Lahteine 8 anni fa
parent
commit
7a4ccd7967
1 ha cambiato i file con 27 aggiunte e 9 eliminazioni
  1. 27
    9
      Marlin/Marlin_main.cpp

+ 27
- 9
Marlin/Marlin_main.cpp Vedi File

2127
     return false;
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
   // Do a single Z probe and return with current_position[Z_AXIS]
2152
   // Do a single Z probe and return with current_position[Z_AXIS]
2131
   // at the height where the probe triggered.
2153
   // at the height where the probe triggered.
2132
   static float run_z_probe() {
2154
   static float run_z_probe() {
2143
     #endif
2165
     #endif
2144
 
2166
 
2145
     #if ENABLED(PROBE_DOUBLE_TOUCH)
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
       do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2173
       do_blocking_move_to_z(current_position[Z_AXIS] + home_bump_mm(Z_AXIS), MMM_TO_MMS(Z_PROBE_SPEED_FAST));
2153
     #else
2174
     #else
2154
       // move fast, close to the bed
2175
       // move fast, close to the bed
2156
     #endif
2177
     #endif
2157
 
2178
 
2158
     // move down slowly to find bed
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
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2182
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2165
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);
2183
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< run_z_probe", current_position);

Loading…
Annulla
Salva