Browse Source

Fix DELTA + TMC sensorless homing + SPI endstops (#18811)

Victor Tseng 4 years ago
parent
commit
5d14c3712f
No account linked to committer's email address
2 changed files with 12 additions and 8 deletions
  1. 6
    8
      Marlin/src/module/delta.cpp
  2. 6
    0
      Marlin/src/module/motion.h

+ 6
- 8
Marlin/src/module/delta.cpp View File

@@ -242,11 +242,9 @@ void home_delta() {
242 242
 
243 243
   // Disable stealthChop if used. Enable diag1 pin on driver.
244 244
   #if ENABLED(SENSORLESS_HOMING)
245
-    sensorless_t stealth_states {
246
-      tmc_enable_stallguard(stepperX),
247
-      tmc_enable_stallguard(stepperY),
248
-      tmc_enable_stallguard(stepperZ)
249
-    };
245
+  TERN_(X_SENSORLESS, sensorless_t stealth_states_x = start_sensorless_homing_per_axis(X_AXIS));
246
+  TERN_(Y_SENSORLESS, sensorless_t stealth_states_y = start_sensorless_homing_per_axis(Y_AXIS));
247
+  TERN_(Z_SENSORLESS, sensorless_t stealth_states_z = start_sensorless_homing_per_axis(Z_AXIS));
250 248
   #endif
251 249
 
252 250
   // Move all carriages together linearly until an endstop is hit.
@@ -256,9 +254,9 @@ void home_delta() {
256 254
 
257 255
   // Re-enable stealthChop if used. Disable diag1 pin on driver.
258 256
   #if ENABLED(SENSORLESS_HOMING)
259
-    tmc_disable_stallguard(stepperX, stealth_states.x);
260
-    tmc_disable_stallguard(stepperY, stealth_states.y);
261
-    tmc_disable_stallguard(stepperZ, stealth_states.z);
257
+  TERN_(X_SENSORLESS, end_sensorless_homing_per_axis(X_AXIS, stealth_states_x));
258
+  TERN_(Y_SENSORLESS, end_sensorless_homing_per_axis(Y_AXIS, stealth_states_y));
259
+  TERN_(Z_SENSORLESS, end_sensorless_homing_per_axis(Z_AXIS, stealth_states_z));
262 260
   #endif
263 261
 
264 262
   endstops.validate_homing_move();

+ 6
- 0
Marlin/src/module/motion.h View File

@@ -395,3 +395,9 @@ void homeaxis(const AxisEnum axis);
395 395
 #if HAS_M206_COMMAND
396 396
   void set_home_offset(const AxisEnum axis, const float v);
397 397
 #endif
398
+
399
+#if USE_SENSORLESS
400
+  struct sensorless_t;
401
+  sensorless_t start_sensorless_homing_per_axis(const AxisEnum axis);
402
+  void end_sensorless_homing_per_axis(const AxisEnum axis, sensorless_t enable_stealth);
403
+#endif

Loading…
Cancel
Save