|
@@ -54,29 +54,32 @@
|
54
|
54
|
#else
|
55
|
55
|
#include <TMC26XStepper.h>
|
56
|
56
|
#endif
|
57
|
|
- void tmc26x_init();
|
|
57
|
+ void tmc26x_init_to_defaults();
|
58
|
58
|
#endif
|
59
|
59
|
|
60
|
60
|
#if ENABLED(HAVE_TMC2130)
|
61
|
61
|
#include <TMC2130Stepper.h>
|
62
|
|
- void tmc2130_init();
|
|
62
|
+ void tmc2130_init_to_defaults();
|
63
|
63
|
#endif
|
64
|
64
|
|
65
|
65
|
#if ENABLED(HAVE_TMC2208)
|
66
|
66
|
#include <TMC2208Stepper.h>
|
67
|
67
|
void tmc2208_serial_begin();
|
68
|
|
- void tmc2208_init();
|
|
68
|
+ void tmc2208_init_to_defaults();
|
69
|
69
|
#endif
|
70
|
70
|
|
71
|
71
|
// L6470 has STEP on normal pins, but DIR/ENABLE via SPI
|
72
|
72
|
#if ENABLED(HAVE_L6470DRIVER)
|
73
|
73
|
#include <SPI.h>
|
74
|
74
|
#include <L6470.h>
|
75
|
|
- void L6470_init();
|
|
75
|
+ void L6470_init_to_defaults();
|
76
|
76
|
#endif
|
77
|
77
|
|
|
78
|
+void restore_stepper_drivers(); // Called by PSU_ON
|
|
79
|
+void reset_stepper_drivers(); // Called by settings.load / settings.reset
|
|
80
|
+
|
78
|
81
|
// X Stepper
|
79
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(X_IS_L6470)
|
|
82
|
+#if ENABLED(X_IS_L6470)
|
80
|
83
|
extern L6470 stepperX;
|
81
|
84
|
#define X_ENABLE_INIT NOOP
|
82
|
85
|
#define X_ENABLE_WRITE(STATE) do{ if (STATE) stepperX.Step_Clock(stepperX.getStatus() & STATUS_HIZ); else stepperX.softFree(); }while(0)
|
|
@@ -91,9 +94,9 @@
|
91
|
94
|
#define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
|
92
|
95
|
#define X_ENABLE_READ stepperX.isEnabled()
|
93
|
96
|
#else
|
94
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(X_IS_TMC2130)
|
|
97
|
+ #if ENABLED(X_IS_TMC2130)
|
95
|
98
|
extern TMC2130Stepper stepperX;
|
96
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(X_IS_TMC2208)
|
|
99
|
+ #elif ENABLED(X_IS_TMC2208)
|
97
|
100
|
extern TMC2208Stepper stepperX;
|
98
|
101
|
#endif
|
99
|
102
|
#define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
|
|
@@ -109,7 +112,7 @@
|
109
|
112
|
#define X_STEP_READ READ(X_STEP_PIN)
|
110
|
113
|
|
111
|
114
|
// Y Stepper
|
112
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(Y_IS_L6470)
|
|
115
|
+#if ENABLED(Y_IS_L6470)
|
113
|
116
|
extern L6470 stepperY;
|
114
|
117
|
#define Y_ENABLE_INIT NOOP
|
115
|
118
|
#define Y_ENABLE_WRITE(STATE) do{ if (STATE) stepperY.Step_Clock(stepperY.getStatus() & STATUS_HIZ); else stepperY.softFree(); }while(0)
|
|
@@ -124,9 +127,9 @@
|
124
|
127
|
#define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
|
125
|
128
|
#define Y_ENABLE_READ stepperY.isEnabled()
|
126
|
129
|
#else
|
127
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(Y_IS_TMC2130)
|
|
130
|
+ #if ENABLED(Y_IS_TMC2130)
|
128
|
131
|
extern TMC2130Stepper stepperY;
|
129
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(Y_IS_TMC2208)
|
|
132
|
+ #elif ENABLED(Y_IS_TMC2208)
|
130
|
133
|
extern TMC2208Stepper stepperY;
|
131
|
134
|
#endif
|
132
|
135
|
#define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
|
|
@@ -142,7 +145,7 @@
|
142
|
145
|
#define Y_STEP_READ READ(Y_STEP_PIN)
|
143
|
146
|
|
144
|
147
|
// Z Stepper
|
145
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(Z_IS_L6470)
|
|
148
|
+#if ENABLED(Z_IS_L6470)
|
146
|
149
|
extern L6470 stepperZ;
|
147
|
150
|
#define Z_ENABLE_INIT NOOP
|
148
|
151
|
#define Z_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ.Step_Clock(stepperZ.getStatus() & STATUS_HIZ); else stepperZ.softFree(); }while(0)
|
|
@@ -157,9 +160,9 @@
|
157
|
160
|
#define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
|
158
|
161
|
#define Z_ENABLE_READ stepperZ.isEnabled()
|
159
|
162
|
#else
|
160
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(Z_IS_TMC2130)
|
|
163
|
+ #if ENABLED(Z_IS_TMC2130)
|
161
|
164
|
extern TMC2130Stepper stepperZ;
|
162
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(Z_IS_TMC2208)
|
|
165
|
+ #elif ENABLED(Z_IS_TMC2208)
|
163
|
166
|
extern TMC2208Stepper stepperZ;
|
164
|
167
|
#endif
|
165
|
168
|
#define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
|
|
@@ -176,7 +179,7 @@
|
176
|
179
|
|
177
|
180
|
// X2 Stepper
|
178
|
181
|
#if HAS_X2_ENABLE
|
179
|
|
- #if ENABLED(HAVE_L6470DRIVER) && ENABLED(X2_IS_L6470)
|
|
182
|
+ #if ENABLED(X2_IS_L6470)
|
180
|
183
|
extern L6470 stepperX2;
|
181
|
184
|
#define X2_ENABLE_INIT NOOP
|
182
|
185
|
#define X2_ENABLE_WRITE(STATE) do{ if (STATE) stepperX2.Step_Clock(stepperX2.getStatus() & STATUS_HIZ); else stepperX2.softFree(); }while(0)
|
|
@@ -191,9 +194,9 @@
|
191
|
194
|
#define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
|
192
|
195
|
#define X2_ENABLE_READ stepperX2.isEnabled()
|
193
|
196
|
#else
|
194
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(X2_IS_TMC2130)
|
|
197
|
+ #if ENABLED(X2_IS_TMC2130)
|
195
|
198
|
extern TMC2130Stepper stepperX2;
|
196
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(X2_IS_TMC2208)
|
|
199
|
+ #elif ENABLED(X2_IS_TMC2208)
|
197
|
200
|
extern TMC2208Stepper stepperX2;
|
198
|
201
|
#endif
|
199
|
202
|
#define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
|
|
@@ -211,7 +214,7 @@
|
211
|
214
|
|
212
|
215
|
// Y2 Stepper
|
213
|
216
|
#if HAS_Y2_ENABLE
|
214
|
|
- #if ENABLED(HAVE_L6470DRIVER) && ENABLED(Y2_IS_L6470)
|
|
217
|
+ #if ENABLED(Y2_IS_L6470)
|
215
|
218
|
extern L6470 stepperY2;
|
216
|
219
|
#define Y2_ENABLE_INIT NOOP
|
217
|
220
|
#define Y2_ENABLE_WRITE(STATE) do{ if (STATE) stepperY2.Step_Clock(stepperY2.getStatus() & STATUS_HIZ); else stepperY2.softFree(); }while(0)
|
|
@@ -226,9 +229,9 @@
|
226
|
229
|
#define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
|
227
|
230
|
#define Y2_ENABLE_READ stepperY2.isEnabled()
|
228
|
231
|
#else
|
229
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(Y2_IS_TMC2130)
|
|
232
|
+ #if ENABLED(Y2_IS_TMC2130)
|
230
|
233
|
extern TMC2130Stepper stepperY2;
|
231
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(Y2_IS_TMC2208)
|
|
234
|
+ #elif ENABLED(Y2_IS_TMC2208)
|
232
|
235
|
extern TMC2208Stepper stepperY2;
|
233
|
236
|
#endif
|
234
|
237
|
#define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
|
|
@@ -246,7 +249,7 @@
|
246
|
249
|
|
247
|
250
|
// Z2 Stepper
|
248
|
251
|
#if HAS_Z2_ENABLE
|
249
|
|
- #if ENABLED(HAVE_L6470DRIVER) && ENABLED(Z2_IS_L6470)
|
|
252
|
+ #if ENABLED(Z2_IS_L6470)
|
250
|
253
|
extern L6470 stepperZ2;
|
251
|
254
|
#define Z2_ENABLE_INIT NOOP
|
252
|
255
|
#define Z2_ENABLE_WRITE(STATE) do{ if (STATE) stepperZ2.Step_Clock(stepperZ2.getStatus() & STATUS_HIZ); else stepperZ2.softFree(); }while(0)
|
|
@@ -261,9 +264,9 @@
|
261
|
264
|
#define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
|
262
|
265
|
#define Z2_ENABLE_READ stepperZ2.isEnabled()
|
263
|
266
|
#else
|
264
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(Z2_IS_TMC2130)
|
|
267
|
+ #if ENABLED(Z2_IS_TMC2130)
|
265
|
268
|
extern TMC2130Stepper stepperZ2;
|
266
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(Z2_IS_TMC2208)
|
|
269
|
+ #elif ENABLED(Z2_IS_TMC2208)
|
267
|
270
|
extern TMC2208Stepper stepperZ2;
|
268
|
271
|
#endif
|
269
|
272
|
#define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
|
|
@@ -280,7 +283,7 @@
|
280
|
283
|
#endif
|
281
|
284
|
|
282
|
285
|
// E0 Stepper
|
283
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E0_IS_L6470)
|
|
286
|
+#if ENABLED(E0_IS_L6470)
|
284
|
287
|
extern L6470 stepperE0;
|
285
|
288
|
#define E0_ENABLE_INIT NOOP
|
286
|
289
|
#define E0_ENABLE_WRITE(STATE) do{ if (STATE) stepperE0.Step_Clock(stepperE0.getStatus() & STATUS_HIZ); else stepperE0.softFree(); }while(0)
|
|
@@ -295,9 +298,9 @@
|
295
|
298
|
#define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
|
296
|
299
|
#define E0_ENABLE_READ stepperE0.isEnabled()
|
297
|
300
|
#else
|
298
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(E0_IS_TMC2130)
|
|
301
|
+ #if ENABLED(E0_IS_TMC2130)
|
299
|
302
|
extern TMC2130Stepper stepperE0;
|
300
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(E0_IS_TMC2208)
|
|
303
|
+ #elif ENABLED(E0_IS_TMC2208)
|
301
|
304
|
extern TMC2208Stepper stepperE0;
|
302
|
305
|
#endif
|
303
|
306
|
#define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
|
|
@@ -313,7 +316,7 @@
|
313
|
316
|
#define E0_STEP_READ READ(E0_STEP_PIN)
|
314
|
317
|
|
315
|
318
|
// E1 Stepper
|
316
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E1_IS_L6470)
|
|
319
|
+#if ENABLED(E1_IS_L6470)
|
317
|
320
|
extern L6470 stepperE1;
|
318
|
321
|
#define E1_ENABLE_INIT NOOP
|
319
|
322
|
#define E1_ENABLE_WRITE(STATE) do{ if (STATE) stepperE1.Step_Clock(stepperE1.getStatus() & STATUS_HIZ); else stepperE1.softFree(); }while(0)
|
|
@@ -328,9 +331,9 @@
|
328
|
331
|
#define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
|
329
|
332
|
#define E1_ENABLE_READ stepperE1.isEnabled()
|
330
|
333
|
#else
|
331
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(E1_IS_TMC2130)
|
|
334
|
+ #if ENABLED(E1_IS_TMC2130)
|
332
|
335
|
extern TMC2130Stepper stepperE1;
|
333
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(E1_IS_TMC2208)
|
|
336
|
+ #elif ENABLED(E1_IS_TMC2208)
|
334
|
337
|
extern TMC2208Stepper stepperE1;
|
335
|
338
|
#endif
|
336
|
339
|
#define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
|
|
@@ -346,7 +349,7 @@
|
346
|
349
|
#define E1_STEP_READ READ(E1_STEP_PIN)
|
347
|
350
|
|
348
|
351
|
// E2 Stepper
|
349
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E2_IS_L6470)
|
|
352
|
+#if ENABLED(E2_IS_L6470)
|
350
|
353
|
extern L6470 stepperE2;
|
351
|
354
|
#define E2_ENABLE_INIT NOOP
|
352
|
355
|
#define E2_ENABLE_WRITE(STATE) do{ if (STATE) stepperE2.Step_Clock(stepperE2.getStatus() & STATUS_HIZ); else stepperE2.softFree(); }while(0)
|
|
@@ -361,9 +364,9 @@
|
361
|
364
|
#define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
|
362
|
365
|
#define E2_ENABLE_READ stepperE2.isEnabled()
|
363
|
366
|
#else
|
364
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(E2_IS_TMC2130)
|
|
367
|
+ #if ENABLED(E2_IS_TMC2130)
|
365
|
368
|
extern TMC2130Stepper stepperE2;
|
366
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(E2_IS_TMC2208)
|
|
369
|
+ #elif ENABLED(E2_IS_TMC2208)
|
367
|
370
|
extern TMC2208Stepper stepperE2;
|
368
|
371
|
#endif
|
369
|
372
|
#define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
|
|
@@ -379,7 +382,7 @@
|
379
|
382
|
#define E2_STEP_READ READ(E2_STEP_PIN)
|
380
|
383
|
|
381
|
384
|
// E3 Stepper
|
382
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E3_IS_L6470)
|
|
385
|
+#if ENABLED(E3_IS_L6470)
|
383
|
386
|
extern L6470 stepperE3;
|
384
|
387
|
#define E3_ENABLE_INIT NOOP
|
385
|
388
|
#define E3_ENABLE_WRITE(STATE) do{ if (STATE) stepperE3.Step_Clock(stepperE3.getStatus() & STATUS_HIZ); else stepperE3.softFree(); }while(0)
|
|
@@ -394,9 +397,9 @@
|
394
|
397
|
#define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
|
395
|
398
|
#define E3_ENABLE_READ stepperE3.isEnabled()
|
396
|
399
|
#else
|
397
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(E3_IS_TMC2130)
|
|
400
|
+ #if ENABLED(E3_IS_TMC2130)
|
398
|
401
|
extern TMC2130Stepper stepperE3;
|
399
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(E3_IS_TMC2208)
|
|
402
|
+ #elif ENABLED(E3_IS_TMC2208)
|
400
|
403
|
extern TMC2208Stepper stepperE3;
|
401
|
404
|
#endif
|
402
|
405
|
#define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
|
|
@@ -412,7 +415,7 @@
|
412
|
415
|
#define E3_STEP_READ READ(E3_STEP_PIN)
|
413
|
416
|
|
414
|
417
|
// E4 Stepper
|
415
|
|
-#if ENABLED(HAVE_L6470DRIVER) && ENABLED(E4_IS_L6470)
|
|
418
|
+#if ENABLED(E4_IS_L6470)
|
416
|
419
|
extern L6470 stepperE4;
|
417
|
420
|
#define E4_ENABLE_INIT NOOP
|
418
|
421
|
#define E4_ENABLE_WRITE(STATE) do{ if (STATE) stepperE4.Step_Clock(stepperE4.getStatus() & STATUS_HIZ); else stepperE4.softFree(); }while(0)
|
|
@@ -427,9 +430,9 @@
|
427
|
430
|
#define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
|
428
|
431
|
#define E4_ENABLE_READ stepperE4.isEnabled()
|
429
|
432
|
#else
|
430
|
|
- #if ENABLED(HAVE_TMC2130) && ENABLED(E4_IS_TMC2130)
|
|
433
|
+ #if ENABLED(E4_IS_TMC2130)
|
431
|
434
|
extern TMC2130Stepper stepperE4;
|
432
|
|
- #elif ENABLED(HAVE_TMC2208) && ENABLED(E4_IS_TMC2208)
|
|
435
|
+ #elif ENABLED(E4_IS_TMC2208)
|
433
|
436
|
extern TMC2208Stepper stepperE4;
|
434
|
437
|
#endif
|
435
|
438
|
#define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
|