瀏覽代碼

🚸 Strict index 2 for M913 / M914 XY (#24680)

Giuliano Zaro 2 年之前
父節點
當前提交
89f86bc550
No account linked to committer's email address
共有 2 個文件被更改,包括 10 次插入5 次删除
  1. 4
    5
      Marlin/src/gcode/feature/trinamic/M911-M914.cpp
  2. 6
    0
      Marlin/src/inc/SanityCheck.h

+ 4
- 5
Marlin/src/gcode/feature/trinamic/M911-M914.cpp 查看文件

@@ -294,14 +294,14 @@
294 294
         #if X_HAS_STEALTHCHOP || X2_HAS_STEALTHCHOP
295 295
           case X_AXIS:
296 296
             TERN_(X_HAS_STEALTHCHOP,  if (index < 2) TMC_SET_PWMTHRS(X,X));
297
-            TERN_(X2_HAS_STEALTHCHOP, if (!(index & 1)) TMC_SET_PWMTHRS(X,X2));
297
+            TERN_(X2_HAS_STEALTHCHOP, if (!index || index == 2) TMC_SET_PWMTHRS(X,X2));
298 298
             break;
299 299
         #endif
300 300
 
301 301
         #if Y_HAS_STEALTHCHOP || Y2_HAS_STEALTHCHOP
302 302
           case Y_AXIS:
303 303
             TERN_(Y_HAS_STEALTHCHOP,  if (index < 2) TMC_SET_PWMTHRS(Y,Y));
304
-            TERN_(Y2_HAS_STEALTHCHOP, if (!(index & 1)) TMC_SET_PWMTHRS(Y,Y2));
304
+            TERN_(Y2_HAS_STEALTHCHOP, if (!index || index == 2) TMC_SET_PWMTHRS(Y,Y2));
305 305
             break;
306 306
         #endif
307 307
 
@@ -499,7 +499,6 @@
499 499
    * M914: Set StallGuard sensitivity.
500 500
    */
501 501
   void GcodeSuite::M914() {
502
-
503 502
     bool report = true;
504 503
     const uint8_t index = parser.byteval('I');
505 504
     LOOP_NUM_AXES(i) if (parser.seen(AXIS_CHAR(i))) {
@@ -509,13 +508,13 @@
509 508
         #if X_SENSORLESS
510 509
           case X_AXIS:
511 510
             if (index < 2) stepperX.homing_threshold(value);
512
-            TERN_(X2_SENSORLESS, if (!(index & 1)) stepperX2.homing_threshold(value));
511
+            TERN_(X2_SENSORLESS, if (!index || index == 2) stepperX2.homing_threshold(value));
513 512
             break;
514 513
         #endif
515 514
         #if Y_SENSORLESS
516 515
           case Y_AXIS:
517 516
             if (index < 2) stepperY.homing_threshold(value);
518
-            TERN_(Y2_SENSORLESS, if (!(index & 1)) stepperY2.homing_threshold(value));
517
+            TERN_(Y2_SENSORLESS, if (!index || index == 2) stepperY2.homing_threshold(value));
519 518
             break;
520 519
         #endif
521 520
         #if Z_SENSORLESS

+ 6
- 0
Marlin/src/inc/SanityCheck.h 查看文件

@@ -2044,6 +2044,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
2044 2044
   );
2045 2045
 #endif
2046 2046
 
2047
+#define COUNT_SENSORLESS COUNT_ENABLED(Z_SENSORLESS, Z2_SENSORLESS, Z3_SENSORLESS, Z4_SENSORLESS)
2048
+#if COUNT_SENSORLESS && COUNT_SENSORLESS != NUM_Z_STEPPERS
2049
+  #error "All Z steppers must have *_STALL_SENSITIVITY defined to use Z sensorless homing."
2050
+#endif
2051
+#undef COUNT_SENSORLESS
2052
+
2047 2053
 #ifdef SENSORLESS_BACKOFF_MM
2048 2054
   constexpr float sbm[] = SENSORLESS_BACKOFF_MM;
2049 2055
   static_assert(COUNT(sbm) == NUM_AXES, "SENSORLESS_BACKOFF_MM must have " _NUM_AXES_STR "elements (and no others).");

Loading…
取消
儲存