|
@@ -30,42 +30,48 @@
|
30
|
30
|
#include "../../../module/planner.h"
|
31
|
31
|
#include "../../queue.h"
|
32
|
32
|
|
|
33
|
+#define M91x_USE(A) (ENABLED(A##_IS_TMC2130) || (ENABLED(A##_IS_TMC2208) && PIN_EXISTS(A##_SERIAL_RX)))
|
|
34
|
+#define M91x_USE_X (ENABLED(IS_TRAMS) || M91x_USE(X))
|
|
35
|
+#define M91x_USE_Y (ENABLED(IS_TRAMS) || M91x_USE(Y))
|
|
36
|
+#define M91x_USE_Z (ENABLED(IS_TRAMS) || M91x_USE(Z))
|
|
37
|
+#define M91x_USE_E0 (ENABLED(IS_TRAMS) || M91x_USE(E0))
|
|
38
|
+
|
33
|
39
|
/**
|
34
|
40
|
* M911: Report TMC stepper driver overtemperature pre-warn flag
|
35
|
41
|
* This flag is held by the library, persisting until cleared by M912
|
36
|
42
|
*/
|
37
|
43
|
void GcodeSuite::M911() {
|
38
|
|
- #if ENABLED(X_IS_TMC2130) || (ENABLED(X_IS_TMC2208) && PIN_EXISTS(X_SERIAL_RX)) || ENABLED(IS_TRAMS)
|
|
44
|
+ #if M91x_USE_X
|
39
|
45
|
tmc_report_otpw(stepperX, TMC_X);
|
40
|
46
|
#endif
|
41
|
|
- #if ENABLED(X2_IS_TMC2130) || (ENABLED(X2_IS_TMC2208) && PIN_EXISTS(X2_SERIAL_RX))
|
|
47
|
+ #if M91x_USE(X2)
|
42
|
48
|
tmc_report_otpw(stepperX2, TMC_X2);
|
43
|
49
|
#endif
|
44
|
|
- #if ENABLED(Y_IS_TMC2130) || (ENABLED(Y_IS_TMC2208) && PIN_EXISTS(Y_SERIAL_RX)) || ENABLED(IS_TRAMS)
|
|
50
|
+ #if M91x_USE_Y
|
45
|
51
|
tmc_report_otpw(stepperY, TMC_Y);
|
46
|
52
|
#endif
|
47
|
|
- #if ENABLED(Y2_IS_TMC2130) || (ENABLED(Y2_IS_TMC2208) && PIN_EXISTS(Y2_SERIAL_RX))
|
|
53
|
+ #if M91x_USE(Y2)
|
48
|
54
|
tmc_report_otpw(stepperY2, TMC_Y2);
|
49
|
55
|
#endif
|
50
|
|
- #if ENABLED(Z_IS_TMC2130) || (ENABLED(Z_IS_TMC2208) && PIN_EXISTS(Z_SERIAL_RX)) || ENABLED(IS_TRAMS)
|
|
56
|
+ #if M91x_USE_Z
|
51
|
57
|
tmc_report_otpw(stepperZ, TMC_Z);
|
52
|
58
|
#endif
|
53
|
|
- #if ENABLED(Z2_IS_TMC2130) || (ENABLED(Z2_IS_TMC2208) && PIN_EXISTS(Z2_SERIAL_RX))
|
|
59
|
+ #if M91x_USE(Z2)
|
54
|
60
|
tmc_report_otpw(stepperZ2, TMC_Z2);
|
55
|
61
|
#endif
|
56
|
|
- #if ENABLED(E0_IS_TMC2130) || (ENABLED(E0_IS_TMC2208) && PIN_EXISTS(E0_SERIAL_RX)) || ENABLED(IS_TRAMS)
|
|
62
|
+ #if M91x_USE_E0
|
57
|
63
|
tmc_report_otpw(stepperE0, TMC_E0);
|
58
|
64
|
#endif
|
59
|
|
- #if ENABLED(E1_IS_TMC2130) || (ENABLED(E1_IS_TMC2208) && PIN_EXISTS(E1_SERIAL_RX))
|
|
65
|
+ #if M91x_USE(E1)
|
60
|
66
|
tmc_report_otpw(stepperE1, TMC_E1);
|
61
|
67
|
#endif
|
62
|
|
- #if ENABLED(E2_IS_TMC2130) || (ENABLED(E2_IS_TMC2208) && PIN_EXISTS(E2_SERIAL_RX))
|
|
68
|
+ #if M91x_USE(E2)
|
63
|
69
|
tmc_report_otpw(stepperE2, TMC_E2);
|
64
|
70
|
#endif
|
65
|
|
- #if ENABLED(E3_IS_TMC2130) || (ENABLED(E3_IS_TMC2208) && PIN_EXISTS(E3_SERIAL_RX))
|
|
71
|
+ #if M91x_USE(E3)
|
66
|
72
|
tmc_report_otpw(stepperE3, TMC_E3);
|
67
|
73
|
#endif
|
68
|
|
- #if ENABLED(E4_IS_TMC2130) || (ENABLED(E4_IS_TMC2208) && PIN_EXISTS(E4_SERIAL_RX))
|
|
74
|
+ #if M91x_USE(E4)
|
69
|
75
|
tmc_report_otpw(stepperE4, TMC_E4);
|
70
|
76
|
#endif
|
71
|
77
|
}
|
|
@@ -83,45 +89,61 @@ void GcodeSuite::M911() {
|
83
|
89
|
* M912 E1 ; clear E1 only
|
84
|
90
|
*/
|
85
|
91
|
void GcodeSuite::M912() {
|
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);
|
|
92
|
+ const bool hasX = parser.seen(axis_codes[X_AXIS]),
|
|
93
|
+ hasY = parser.seen(axis_codes[Y_AXIS]),
|
|
94
|
+ hasZ = parser.seen(axis_codes[Z_AXIS]),
|
|
95
|
+ hasE = parser.seen(axis_codes[E_AXIS]),
|
|
96
|
+ hasNone = !hasX && !hasY && !hasZ && !hasE;
|
91
|
97
|
|
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);
|
94
|
|
- #endif
|
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);
|
97
|
|
- #endif
|
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);
|
100
|
|
- #endif
|
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);
|
103
|
|
- #endif
|
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);
|
124
|
|
- #endif
|
|
98
|
+ #if M91x_USE_X || M91x_USE(X2)
|
|
99
|
+ const uint8_t xval = parser.byteval(axis_codes[X_AXIS], 10);
|
|
100
|
+ #if M91x_USE_X
|
|
101
|
+ if (hasNone || xval == 1 || (hasX && xval == 10)) tmc_clear_otpw(stepperX, TMC_X);
|
|
102
|
+ #endif
|
|
103
|
+ #if M91x_USE(X2)
|
|
104
|
+ if (hasNone || xval == 2 || (hasX && xval == 10)) tmc_clear_otpw(stepperX2, TMC_X2);
|
|
105
|
+ #endif
|
|
106
|
+ #endif
|
|
107
|
+
|
|
108
|
+ #define M91x_USE_Y (M91x_USE(Y) || ENABLED(IS_TRAMS))
|
|
109
|
+ #if M91x_USE_Y || M91x_USE(Y2)
|
|
110
|
+ const uint8_t yval = parser.byteval(axis_codes[Y_AXIS], 10);
|
|
111
|
+ #if M91x_USE_Y
|
|
112
|
+ if (hasNone || yval == 1 || (hasY && yval == 10)) tmc_clear_otpw(stepperY, TMC_Y);
|
|
113
|
+ #endif
|
|
114
|
+ #if M91x_USE(Y2)
|
|
115
|
+ if (hasNone || yval == 2 || (hasY && yval == 10)) tmc_clear_otpw(stepperY2, TMC_Y2);
|
|
116
|
+ #endif
|
|
117
|
+ #endif
|
|
118
|
+
|
|
119
|
+ #define M91x_USE_Z (M91x_USE(Z) || ENABLED(IS_TRAMS))
|
|
120
|
+ #if M91x_USE_Z || M91x_USE(Z2)
|
|
121
|
+ const uint8_t zval = parser.byteval(axis_codes[Z_AXIS], 10);
|
|
122
|
+ #if M91x_USE_Z
|
|
123
|
+ if (hasNone || zval == 1 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ, TMC_Z);
|
|
124
|
+ #endif
|
|
125
|
+ #if M91x_USE(Z2)
|
|
126
|
+ if (hasNone || zval == 2 || (hasZ && zval == 10)) tmc_clear_otpw(stepperZ2, TMC_Z2);
|
|
127
|
+ #endif
|
|
128
|
+ #endif
|
|
129
|
+
|
|
130
|
+ const uint8_t eval = parser.byteval(axis_codes[E_AXIS], 10);
|
|
131
|
+
|
|
132
|
+ #if M91x_USE_E0
|
|
133
|
+ if (hasNone || eval == 0 || (hasE && eval == 10)) tmc_clear_otpw(stepperE0, TMC_E0);
|
|
134
|
+ #endif
|
|
135
|
+ #if E_STEPPERS > 1 && M91x_USE(E1)
|
|
136
|
+ if (hasNone || eval == 1 || (hasE && eval == 10)) tmc_clear_otpw(stepperE1, TMC_E1);
|
|
137
|
+ #endif
|
|
138
|
+ #if E_STEPPERS > 2 && M91x_USE(E2)
|
|
139
|
+ if (hasNone || eval == 2 || (hasE && eval == 10)) tmc_clear_otpw(stepperE2, TMC_E2);
|
|
140
|
+ #endif
|
|
141
|
+ #if E_STEPPERS > 3 && M91x_USE(E3)
|
|
142
|
+ if (hasNone || eval == 3 || (hasE && eval == 10)) tmc_clear_otpw(stepperE3, TMC_E3);
|
|
143
|
+ #endif
|
|
144
|
+ #if E_STEPPERS > 4 && M91x_USE(E4)
|
|
145
|
+ if (hasNone || eval == 4 || (hasE && eval == 10)) tmc_clear_otpw(stepperE4, TMC_E4);
|
|
146
|
+ #endif
|
125
|
147
|
}
|
126
|
148
|
|
127
|
149
|
/**
|
|
@@ -130,9 +152,9 @@ void GcodeSuite::M912() {
|
130
|
152
|
#if ENABLED(HYBRID_THRESHOLD)
|
131
|
153
|
void GcodeSuite::M913() {
|
132
|
154
|
#define TMC_SAY_PWMTHRS(P,Q) tmc_get_pwmthrs(stepper##Q, TMC_##Q, planner.axis_steps_per_mm[P##_AXIS])
|
133
|
|
- #define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, TMC_##Q, value, planner.axis_steps_per_mm[P##_AXIS])
|
|
155
|
+ #define TMC_SET_PWMTHRS(P,Q) tmc_set_pwmthrs(stepper##Q, value, planner.axis_steps_per_mm[P##_AXIS])
|
134
|
156
|
#define TMC_SAY_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_get_pwmthrs(stepperE##E, TMC_E##E, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
135
|
|
- #define TMC_SET_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, TMC_E##E, value, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
|
157
|
+ #define TMC_SET_PWMTHRS_E(E) do{ const uint8_t extruder = E; tmc_set_pwmthrs(stepperE##E, value, planner.axis_steps_per_mm[E_AXIS_N]); }while(0)
|
136
|
158
|
|
137
|
159
|
bool report = true;
|
138
|
160
|
const uint8_t index = parser.byteval('I');
|
|
@@ -238,7 +260,7 @@ void GcodeSuite::M912() {
|
238
|
260
|
#if ENABLED(SENSORLESS_HOMING)
|
239
|
261
|
void GcodeSuite::M914() {
|
240
|
262
|
#define TMC_SAY_SGT(Q) tmc_get_sgt(stepper##Q, TMC_##Q)
|
241
|
|
- #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, TMC_##Q, value)
|
|
263
|
+ #define TMC_SET_SGT(Q) tmc_set_sgt(stepper##Q, value)
|
242
|
264
|
|
243
|
265
|
bool report = true;
|
244
|
266
|
const uint8_t index = parser.byteval('I');
|