瀏覽代碼

Consolidate smart stepper driver initialization

Scott Lahteine 6 年之前
父節點
當前提交
48d7036874

+ 5
- 0
Marlin/src/feature/power.cpp 查看文件

@@ -88,6 +88,11 @@ void Power::check() {
88 88
 void Power::power_on() {
89 89
   lastPowerOn = millis();
90 90
   PSU_PIN_ON();
91
+
92
+  #if HAS_TRINAMIC
93
+    delay(100); // Wait for power to settle
94
+    restore_stepper_drivers();
95
+  #endif
91 96
 }
92 97
 
93 98
 void Power::power_off() {

+ 3
- 8
Marlin/src/gcode/control/M80_M81.cpp 查看文件

@@ -76,14 +76,9 @@
76 76
       OUT_WRITE(SUICIDE_PIN, HIGH);
77 77
     #endif
78 78
 
79
-    #if ENABLED(HAVE_TMC2130)
80
-      delay(100);
81
-      tmc2130_init(); // Settings only stick when the driver has power
82
-    #endif
83
-
84
-    #if ENABLED(HAVE_TMC2208)
85
-      delay(100);
86
-      tmc2208_init();
79
+    #if DISABLED(AUTO_POWER_CONTROL)
80
+      delay(100); // Wait for power to settle
81
+      restore_stepper_drivers();
87 82
     #endif
88 83
 
89 84
     #if ENABLED(ULTIPANEL)

+ 0
- 25
Marlin/src/module/stepper.cpp 查看文件

@@ -921,31 +921,6 @@ void Stepper::init() {
921 921
     microstep_init();
922 922
   #endif
923 923
 
924
-  // Init TMC Steppers
925
-  #if ENABLED(HAVE_TMC26X)
926
-    tmc26x_init();
927
-  #endif
928
-
929
-  // Init TMC2130 Steppers
930
-  #if ENABLED(HAVE_TMC2130)
931
-    tmc2130_init();
932
-  #endif
933
-
934
-  // Init TMC2208 Steppers
935
-  #if ENABLED(HAVE_TMC2208)
936
-    tmc2208_init();
937
-  #endif
938
-
939
-  // TRAMS, TMC2130 and TMC2208 advanced settings
940
-  #if HAS_TRINAMIC
941
-    TMC_ADV()
942
-  #endif
943
-
944
-  // Init L6470 Steppers
945
-  #if ENABLED(HAVE_L6470DRIVER)
946
-    L6470_init();
947
-  #endif
948
-
949 924
   // Init Dir Pins
950 925
   #if HAS_X_DIR
951 926
     X_DIR_INIT;

+ 125
- 76
Marlin/src/module/stepper_indirection.cpp 查看文件

@@ -47,83 +47,82 @@
47 47
     #include <TMC26XStepper.h>
48 48
   #endif
49 49
 
50
-  #define _TMC_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_ENABLE_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
50
+  #define _TMC26X_DEFINE(ST) TMC26XStepper stepper##ST(200, ST##_ENABLE_PIN, ST##_STEP_PIN, ST##_DIR_PIN, ST##_MAX_CURRENT, ST##_SENSE_RESISTOR)
51 51
 
52 52
   #if ENABLED(X_IS_TMC26X)
53
-    _TMC_DEFINE(X);
53
+    _TMC26X_DEFINE(X);
54 54
   #endif
55 55
   #if ENABLED(X2_IS_TMC26X)
56
-    _TMC_DEFINE(X2);
56
+    _TMC26X_DEFINE(X2);
57 57
   #endif
58 58
   #if ENABLED(Y_IS_TMC26X)
59
-    _TMC_DEFINE(Y);
59
+    _TMC26X_DEFINE(Y);
60 60
   #endif
61 61
   #if ENABLED(Y2_IS_TMC26X)
62
-    _TMC_DEFINE(Y2);
62
+    _TMC26X_DEFINE(Y2);
63 63
   #endif
64 64
   #if ENABLED(Z_IS_TMC26X)
65
-    _TMC_DEFINE(Z);
65
+    _TMC26X_DEFINE(Z);
66 66
   #endif
67 67
   #if ENABLED(Z2_IS_TMC26X)
68
-    _TMC_DEFINE(Z2);
68
+    _TMC26X_DEFINE(Z2);
69 69
   #endif
70 70
   #if ENABLED(E0_IS_TMC26X)
71
-    _TMC_DEFINE(E0);
71
+    _TMC26X_DEFINE(E0);
72 72
   #endif
73 73
   #if ENABLED(E1_IS_TMC26X)
74
-    _TMC_DEFINE(E1);
74
+    _TMC26X_DEFINE(E1);
75 75
   #endif
76 76
   #if ENABLED(E2_IS_TMC26X)
77
-    _TMC_DEFINE(E2);
77
+    _TMC26X_DEFINE(E2);
78 78
   #endif
79 79
   #if ENABLED(E3_IS_TMC26X)
80
-    _TMC_DEFINE(E3);
80
+    _TMC26X_DEFINE(E3);
81 81
   #endif
82 82
   #if ENABLED(E4_IS_TMC26X)
83
-    _TMC_DEFINE(E4);
83
+    _TMC26X_DEFINE(E4);
84 84
   #endif
85 85
 
86
-  #define _TMC_INIT(A) do{ \
86
+  #define _TMC26X_INIT(A) do{ \
87 87
     stepper##A.setMicrosteps(A##_MICROSTEPS); \
88 88
     stepper##A.start(); \
89 89
   }while(0)
90 90
 
91
-  void tmc26x_init() {
91
+  void tmc26x_init_to_defaults() {
92 92
     #if ENABLED(X_IS_TMC26X)
93
-      _TMC_INIT(X);
93
+      _TMC26X_INIT(X);
94 94
     #endif
95 95
     #if ENABLED(X2_IS_TMC26X)
96
-      _TMC_INIT(X2);
96
+      _TMC26X_INIT(X2);
97 97
     #endif
98 98
     #if ENABLED(Y_IS_TMC26X)
99
-      _TMC_INIT(Y);
99
+      _TMC26X_INIT(Y);
100 100
     #endif
101 101
     #if ENABLED(Y2_IS_TMC26X)
102
-      _TMC_INIT(Y2);
102
+      _TMC26X_INIT(Y2);
103 103
     #endif
104 104
     #if ENABLED(Z_IS_TMC26X)
105
-      _TMC_INIT(Z);
105
+      _TMC26X_INIT(Z);
106 106
     #endif
107 107
     #if ENABLED(Z2_IS_TMC26X)
108
-      _TMC_INIT(Z2);
108
+      _TMC26X_INIT(Z2);
109 109
     #endif
110 110
     #if ENABLED(E0_IS_TMC26X)
111
-      _TMC_INIT(E0);
111
+      _TMC26X_INIT(E0);
112 112
     #endif
113 113
     #if ENABLED(E1_IS_TMC26X)
114
-      _TMC_INIT(E1);
114
+      _TMC26X_INIT(E1);
115 115
     #endif
116 116
     #if ENABLED(E2_IS_TMC26X)
117
-      _TMC_INIT(E2);
117
+      _TMC26X_INIT(E2);
118 118
     #endif
119 119
     #if ENABLED(E3_IS_TMC26X)
120
-      _TMC_INIT(E3);
120
+      _TMC26X_INIT(E3);
121 121
     #endif
122 122
     #if ENABLED(E4_IS_TMC26X)
123
-      _TMC_INIT(E4);
123
+      _TMC26X_INIT(E4);
124 124
     #endif
125 125
   }
126
-
127 126
 #endif // HAVE_TMC26X
128 127
 
129 128
 //
@@ -180,9 +179,9 @@
180 179
   // Use internal reference voltage for current calculations. This is the default.
181 180
   // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
182 181
   // https://www.trinamic.com/products/integrated-circuits/details/tmc2130/
183
-  void tmc2130_init(TMC2130Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
182
+  void tmc2130_init(TMC2130Stepper &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
184 183
     st.begin();
185
-    st.setCurrent(st.getCurrent(), R_SENSE, HOLD_MULTIPLIER);
184
+    st.setCurrent(mA, R_SENSE, HOLD_MULTIPLIER);
186 185
     st.microsteps(microsteps);
187 186
     st.blank_time(24);
188 187
     st.off_time(5); // Only enables the driver if used with stealthChop
@@ -209,9 +208,9 @@
209 208
     st.GSTAT(); // Clear GSTAT
210 209
   }
211 210
 
212
-  #define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
211
+  #define _TMC2130_INIT(ST, SPMM) tmc2130_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
213 212
 
214
-  void tmc2130_init() {
213
+  void tmc2130_init_to_defaults() {
215 214
     #if ENABLED(X_IS_TMC2130)
216 215
       _TMC2130_INIT( X, planner.axis_steps_per_mm[X_AXIS]);
217 216
     #endif
@@ -234,34 +233,45 @@
234 233
       _TMC2130_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
235 234
     #endif
236 235
     #if ENABLED(E1_IS_TMC2130)
237
-      _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS
238
-        #if ENABLED(DISTINCT_E_FACTORS)
239
-          + 1
240
-        #endif
241
-      ]);
236
+      { constexpr int extruder = 1; _TMC2130_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
242 237
     #endif
243 238
     #if ENABLED(E2_IS_TMC2130)
244
-      _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS
245
-        #if ENABLED(DISTINCT_E_FACTORS)
246
-          + 2
247
-        #endif
248
-      ]);
239
+      { constexpr int extruder = 2; _TMC2130_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
249 240
     #endif
250 241
     #if ENABLED(E3_IS_TMC2130)
251
-      _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS
252
-        #if ENABLED(DISTINCT_E_FACTORS)
253
-          + 3
254
-        #endif
255
-      ]);
242
+      { constexpr int extruder = 3; _TMC2130_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
256 243
     #endif
257 244
     #if ENABLED(E4_IS_TMC2130)
258
-      _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS
259
-        #if ENABLED(DISTINCT_E_FACTORS)
260
-          + 4
261
-        #endif
262
-      ]);
245
+      { constexpr int extruder = 4; _TMC2130_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
263 246
     #endif
264 247
 
248
+    #if ENABLED(SENSORLESS_HOMING)
249
+      #define TMC_INIT_SGT(P,Q) stepper##Q.sgt(P##_HOMING_SENSITIVITY);
250
+      #ifdef X_HOMING_SENSITIVITY
251
+        #if ENABLED(X_IS_TMC2130) || ENABLED(IS_TRAMS)
252
+          stepperX.sgt(X_HOMING_SENSITIVITY);
253
+        #endif
254
+        #if ENABLED(X2_IS_TMC2130)
255
+          stepperX2.sgt(X_HOMING_SENSITIVITY);
256
+        #endif
257
+      #endif
258
+      #ifdef Y_HOMING_SENSITIVITY
259
+        #if ENABLED(Y_IS_TMC2130) || ENABLED(IS_TRAMS)
260
+          stepperY.sgt(Y_HOMING_SENSITIVITY);
261
+        #endif
262
+        #if ENABLED(Y2_IS_TMC2130)
263
+          stepperY2.sgt(Y_HOMING_SENSITIVITY);
264
+        #endif
265
+      #endif
266
+      #ifdef Z_HOMING_SENSITIVITY
267
+        #if ENABLED(Z_IS_TMC2130) || ENABLED(IS_TRAMS)
268
+          stepperZ.sgt(Z_HOMING_SENSITIVITY);
269
+        #endif
270
+        #if ENABLED(Z2_IS_TMC2130)
271
+          stepperZ2.sgt(Z_HOMING_SENSITIVITY);
272
+        #endif
273
+      #endif
274
+    #endif
265 275
   }
266 276
 #endif // HAVE_TMC2130
267 277
 
@@ -396,11 +406,11 @@
396 406
 
397 407
   // Use internal reference voltage for current calculations. This is the default.
398 408
   // Following values from Trinamic's spreadsheet with values for a NEMA17 (42BYGHW609)
399
-  void tmc2208_init(TMC2208Stepper &st, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
409
+  void tmc2208_init(TMC2208Stepper &st, const uint16_t mA, const uint16_t microsteps, const uint32_t thrs, const float spmm) {
400 410
     st.pdn_disable(true); // Use UART
401 411
     st.mstep_reg_select(true); // Select microsteps with UART
402 412
     st.I_scale_analog(false);
403
-    st.rms_current(st.getCurrent(), HOLD_MULTIPLIER, R_SENSE);
413
+    st.rms_current(mA, HOLD_MULTIPLIER, R_SENSE);
404 414
     st.microsteps(microsteps);
405 415
     st.blank_time(24);
406 416
     st.toff(5);
@@ -430,9 +440,9 @@
430 440
     delay(200);
431 441
   }
432 442
 
433
-  #define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
443
+  #define _TMC2208_INIT(ST, SPMM) tmc2208_init(stepper##ST, ST##_CURRENT, ST##_MICROSTEPS, ST##_HYBRID_THRESHOLD, SPMM)
434 444
 
435
-  void tmc2208_init() {
445
+  void tmc2208_init_to_defaults() {
436 446
     #if ENABLED(X_IS_TMC2208)
437 447
       _TMC2208_INIT(X, planner.axis_steps_per_mm[X_AXIS]);
438 448
     #endif
@@ -455,36 +465,76 @@
455 465
       _TMC2208_INIT(E0, planner.axis_steps_per_mm[E_AXIS]);
456 466
     #endif
457 467
     #if ENABLED(E1_IS_TMC2208)
458
-      _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS
459
-        #if ENABLED(DISTINCT_E_FACTORS)
460
-          + 1
461
-        #endif
462
-      ]);
468
+      { constexpr int extruder = 1; _TMC2208_INIT(E1, planner.axis_steps_per_mm[E_AXIS_N]); }
463 469
     #endif
464 470
     #if ENABLED(E2_IS_TMC2208)
465
-      _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS
466
-        #if ENABLED(DISTINCT_E_FACTORS)
467
-          + 2
468
-        #endif
469
-      ]);
471
+      { constexpr int extruder = 2; _TMC2208_INIT(E2, planner.axis_steps_per_mm[E_AXIS_N]); }
470 472
     #endif
471 473
     #if ENABLED(E3_IS_TMC2208)
472
-      _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS
473
-        #if ENABLED(DISTINCT_E_FACTORS)
474
-          + 3
475
-        #endif
476
-      ]);
474
+      { constexpr int extruder = 3; _TMC2208_INIT(E3, planner.axis_steps_per_mm[E_AXIS_N]); }
477 475
     #endif
478 476
     #if ENABLED(E4_IS_TMC2208)
479
-      _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS
480
-        #if ENABLED(DISTINCT_E_FACTORS)
481
-          + 4
482
-        #endif
483
-      ]);
477
+      { constexpr int extruder = 4; _TMC2208_INIT(E4, planner.axis_steps_per_mm[E_AXIS_N]); }
484 478
     #endif
485 479
   }
486 480
 #endif // HAVE_TMC2208
487 481
 
482
+void restore_stepper_drivers() {
483
+  #if X_IS_TRINAMIC
484
+    stepperX.push();
485
+  #endif
486
+  #if X2_IS_TRINAMIC
487
+    stepperX2.push();
488
+  #endif
489
+  #if Y_IS_TRINAMIC
490
+    stepperY.push();
491
+  #endif
492
+  #if Y2_IS_TRINAMIC
493
+    stepperY2.push();
494
+  #endif
495
+  #if Z_IS_TRINAMIC
496
+    stepperZ.push();
497
+  #endif
498
+  #if Z2_IS_TRINAMIC
499
+    stepperZ2.push();
500
+  #endif
501
+  #if E0_IS_TRINAMIC
502
+    stepperE0.push();
503
+  #endif
504
+  #if E1_IS_TRINAMIC
505
+    stepperE1.push();
506
+  #endif
507
+  #if E2_IS_TRINAMIC
508
+    stepperE2.push();
509
+  #endif
510
+  #if E3_IS_TRINAMIC
511
+    stepperE3.push();
512
+  #endif
513
+  #if E4_IS_TRINAMIC
514
+    stepperE4.push();
515
+  #endif
516
+}
517
+
518
+void reset_stepper_drivers() {
519
+  #if ENABLED(HAVE_TMC26X)
520
+    tmc26x_init_to_defaults();
521
+  #endif
522
+  #if ENABLED(HAVE_TMC2130)
523
+    delay(100);
524
+    tmc2130_init_to_defaults();
525
+  #endif
526
+  #if ENABLED(HAVE_TMC2208)
527
+    delay(100);
528
+    tmc2208_init_to_defaults();
529
+  #endif
530
+  #ifdef TMC_ADV
531
+    TMC_ADV()
532
+  #endif
533
+  #if ENABLED(HAVE_L6470DRIVER)
534
+    L6470_init_to_defaults();
535
+  #endif
536
+}
537
+
488 538
 //
489 539
 // L6470 Driver objects and inits
490 540
 //
@@ -538,7 +588,7 @@
538 588
     stepper##A.setStallCurrent(A##_STALLCURRENT); \
539 589
   }while(0)
540 590
 
541
-  void L6470_init() {
591
+  void L6470_init_to_defaults() {
542 592
     #if ENABLED(X_IS_L6470)
543 593
       _L6470_INIT(X);
544 594
     #endif
@@ -575,4 +625,3 @@
575 625
   }
576 626
 
577 627
 #endif // HAVE_L6470DRIVER
578
-

+ 40
- 37
Marlin/src/module/stepper_indirection.h 查看文件

@@ -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)

Loading…
取消
儲存