Sfoglia il codice sorgente

[2.0.x] Add missing axes to M911, M912 (#10668)

Giuliano 7 anni fa
parent
commit
44f3a6dc3b
1 ha cambiato i file con 65 aggiunte e 16 eliminazioni
  1. 65
    16
      Marlin/src/gcode/feature/trinamic/M911-M915.cpp

+ 65
- 16
Marlin/src/gcode/feature/trinamic/M911-M915.cpp Vedi File

@@ -32,46 +32,95 @@
32 32
 
33 33
 /**
34 34
  * M911: Report TMC stepper driver overtemperature pre-warn flag
35
- * The flag is held by the library and persist until manually cleared by M912
35
+ *       This flag is held by the library, persisting until cleared by M912
36 36
  */
37 37
 void GcodeSuite::M911() {
38 38
   #if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
39 39
     tmc_report_otpw(stepperX, TMC_X);
40 40
   #endif
41
+  #if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X2_SERIAL_RX))
42
+    tmc_report_otpw(stepperX2, TMC_X2);
43
+  #endif
41 44
   #if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS)
42 45
     tmc_report_otpw(stepperY, TMC_Y);
43 46
   #endif
47
+  #if ENABLED(Y2_IS_TMC2130) || (ENABLED(Y2_IS_TMC2208) && PIN_EXISTS(Y2_SERIAL_RX))
48
+    tmc_report_otpw(stepperY2, TMC_Y2);
49
+  #endif
44 50
   #if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS)
45 51
     tmc_report_otpw(stepperZ, TMC_Z);
46 52
   #endif
53
+  #if ENABLED(Z2_IS_TMC2130) || (ENABLED(Z2_IS_TMC2208) && PIN_EXISTS(Z2_SERIAL_RX))
54
+    tmc_report_otpw(stepperZ2, TMC_Z2);
55
+  #endif
47 56
   #if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS)
48 57
     tmc_report_otpw(stepperE0, TMC_E0);
49 58
   #endif
59
+  #if ENABLED(E1_IS_TMC2130) || (ENABLED(E1_IS_TMC2208) && PIN_EXISTS(E1_SERIAL_RX))
60
+    tmc_report_otpw(stepperE1, TMC_E1);
61
+  #endif
62
+  #if ENABLED(E2_IS_TMC2130) || (ENABLED(E2_IS_TMC2208) && PIN_EXISTS(E2_SERIAL_RX))
63
+    tmc_report_otpw(stepperE2, TMC_E2);
64
+  #endif
65
+  #if ENABLED(E3_IS_TMC2130) || (ENABLED(E3_IS_TMC2208) && PIN_EXISTS(E3_SERIAL_RX))
66
+    tmc_report_otpw(stepperE3, TMC_E3);
67
+  #endif
68
+  #if ENABLED(E4_IS_TMC2130) || (ENABLED(E4_IS_TMC2208) && PIN_EXISTS(E4_SERIAL_RX))
69
+    tmc_report_otpw(stepperE4, TMC_E4);
70
+  #endif
50 71
 }
51 72
 
52 73
 /**
53 74
  * M912: Clear TMC stepper driver overtemperature pre-warn flag held by the library
75
+ *       Specify one or more axes with X, Y, Z, X1, Y1, Z1, X2, Y2, Z2, and E[index].
76
+ *       If no axes are given, clear all.
77
+ *
78
+ * Examples:
79
+ *       M912 X   ; clear X and X2
80
+ *       M912 X1  ; clear X1 only
81
+ *       M912 X2  ; clear X2 only
82
+ *       M912 X E ; clear X, X2, and all E
83
+ *       M912 E1  ; clear E1 only
54 84
  */
55 85
 void GcodeSuite::M912() {
56
-  const bool clearX = parser.seen(axis_codes[X_AXIS]), clearY = parser.seen(axis_codes[Y_AXIS]), clearZ = parser.seen(axis_codes[Z_AXIS]), clearE = parser.seen(axis_codes[E_AXIS]),
57
-           clearAll = (!clearX && !clearY && !clearZ && !clearE) || (clearX && clearY && clearZ && clearE);
58
-  #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
59
-    if (clearX || clearAll) tmc_clear_otpw(stepperX, TMC_X);
86
+  const bool hasX = parser.seen(axis_codes[X_AXIS]), hasY = parser.seen(axis_codes[Y_AXIS]),
87
+             hasZ = parser.seen(axis_codes[Z_AXIS]), hasE = parser.seen(axis_codes[E_AXIS]),
88
+             hasNone = !hasX && !hasY && !hasZ && !hasE;
89
+  const uint8_t xval = parser.byteval(axis_codes[X_AXIS], 10), yval = parser.byteval(axis_codes[Y_AXIS], 10),
90
+                zval = parser.byteval(axis_codes[Z_AXIS], 10), eval = parser.byteval(axis_codes[E_AXIS], 10);
91
+
92
+  #if (ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS))
93
+    if (hasNone || xval == 1 || (hasX && xval == 10)) tmc_clear_otpw(stepperX, TMC_X);
60 94
   #endif
61
-  #if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX))
62
-    if (clearX || clearAll) tmc_clear_otpw(stepperX, TMC_X);
95
+  #if (ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X2_SERIAL_RX)))
96
+    if (hasNone || xval == 2 || (hasX && xval == 10)) tmc_clear_otpw(stepperX2, TMC_X2);
63 97
   #endif
64
-
65
-  #if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX))
66
-    if (clearY || clearAll) tmc_clear_otpw(stepperY, TMC_Y);
98
+  #if (ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS))
99
+    if (hasNone || yval == 1 || (hasY && yval == 10)) tmc_clear_otpw(stepperY, TMC_Y);
67 100
   #endif
68
-
69
-  #if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX))
70
-    if (clearZ || clearAll) tmc_clear_otpw(stepperZ, TMC_Z);
101
+  #if (ENABLED(Y2_IS_TMC2130) || (ENABLED(Y2_IS_TMC2208) && PIN_EXISTS(Y2_SERIAL_RX)))
102
+    if (hasNone || yval == 2 || (hasY && yval == 10)) tmc_clear_otpw(stepperY2, TMC_Y2);
71 103
   #endif
72
-
73
-  #if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX))
74
-    if (clearE || clearAll) tmc_clear_otpw(stepperE0, TMC_E0);
104
+  #if (ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS))
105
+    if (hasNone || zval == 1 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ, TMC_Z);
106
+  #endif
107
+  #if (ENABLED(Z2_IS_TMC2130) || (ENABLED(Z2_IS_TMC2208) && PIN_EXISTS(Z2_SERIAL_RX)))
108
+    if (hasNone || zval == 2 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ2, TMC_Z2);
109
+  #endif
110
+  #if (ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS))
111
+    if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
112
+  #endif
113
+  #if E_STEPPERS > 1 && (ENABLED(E1_IS_TMC2130) || (ENABLED(E1_IS_TMC2208) && PIN_EXISTS(E1_SERIAL_RX)))
114
+    if (hasNone || eval == 1 || (hasE && eval == 10)) tmc_clear_otpw(stepperE1, TMC_E1);
115
+  #endif
116
+  #if E_STEPPERS > 2 && (ENABLED(E2_IS_TMC2130) || (ENABLED(E2_IS_TMC2208) && PIN_EXISTS(E2_SERIAL_RX)))
117
+    if (hasNone || eval == 2 || (hasE && eval == 10)) tmc_clear_otpw(stepperE2, TMC_E2);
118
+  #endif
119
+  #if E_STEPPERS > 3 && (ENABLED(E3_IS_TMC2130) || (ENABLED(E3_IS_TMC2208) && PIN_EXISTS(E3_SERIAL_RX)))
120
+    if (hasNone || eval == 3 || (hasE && eval == 10)) tmc_clear_otpw(stepperE3, TMC_E3);
121
+  #endif
122
+  #if E_STEPPERS > 4 && (ENABLED(E4_IS_TMC2130) || (ENABLED(E4_IS_TMC2208) && PIN_EXISTS(E4_SERIAL_RX)))
123
+    if (hasNone || eval == 4 || (hasE && eval == 10)) tmc_clear_otpw(stepperE4, TMC_E4);
75 124
   #endif
76 125
 }
77 126
 

Loading…
Annulla
Salva