Ver código fonte

Fix SENSORLESS_HOMING for Core Kinematics (#9868)

Scott Lahteine 6 anos atrás
pai
commit
a446433c87
Nenhuma conta vinculada ao e-mail do autor do commit

+ 4
- 12
Marlin/src/gcode/calibrate/G28.cpp Ver arquivo

@@ -63,12 +63,8 @@
63 63
                 fr_mm_s = min(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * SQRT(sq(mlratio) + 1.0);
64 64
 
65 65
     #if ENABLED(SENSORLESS_HOMING)
66
-      #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
67
-        tmc_sensorless_homing(stepperX);
68
-      #endif
69
-      #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
70
-        tmc_sensorless_homing(stepperY);
71
-      #endif
66
+      sensorless_homing_per_axis(X_AXIS);
67
+      sensorless_homing_per_axis(Y_AXIS);
72 68
     #endif
73 69
 
74 70
     do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
@@ -76,12 +72,8 @@
76 72
     current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
77 73
 
78 74
     #if ENABLED(SENSORLESS_HOMING)
79
-      #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
80
-        tmc_sensorless_homing(stepperX, false);
81
-      #endif
82
-      #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
83
-        tmc_sensorless_homing(stepperY, false);
84
-      #endif
75
+      sensorless_homing_per_axis(X_AXIS, false);
76
+      sensorless_homing_per_axis(Y_AXIS, false);
85 77
       safe_delay(500); // Short delay needed to settle
86 78
     #endif
87 79
   }

+ 7
- 2
Marlin/src/inc/Conditionals_post.h Ver arquivo

@@ -718,8 +718,13 @@
718 718
 #define E4_IS_TRINAMIC (ENABLED(E4_IS_TMC2130) || ENABLED(E4_IS_TMC2208))
719 719
 
720 720
 // Disable Z axis sensorless homing if a probe is used to home the Z axis
721
-#if ENABLED(SENSORLESS_HOMING) && HOMING_Z_WITH_PROBE
722
-  #undef Z_HOMING_SENSITIVITY
721
+#if ENABLED(SENSORLESS_HOMING)
722
+  #define X_SENSORLESS (ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY))
723
+  #define Y_SENSORLESS (ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY))
724
+  #define Z_SENSORLESS (ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY))
725
+  #if HOMING_Z_WITH_PROBE
726
+    #undef Z_HOMING_SENSITIVITY
727
+  #endif
723 728
 #endif
724 729
 
725 730
 // Endstops and bed probe

+ 9
- 0
Marlin/src/inc/SanityCheck.h Ver arquivo

@@ -1557,6 +1557,15 @@ static_assert(1 >= 0
1557 1557
     #error "SENSORLESS_HOMING on DELTA currently requires STEALTHCHOP."
1558 1558
   #endif
1559 1559
 
1560
+  // Sensorless homing is required for both combined steppers in an H-bot
1561
+  #if CORE_IS_XY && X_SENSORLESS != Y_SENSORLESS
1562
+    #error "CoreXY requires both X and Y to use sensorless homing if either does."
1563
+  #elif CORE_IS_XZ && X_SENSORLESS != Z_SENSORLESS
1564
+    #error "CoreXZ requires both X and Z to use sensorless homing if either does."
1565
+  #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS
1566
+    #error "CoreYZ requires both Y and Z to use sensorless homing if either does."
1567
+  #endif
1568
+
1560 1569
 #elif ENABLED(SENSORLESS_HOMING)
1561 1570
 
1562 1571
   #error "SENSORLESS_HOMING requires TMC2130 stepper drivers."

+ 6
- 18
Marlin/src/module/delta.cpp Ver arquivo

@@ -232,15 +232,9 @@ bool home_delta() {
232 232
 
233 233
   // Disable stealthChop if used. Enable diag1 pin on driver.
234 234
   #if ENABLED(SENSORLESS_HOMING)
235
-    #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
236
-      tmc_sensorless_homing(stepperX);
237
-    #endif
238
-    #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
239
-      tmc_sensorless_homing(stepperY);
240
-    #endif
241
-    #if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
242
-      tmc_sensorless_homing(stepperZ);
243
-    #endif
235
+    sensorless_homing_per_axis(X_AXIS);
236
+    sensorless_homing_per_axis(Y_AXIS);
237
+    sensorless_homing_per_axis(Z_AXIS);
244 238
   #endif
245 239
 
246 240
   // Move all carriages together linearly until an endstop is hit.
@@ -251,15 +245,9 @@ bool home_delta() {
251 245
 
252 246
   // Re-enable stealthChop if used. Disable diag1 pin on driver.
253 247
   #if ENABLED(SENSORLESS_HOMING)
254
-    #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
255
-      tmc_sensorless_homing(stepperX, false);
256
-    #endif
257
-    #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
258
-      tmc_sensorless_homing(stepperY, false);
259
-    #endif
260
-    #if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
261
-      tmc_sensorless_homing(stepperZ, false);
262
-    #endif
248
+    sensorless_homing_per_axis(X_AXIS, false);
249
+    sensorless_homing_per_axis(Y_AXIS, false);
250
+    sensorless_homing_per_axis(Z_AXIS, false);
263 251
   #endif
264 252
 
265 253
   // If an endstop was not hit, then damage can occur if homing is continued.

+ 44
- 18
Marlin/src/module/motion.cpp Ver arquivo

@@ -966,6 +966,48 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
966 966
   return homing_feedrate(axis) / hbd;
967 967
 }
968 968
 
969
+#if ENABLED(SENSORLESS_HOMING)
970
+
971
+  /**
972
+   * Set sensorless homing if the axis has it, accounting for Core Kinematics.
973
+   */
974
+  void sensorless_homing_per_axis(const AxisEnum axis, const bool enable/*=true*/) {
975
+    switch (axis) {
976
+      #if X_SENSORLESS
977
+        case X_AXIS:
978
+          tmc_sensorless_homing(stepperX, enable);
979
+          #if CORE_IS_XY && Y_SENSORLESS
980
+            tmc_sensorless_homing(stepperY, enable);
981
+          #elif CORE_IS_XZ && Z_SENSORLESS
982
+            tmc_sensorless_homing(stepperZ, enable);
983
+          #endif
984
+          break;
985
+      #endif
986
+      #if Y_SENSORLESS
987
+        case Y_AXIS:
988
+          tmc_sensorless_homing(stepperY, enable);
989
+          #if CORE_IS_XY && X_SENSORLESS
990
+            tmc_sensorless_homing(stepperX, enable);
991
+          #elif CORE_IS_YZ && Z_SENSORLESS
992
+            tmc_sensorless_homing(stepperZ, enable);
993
+          #endif
994
+          break;
995
+      #endif
996
+      #if Z_SENSORLESS
997
+        case Z_AXIS:
998
+          tmc_sensorless_homing(stepperZ, enable);
999
+          #if CORE_IS_XZ && X_SENSORLESS
1000
+            tmc_sensorless_homing(stepperX, enable);
1001
+          #elif CORE_IS_YZ && Y_SENSORLESS
1002
+            tmc_sensorless_homing(stepperY, enable);
1003
+          #endif
1004
+          break;
1005
+      #endif
1006
+    }
1007
+  }
1008
+
1009
+#endif // SENSORLESS_HOMING
1010
+
969 1011
 /**
970 1012
  * Home an individual linear axis
971 1013
  */
@@ -992,15 +1034,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
992 1034
 
993 1035
   // Disable stealthChop if used. Enable diag1 pin on driver.
994 1036
   #if ENABLED(SENSORLESS_HOMING)
995
-    #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
996
-      if (axis == X_AXIS) tmc_sensorless_homing(stepperX);
997
-    #endif
998
-    #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
999
-      if (axis == Y_AXIS) tmc_sensorless_homing(stepperY);
1000
-    #endif
1001
-    #if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
1002
-      if (axis == Z_AXIS) tmc_sensorless_homing(stepperZ);
1003
-    #endif
1037
+    sensorless_homing_per_axis(axis);
1004 1038
   #endif
1005 1039
 
1006 1040
   // Tell the planner the axis is at 0
@@ -1031,15 +1065,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
1031 1065
 
1032 1066
   // Re-enable stealthChop if used. Disable diag1 pin on driver.
1033 1067
   #if ENABLED(SENSORLESS_HOMING)
1034
-    #if ENABLED(X_IS_TMC2130) && defined(X_HOMING_SENSITIVITY)
1035
-      if (axis == X_AXIS) tmc_sensorless_homing(stepperX, false);
1036
-    #endif
1037
-    #if ENABLED(Y_IS_TMC2130) && defined(Y_HOMING_SENSITIVITY)
1038
-      if (axis == Y_AXIS) tmc_sensorless_homing(stepperY, false);
1039
-    #endif
1040
-    #if ENABLED(Z_IS_TMC2130) && defined(Z_HOMING_SENSITIVITY)
1041
-      if (axis == Z_AXIS) tmc_sensorless_homing(stepperZ, false);
1042
-    #endif
1068
+    sensorless_homing_per_axis(axis, false);
1043 1069
   #endif
1044 1070
 
1045 1071
   #if ENABLED(DEBUG_LEVELING_FEATURE)

+ 4
- 0
Marlin/src/module/motion.h Ver arquivo

@@ -191,6 +191,10 @@ void set_axis_is_at_home(const AxisEnum axis);
191 191
 void homeaxis(const AxisEnum axis);
192 192
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
193 193
 
194
+#if ENABLED(SENSORLESS_HOMING)
195
+  void sensorless_homing_per_axis(const AxisEnum axis, const bool enable=true);
196
+#endif
197
+
194 198
 //
195 199
 // Macros
196 200
 //

Carregando…
Cancelar
Salvar