Procházet zdrojové kódy

Fix home_delta for SENSORLESS_HOMING (#10145)

Scott Lahteine před 7 roky
rodič
revize
93af8aa157
No account linked to committer's email address
1 změnil soubory, kde provedl 17 přidání a 10 odebrání
  1. 17
    10
      Marlin/src/module/delta.cpp

+ 17
- 10
Marlin/src/module/delta.cpp Zobrazit soubor

@@ -229,6 +229,14 @@ void forward_kinematics_DELTA(float z1, float z2, float z3) {
229 229
   cartes[Z_AXIS] =             z1 + ex[2] * Xnew + ey[2] * Ynew - ez[2] * Znew;
230 230
 }
231 231
 
232
+#if ENABLED(SENSORLESS_HOMING)
233
+  inline void delta_sensorless_homing(const bool on=true) {
234
+    sensorless_homing_per_axis(A_AXIS, on);
235
+    sensorless_homing_per_axis(B_AXIS, on);
236
+    sensorless_homing_per_axis(C_AXIS, on);
237
+  }
238
+#endif
239
+
232 240
 /**
233 241
  * A delta can only safely home all axes at the same time
234 242
  * This is like quick_home_xy() but for 3 towers.
@@ -243,9 +251,7 @@ bool home_delta() {
243 251
 
244 252
   // Disable stealthChop if used. Enable diag1 pin on driver.
245 253
   #if ENABLED(SENSORLESS_HOMING)
246
-    sensorless_homing_per_axis(A_AXIS);
247
-    sensorless_homing_per_axis(B_AXIS);
248
-    sensorless_homing_per_axis(C_AXIS);
254
+    delta_sensorless_homing();
249 255
   #endif
250 256
 
251 257
   // Move all carriages together linearly until an endstop is hit.
@@ -254,19 +260,15 @@ bool home_delta() {
254 260
   line_to_current_position();
255 261
   stepper.synchronize();
256 262
 
257
-  // Re-enable stealthChop if used. Disable diag1 pin on driver.
258
-  #if ENABLED(SENSORLESS_HOMING)
259
-    sensorless_homing_per_axis(A_AXIS, false);
260
-    sensorless_homing_per_axis(B_AXIS, false);
261
-    sensorless_homing_per_axis(C_AXIS, false);
262
-  #endif
263
-
264 263
   // If an endstop was not hit, then damage can occur if homing is continued.
265 264
   // This can occur if the delta height not set correctly.
266 265
   if (!(Endstops::endstop_hit_bits & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) {
267 266
     LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED);
268 267
     SERIAL_ERROR_START();
269 268
     SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED);
269
+    #if ENABLED(SENSORLESS_HOMING)
270
+      delta_sensorless_homing(false);
271
+    #endif
270 272
     return false;
271 273
   }
272 274
 
@@ -278,6 +280,11 @@ bool home_delta() {
278 280
   HOMEAXIS(B);
279 281
   HOMEAXIS(C);
280 282
 
283
+  // Re-enable stealthChop if used. Disable diag1 pin on driver.
284
+  #if ENABLED(SENSORLESS_HOMING)
285
+    delta_sensorless_homing(false);
286
+  #endif
287
+
281 288
   // Set all carriages to their home positions
282 289
   // Do this here all at once for Delta, because
283 290
   // XYZ isn't ABC. Applying this per-tower would

Loading…
Zrušit
Uložit