|
@@ -76,7 +76,18 @@ typedef struct {
|
76
|
76
|
uint8_t hstrt;
|
77
|
77
|
} chopper_timing_t;
|
78
|
78
|
|
79
|
|
-static constexpr chopper_timing_t chopper_timing = CHOPPER_TIMING;
|
|
79
|
+#ifndef CHOPPER_TIMING_X
|
|
80
|
+ #define CHOPPER_TIMING_X CHOPPER_TIMING
|
|
81
|
+#endif
|
|
82
|
+#ifndef CHOPPER_TIMING_Y
|
|
83
|
+ #define CHOPPER_TIMING_Y CHOPPER_TIMING
|
|
84
|
+#endif
|
|
85
|
+#ifndef CHOPPER_TIMING_Z
|
|
86
|
+ #define CHOPPER_TIMING_Z CHOPPER_TIMING
|
|
87
|
+#endif
|
|
88
|
+#ifndef CHOPPER_TIMING_E
|
|
89
|
+ #define CHOPPER_TIMING_E CHOPPER_TIMING
|
|
90
|
+#endif
|
80
|
91
|
|
81
|
92
|
#if HAS_TMC220x
|
82
|
93
|
void tmc_serial_begin();
|
|
@@ -90,9 +101,10 @@ void reset_trinamic_drivers();
|
90
|
101
|
// X Stepper
|
91
|
102
|
#if AXIS_IS_TMC(X)
|
92
|
103
|
extern TMC_CLASS(X, X) stepperX;
|
|
104
|
+ static constexpr chopper_timing_t chopper_timing_X = CHOPPER_TIMING_X;
|
93
|
105
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
94
|
106
|
#define X_ENABLE_INIT() NOOP
|
95
|
|
- #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
|
|
107
|
+ #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing_X.toff : 0)
|
96
|
108
|
#define X_ENABLE_READ() stepperX.isEnabled()
|
97
|
109
|
#endif
|
98
|
110
|
#if AXIS_HAS_SQUARE_WAVE(X)
|
|
@@ -103,9 +115,10 @@ void reset_trinamic_drivers();
|
103
|
115
|
// Y Stepper
|
104
|
116
|
#if AXIS_IS_TMC(Y)
|
105
|
117
|
extern TMC_CLASS(Y, Y) stepperY;
|
|
118
|
+ static constexpr chopper_timing_t chopper_timing_Y = CHOPPER_TIMING_Y;
|
106
|
119
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
107
|
120
|
#define Y_ENABLE_INIT() NOOP
|
108
|
|
- #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
|
|
121
|
+ #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y.toff : 0)
|
109
|
122
|
#define Y_ENABLE_READ() stepperY.isEnabled()
|
110
|
123
|
#endif
|
111
|
124
|
#if AXIS_HAS_SQUARE_WAVE(Y)
|
|
@@ -116,9 +129,10 @@ void reset_trinamic_drivers();
|
116
|
129
|
// Z Stepper
|
117
|
130
|
#if AXIS_IS_TMC(Z)
|
118
|
131
|
extern TMC_CLASS(Z, Z) stepperZ;
|
|
132
|
+ static constexpr chopper_timing_t chopper_timing_Z = CHOPPER_TIMING_Z;
|
119
|
133
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
120
|
134
|
#define Z_ENABLE_INIT() NOOP
|
121
|
|
- #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
|
|
135
|
+ #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z.toff : 0)
|
122
|
136
|
#define Z_ENABLE_READ() stepperZ.isEnabled()
|
123
|
137
|
#endif
|
124
|
138
|
#if AXIS_HAS_SQUARE_WAVE(Z)
|
|
@@ -129,9 +143,13 @@ void reset_trinamic_drivers();
|
129
|
143
|
// X2 Stepper
|
130
|
144
|
#if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
|
131
|
145
|
extern TMC_CLASS(X2, X) stepperX2;
|
|
146
|
+ #ifndef CHOPPER_TIMING_X2
|
|
147
|
+ #define CHOPPER_TIMING_X2 CHOPPER_TIMING_E
|
|
148
|
+ #endif
|
|
149
|
+ static constexpr chopper_timing_t chopper_timing_X2 = CHOPPER_TIMING_X2;
|
132
|
150
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
133
|
151
|
#define X2_ENABLE_INIT() NOOP
|
134
|
|
- #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
|
|
152
|
+ #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing_X2.toff : 0)
|
135
|
153
|
#define X2_ENABLE_READ() stepperX2.isEnabled()
|
136
|
154
|
#endif
|
137
|
155
|
#if AXIS_HAS_SQUARE_WAVE(X2)
|
|
@@ -142,9 +160,13 @@ void reset_trinamic_drivers();
|
142
|
160
|
// Y2 Stepper
|
143
|
161
|
#if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
|
144
|
162
|
extern TMC_CLASS(Y2, Y) stepperY2;
|
|
163
|
+ #ifndef CHOPPER_TIMING_Y2
|
|
164
|
+ #define CHOPPER_TIMING_Y2 CHOPPER_TIMING_E
|
|
165
|
+ #endif
|
|
166
|
+ static constexpr chopper_timing_t chopper_timing_Y2 = CHOPPER_TIMING_Y2;
|
145
|
167
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
146
|
168
|
#define Y2_ENABLE_INIT() NOOP
|
147
|
|
- #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
|
|
169
|
+ #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y2.toff : 0)
|
148
|
170
|
#define Y2_ENABLE_READ() stepperY2.isEnabled()
|
149
|
171
|
#endif
|
150
|
172
|
#if AXIS_HAS_SQUARE_WAVE(Y2)
|
|
@@ -155,9 +177,13 @@ void reset_trinamic_drivers();
|
155
|
177
|
// Z2 Stepper
|
156
|
178
|
#if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
|
157
|
179
|
extern TMC_CLASS(Z2, Z) stepperZ2;
|
|
180
|
+ #ifndef CHOPPER_TIMING_Z2
|
|
181
|
+ #define CHOPPER_TIMING_Z2 CHOPPER_TIMING_E
|
|
182
|
+ #endif
|
|
183
|
+ static constexpr chopper_timing_t chopper_timing_Z2 = CHOPPER_TIMING_Z2;
|
158
|
184
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
|
159
|
185
|
#define Z2_ENABLE_INIT() NOOP
|
160
|
|
- #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
|
|
186
|
+ #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z2.toff : 0)
|
161
|
187
|
#define Z2_ENABLE_READ() stepperZ2.isEnabled()
|
162
|
188
|
#endif
|
163
|
189
|
#if AXIS_HAS_SQUARE_WAVE(Z2)
|
|
@@ -168,9 +194,13 @@ void reset_trinamic_drivers();
|
168
|
194
|
// Z3 Stepper
|
169
|
195
|
#if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
|
170
|
196
|
extern TMC_CLASS(Z3, Z) stepperZ3;
|
|
197
|
+ #ifndef CHOPPER_TIMING_Z3
|
|
198
|
+ #define CHOPPER_TIMING_Z3 CHOPPER_TIMING_E
|
|
199
|
+ #endif
|
|
200
|
+ static constexpr chopper_timing_t chopper_timing_Z3 = CHOPPER_TIMING_Z3;
|
171
|
201
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
172
|
202
|
#define Z3_ENABLE_INIT() NOOP
|
173
|
|
- #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
|
|
203
|
+ #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z3.toff : 0)
|
174
|
204
|
#define Z3_ENABLE_READ() stepperZ3.isEnabled()
|
175
|
205
|
#endif
|
176
|
206
|
#if AXIS_HAS_SQUARE_WAVE(Z3)
|
|
@@ -181,9 +211,13 @@ void reset_trinamic_drivers();
|
181
|
211
|
// Z4 Stepper
|
182
|
212
|
#if HAS_Z4_ENABLE && AXIS_IS_TMC(Z4)
|
183
|
213
|
extern TMC_CLASS(Z4, Z) stepperZ4;
|
|
214
|
+ #ifndef CHOPPER_TIMING_Z4
|
|
215
|
+ #define CHOPPER_TIMING_Z4 CHOPPER_TIMING_E
|
|
216
|
+ #endif
|
|
217
|
+ static constexpr chopper_timing_t chopper_timing_Z4 = CHOPPER_TIMING_Z4;
|
184
|
218
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE)
|
185
|
219
|
#define Z4_ENABLE_INIT() NOOP
|
186
|
|
- #define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
|
|
220
|
+ #define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z4.toff : 0)
|
187
|
221
|
#define Z4_ENABLE_READ() stepperZ4.isEnabled()
|
188
|
222
|
#endif
|
189
|
223
|
#if AXIS_HAS_SQUARE_WAVE(Z4)
|
|
@@ -194,9 +228,13 @@ void reset_trinamic_drivers();
|
194
|
228
|
// E0 Stepper
|
195
|
229
|
#if AXIS_IS_TMC(E0)
|
196
|
230
|
extern TMC_CLASS_E(0) stepperE0;
|
|
231
|
+ #ifndef CHOPPER_TIMING_E0
|
|
232
|
+ #define CHOPPER_TIMING_E0 CHOPPER_TIMING_E
|
|
233
|
+ #endif
|
|
234
|
+ static constexpr chopper_timing_t chopper_timing_E0 = CHOPPER_TIMING_E0;
|
197
|
235
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
|
198
|
236
|
#define E0_ENABLE_INIT() NOOP
|
199
|
|
- #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
237
|
+ #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing_E0.toff : 0)
|
200
|
238
|
#define E0_ENABLE_READ() stepperE0.isEnabled()
|
201
|
239
|
#endif
|
202
|
240
|
#if AXIS_HAS_SQUARE_WAVE(E0)
|
|
@@ -207,9 +245,13 @@ void reset_trinamic_drivers();
|
207
|
245
|
// E1 Stepper
|
208
|
246
|
#if AXIS_IS_TMC(E1)
|
209
|
247
|
extern TMC_CLASS_E(1) stepperE1;
|
|
248
|
+ #ifndef CHOPPER_TIMING_E1
|
|
249
|
+ #define CHOPPER_TIMING_E1 CHOPPER_TIMING_E
|
|
250
|
+ #endif
|
|
251
|
+ static constexpr chopper_timing_t chopper_timing_E1 = CHOPPER_TIMING_E1;
|
210
|
252
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
|
211
|
253
|
#define E1_ENABLE_INIT() NOOP
|
212
|
|
- #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
254
|
+ #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing_E1.toff : 0)
|
213
|
255
|
#define E1_ENABLE_READ() stepperE1.isEnabled()
|
214
|
256
|
#endif
|
215
|
257
|
#if AXIS_HAS_SQUARE_WAVE(E1)
|
|
@@ -220,9 +262,13 @@ void reset_trinamic_drivers();
|
220
|
262
|
// E2 Stepper
|
221
|
263
|
#if AXIS_IS_TMC(E2)
|
222
|
264
|
extern TMC_CLASS_E(2) stepperE2;
|
|
265
|
+ #ifndef CHOPPER_TIMING_E2
|
|
266
|
+ #define CHOPPER_TIMING_E2 CHOPPER_TIMING_E
|
|
267
|
+ #endif
|
|
268
|
+ static constexpr chopper_timing_t chopper_timing_E2 = CHOPPER_TIMING_E2;
|
223
|
269
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
|
224
|
270
|
#define E2_ENABLE_INIT() NOOP
|
225
|
|
- #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
271
|
+ #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing_E2.toff : 0)
|
226
|
272
|
#define E2_ENABLE_READ() stepperE2.isEnabled()
|
227
|
273
|
#endif
|
228
|
274
|
#if AXIS_HAS_SQUARE_WAVE(E2)
|
|
@@ -233,9 +279,13 @@ void reset_trinamic_drivers();
|
233
|
279
|
// E3 Stepper
|
234
|
280
|
#if AXIS_IS_TMC(E3)
|
235
|
281
|
extern TMC_CLASS_E(3) stepperE3;
|
|
282
|
+ #ifndef CHOPPER_TIMING_E3
|
|
283
|
+ #define CHOPPER_TIMING_E3 CHOPPER_TIMING_E
|
|
284
|
+ #endif
|
|
285
|
+ static constexpr chopper_timing_t chopper_timing_E3 = CHOPPER_TIMING_E3;
|
236
|
286
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
|
237
|
287
|
#define E3_ENABLE_INIT() NOOP
|
238
|
|
- #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
288
|
+ #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing_E3.toff : 0)
|
239
|
289
|
#define E3_ENABLE_READ() stepperE3.isEnabled()
|
240
|
290
|
#endif
|
241
|
291
|
#if AXIS_HAS_SQUARE_WAVE(E3)
|
|
@@ -246,9 +296,13 @@ void reset_trinamic_drivers();
|
246
|
296
|
// E4 Stepper
|
247
|
297
|
#if AXIS_IS_TMC(E4)
|
248
|
298
|
extern TMC_CLASS_E(4) stepperE4;
|
|
299
|
+ #ifndef CHOPPER_TIMING_E4
|
|
300
|
+ #define CHOPPER_TIMING_E4 CHOPPER_TIMING_E
|
|
301
|
+ #endif
|
|
302
|
+ static constexpr chopper_timing_t chopper_timing_E4 = CHOPPER_TIMING_E4;
|
249
|
303
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
|
250
|
304
|
#define E4_ENABLE_INIT() NOOP
|
251
|
|
- #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
305
|
+ #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing_E4.toff : 0)
|
252
|
306
|
#define E4_ENABLE_READ() stepperE4.isEnabled()
|
253
|
307
|
#endif
|
254
|
308
|
#if AXIS_HAS_SQUARE_WAVE(E4)
|
|
@@ -259,9 +313,13 @@ void reset_trinamic_drivers();
|
259
|
313
|
// E5 Stepper
|
260
|
314
|
#if AXIS_IS_TMC(E5)
|
261
|
315
|
extern TMC_CLASS_E(5) stepperE5;
|
|
316
|
+ #ifndef CHOPPER_TIMING_E5
|
|
317
|
+ #define CHOPPER_TIMING_E5 CHOPPER_TIMING_E
|
|
318
|
+ #endif
|
|
319
|
+ static constexpr chopper_timing_t chopper_timing_E5 = CHOPPER_TIMING_E5;
|
262
|
320
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
|
263
|
321
|
#define E5_ENABLE_INIT() NOOP
|
264
|
|
- #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
322
|
+ #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing_E5.toff : 0)
|
265
|
323
|
#define E5_ENABLE_READ() stepperE5.isEnabled()
|
266
|
324
|
#endif
|
267
|
325
|
#if AXIS_HAS_SQUARE_WAVE(E5)
|
|
@@ -272,9 +330,13 @@ void reset_trinamic_drivers();
|
272
|
330
|
// E6 Stepper
|
273
|
331
|
#if AXIS_IS_TMC(E6)
|
274
|
332
|
extern TMC_CLASS_E(6) stepperE6;
|
|
333
|
+ #ifndef CHOPPER_TIMING_E6
|
|
334
|
+ #define CHOPPER_TIMING_E6 CHOPPER_TIMING_E
|
|
335
|
+ #endif
|
|
336
|
+ static constexpr chopper_timing_t chopper_timing_E6 = CHOPPER_TIMING_E6;
|
275
|
337
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E6)
|
276
|
338
|
#define E6_ENABLE_INIT() NOOP
|
277
|
|
- #define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
339
|
+ #define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing_E6.toff : 0)
|
278
|
340
|
#define E6_ENABLE_READ() stepperE6.isEnabled()
|
279
|
341
|
#endif
|
280
|
342
|
#if AXIS_HAS_SQUARE_WAVE(E6)
|
|
@@ -285,9 +347,13 @@ void reset_trinamic_drivers();
|
285
|
347
|
// E7 Stepper
|
286
|
348
|
#if AXIS_IS_TMC(E7)
|
287
|
349
|
extern TMC_CLASS_E(7) stepperE7;
|
|
350
|
+ #ifndef CHOPPER_TIMING_E7
|
|
351
|
+ #define CHOPPER_TIMING_E7 CHOPPER_TIMING_E
|
|
352
|
+ #endif
|
|
353
|
+ static constexpr chopper_timing_t chopper_timing_E7 = CHOPPER_TIMING_E7;
|
288
|
354
|
#if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E7)
|
289
|
355
|
#define E7_ENABLE_INIT() NOOP
|
290
|
|
- #define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
|
|
356
|
+ #define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing_E7.toff : 0)
|
291
|
357
|
#define E7_ENABLE_READ() stepperE7.isEnabled()
|
292
|
358
|
#endif
|
293
|
359
|
#if AXIS_HAS_SQUARE_WAVE(E7)
|