Browse Source

Updates for L64XX

Scott Lahteine 5 years ago
parent
commit
707349d492

+ 2
- 2
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -530,14 +530,14 @@ void GcodeSuite::G28(const bool always_home_all) {
530 530
     // Set L6470 absolute position registers to counts
531 531
     // constexpr *might* move this to PROGMEM.
532 532
     // If not, this will need a PROGMEM directive and an accessor.
533
-    static constexpr AxisEnum L6470_axis_xref[MAX_L6470] = {
533
+    static constexpr AxisEnum L64XX_axis_xref[MAX_L64XX] = {
534 534
       X_AXIS, Y_AXIS, Z_AXIS,
535 535
       X_AXIS, Y_AXIS, Z_AXIS, Z_AXIS,
536 536
       E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS, E_AXIS
537 537
     };
538 538
     for (uint8_t j = 1; j <= L64XX::chain[0]; j++) {
539 539
       const uint8_t cv = L64XX::chain[j];
540
-      L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L6470_axis_xref[cv]));
540
+      L64xxManager.set_param((L64XX_axis_t)cv, L6470_ABS_POS, stepper.position(L64XX_axis_xref[cv]));
541 541
     }
542 542
   #endif
543 543
 }

+ 15
- 15
Marlin/src/gcode/feature/L6470/M906.cpp View File

@@ -77,7 +77,7 @@
77 77
  *    KVAL_DEC
78 78
  *    Vs compensation (if enabled)
79 79
  */
80
-void L6470_report_current(L64XX &motor, const L64XX_axis_t axis) {
80
+void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) {
81 81
 
82 82
   if (L64xxManager.spi_abort) return;  // don't do anything if set_directions() has occurred
83 83
 
@@ -303,48 +303,48 @@ void GcodeSuite::M906() {
303 303
   }
304 304
 
305 305
   if (report_current) {
306
-    #define L6470_REPORT_CURRENT(Q) L6470_report_current(stepper##Q, Q)
306
+    #define L64XX_REPORT_CURRENT(Q) L64XX_report_current(stepper##Q, Q)
307 307
 
308 308
     L64xxManager.spi_active = true; // Tell set_directions() a series of SPI transfers is underway
309 309
 
310 310
     #if AXIS_IS_L64XX(X)
311
-      L6470_REPORT_CURRENT(X);
311
+      L64XX_REPORT_CURRENT(X);
312 312
     #endif
313 313
     #if AXIS_IS_L64XX(X2)
314
-      L6470_REPORT_CURRENT(X2);
314
+      L64XX_REPORT_CURRENT(X2);
315 315
     #endif
316 316
     #if AXIS_IS_L64XX(Y)
317
-      L6470_REPORT_CURRENT(Y);
317
+      L64XX_REPORT_CURRENT(Y);
318 318
     #endif
319 319
     #if AXIS_IS_L64XX(Y2)
320
-      L6470_REPORT_CURRENT(Y2);
320
+      L64XX_REPORT_CURRENT(Y2);
321 321
     #endif
322 322
     #if AXIS_IS_L64XX(Z)
323
-      L6470_REPORT_CURRENT(Z);
323
+      L64XX_REPORT_CURRENT(Z);
324 324
     #endif
325 325
     #if AXIS_IS_L64XX(Z2)
326
-      L6470_REPORT_CURRENT(Z2);
326
+      L64XX_REPORT_CURRENT(Z2);
327 327
     #endif
328 328
     #if AXIS_IS_L64XX(Z3)
329
-      L6470_REPORT_CURRENT(Z3);
329
+      L64XX_REPORT_CURRENT(Z3);
330 330
     #endif
331 331
     #if AXIS_IS_L64XX(E0)
332
-      L6470_REPORT_CURRENT(E0);
332
+      L64XX_REPORT_CURRENT(E0);
333 333
     #endif
334 334
     #if AXIS_IS_L64XX(E1)
335
-      L6470_REPORT_CURRENT(E1);
335
+      L64XX_REPORT_CURRENT(E1);
336 336
     #endif
337 337
     #if AXIS_IS_L64XX(E2)
338
-      L6470_REPORT_CURRENT(E2);
338
+      L64XX_REPORT_CURRENT(E2);
339 339
     #endif
340 340
     #if AXIS_IS_L64XX(E3)
341
-      L6470_REPORT_CURRENT(E3);
341
+      L64XX_REPORT_CURRENT(E3);
342 342
     #endif
343 343
     #if AXIS_IS_L64XX(E4)
344
-      L6470_REPORT_CURRENT(E4);
344
+      L64XX_REPORT_CURRENT(E4);
345 345
     #endif
346 346
     #if AXIS_IS_L64XX(E5)
347
-      L6470_REPORT_CURRENT(E5);
347
+      L64XX_REPORT_CURRENT(E5);
348 348
     #endif
349 349
 
350 350
     L64xxManager.spi_active = false;   // done with all SPI transfers - clear handshake flags

+ 5
- 1
Marlin/src/inc/Conditionals_post.h View File

@@ -1030,7 +1030,9 @@
1030 1030
 #define HAS_Z_MIN_PROBE_PIN (HAS_CUSTOM_PROBE_PIN && PIN_EXISTS(Z_MIN_PROBE))
1031 1031
 #define HAS_CALIBRATION_PIN (PIN_EXISTS(CALIBRATION))
1032 1032
 
1033
+//
1033 1034
 // ADC Temp Sensors (Thermistor or Thermocouple with amplifier ADC interface)
1035
+//
1034 1036
 #define HAS_ADC_TEST(P) (PIN_EXISTS(TEMP_##P) && TEMP_SENSOR_##P != 0 && DISABLED(HEATER_##P##_USES_MAX6675))
1035 1037
 #define HAS_TEMP_ADC_0        HAS_ADC_TEST(0)
1036 1038
 #define HAS_TEMP_ADC_1        HAS_ADC_TEST(1)
@@ -1145,7 +1147,9 @@
1145 1147
 #define HAS_DIGIPOTSS         (PIN_EXISTS(DIGIPOTSS))
1146 1148
 #define HAS_MOTOR_CURRENT_PWM ANY_PIN(MOTOR_CURRENT_PWM_X, MOTOR_CURRENT_PWM_Y, MOTOR_CURRENT_PWM_XY, MOTOR_CURRENT_PWM_Z, MOTOR_CURRENT_PWM_E)
1147 1149
 
1148
-#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS || HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS)
1150
+#define HAS_SOME_Z_MICROSTEPS (HAS_Z_MICROSTEPS || HAS_Z2_MICROSTEPS || HAS_Z3_MICROSTEPS)
1151
+#define HAS_SOME_E_MICROSTEPS (HAS_E0_MICROSTEPS || HAS_E1_MICROSTEPS || HAS_E2_MICROSTEPS || HAS_E3_MICROSTEPS || HAS_E4_MICROSTEPS || HAS_E5_MICROSTEPS)
1152
+#define HAS_MICROSTEPS (HAS_X_MICROSTEPS || HAS_X2_MICROSTEPS || HAS_Y_MICROSTEPS || HAS_Y2_MICROSTEPS || HAS_SOME_Z_MICROSTEPS || HAS_SOME_E_MICROSTEPS)
1149 1153
 
1150 1154
 #if HAS_MICROSTEPS
1151 1155
 

+ 21
- 21
Marlin/src/libs/L64XX/L64XX_Marlin.cpp View File

@@ -39,34 +39,34 @@ L64XX_Marlin L64xxManager;
39 39
 
40 40
 void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); }
41 41
 
42
-char L64XX_Marlin::index_to_axis[MAX_L6470][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
42
+char L64XX_Marlin::index_to_axis[MAX_L64XX][3] = { "X ", "Y ", "Z ", "X2", "Y2", "Z2", "Z3", "E0", "E1", "E2", "E3", "E4", "E5" };
43 43
 
44 44
 #define DEBUG_OUT ENABLED(L6470_CHITCHAT)
45 45
 #include "../../core/debug_out.h"
46 46
 
47
-uint8_t L64XX_Marlin::dir_commands[MAX_L6470];  // array to hold direction command for each driver
47
+uint8_t L64XX_Marlin::dir_commands[MAX_L64XX];  // array to hold direction command for each driver
48 48
 
49
-uint8_t L64XX_Marlin::index_to_dir[MAX_L6470] = { (INVERT_X_DIR)                        , //  0 X
50
-                                                  (INVERT_Y_DIR)                        , //  1 Y
51
-                                                  (INVERT_Z_DIR)                        , //  2 Z
52
-                                                  #if ENABLED(X_DUAL_STEPPER_DRIVERS)
53
-                                                    (INVERT_X_DIR) ^ (INVERT_X2_VS_X_DIR) , //  3 X2
49
+uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = { (INVERT_X_DIR),                         //  0 X
50
+                                                  (INVERT_Y_DIR),                         //  1 Y
51
+                                                  (INVERT_Z_DIR),                         //  2 Z
52
+                                                  #if ENABLED(X_DUAL_STEPPER_DRIVERS)     //  3 X2
53
+                                                    (INVERT_X_DIR) ^ (INVERT_X2_VS_X_DIR),
54 54
                                                   #else
55
-                                                    (INVERT_X_DIR)                      , //  3 X2
55
+                                                    (INVERT_X_DIR),
56 56
                                                   #endif
57
-                                                  #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
58
-                                                    (INVERT_Y_DIR) ^ (INVERT_Y2_VS_Y_DIR) , //  4 Y2
57
+                                                  #if ENABLED(Y_DUAL_STEPPER_DRIVERS)     //  4 Y2
58
+                                                    (INVERT_Y_DIR) ^ (INVERT_Y2_VS_Y_DIR),
59 59
                                                   #else
60
-                                                    (INVERT_Y_DIR)                      , //  4 Y2
60
+                                                    (INVERT_Y_DIR),
61 61
                                                   #endif
62
-                                                  (INVERT_Z_DIR)                        , //  5 Z2
63
-                                                  (INVERT_Z_DIR)                        , //  6 Z3
64
-                                                  (INVERT_E0_DIR)                       , //  7 E0
65
-                                                  (INVERT_E1_DIR)                       , //  8 E1
66
-                                                  (INVERT_E2_DIR)                       , //  9 E2
67
-                                                  (INVERT_E3_DIR)                       , // 10 E3
68
-                                                  (INVERT_E4_DIR)                       , // 11 E4
69
-                                                  (INVERT_E5_DIR)                       , // 12 E5
62
+                                                  (INVERT_Z_DIR),                         //  5 Z2
63
+                                                  (INVERT_Z_DIR),                         //  6 Z3
64
+                                                  (INVERT_E0_DIR),                        //  7 E0
65
+                                                  (INVERT_E1_DIR),                        //  8 E1
66
+                                                  (INVERT_E2_DIR),                        //  9 E2
67
+                                                  (INVERT_E3_DIR),                        // 10 E3
68
+                                                  (INVERT_E4_DIR),                        // 11 E4
69
+                                                  (INVERT_E5_DIR),                        // 12 E5
70 70
                                                 };
71 71
 
72 72
 volatile uint8_t L64XX_Marlin::spi_abort = false;
@@ -367,7 +367,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
367 367
     uint8_t driver_count_local = 0;         // Can't use "driver_count" directly as a subscript because it's passed by reference
368 368
     if (axis_offset >= 2 || axis_mon[0][0] == 'E') {  // Single axis, E0, or E1
369 369
       axis_mon[0][1] = axis_offset + '0';
370
-      for (j = 0; j < MAX_L6470; j++) {       // See how many drivers on this axis
370
+      for (j = 0; j < MAX_L64XX; j++) {       // See how many drivers on this axis
371 371
         const char * const str = index_to_axis[j];
372 372
         if (axis_mon[0][0] == str[0]) {
373 373
           char * const mon = axis_mon[driver_count_local];
@@ -380,7 +380,7 @@ uint8_t L64XX_Marlin::get_user_input(uint8_t &driver_count, L64XX_axis_t axis_in
380 380
       }
381 381
     }
382 382
     else if (axis_offset == 0) {              // One or more axes
383
-      for (j = 0; j < MAX_L6470; j++) {       // See how many drivers on this axis
383
+      for (j = 0; j < MAX_L64XX; j++) {       // See how many drivers on this axis
384 384
         const char * const str = index_to_axis[j];
385 385
         if (axis_mon[0][0] == str[0]) {
386 386
           char * const mon = axis_mon[driver_count_local];

+ 4
- 6
Marlin/src/libs/L64XX/L64XX_Marlin.h View File

@@ -30,21 +30,19 @@
30 30
 
31 31
 #define L6470_GETPARAM(P,Q) stepper##Q.GetParam(P)
32 32
 
33
-#define MAX_L6470  (7 + MAX_EXTRUDERS) // Maximum number of axes in Marlin
34
-
35 33
 #define dSPIN_STEP_CLOCK      0x58
36 34
 #define dSPIN_STEP_CLOCK_FWD dSPIN_STEP_CLOCK
37 35
 #define dSPIN_STEP_CLOCK_REV dSPIN_STEP_CLOCK+1
38 36
 #define HAS_L64XX_EXTRUDER (AXIS_IS_L64XX(E0) || AXIS_IS_L64XX(E1) || AXIS_IS_L64XX(E2) || AXIS_IS_L64XX(E3) || AXIS_IS_L64XX(E4) || AXIS_IS_L64XX(E5))
39 37
 
40
-typedef enum : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5 } L64XX_axis_t;
38
+enum L64XX_axis_t : uint8_t { X, Y, Z, X2, Y2, Z2, Z3, E0, E1, E2, E3, E4, E5, MAX_L64XX };
41 39
 
42 40
 class L64XX_Marlin : public L64XXHelper {
43 41
 public:
44
-  static char index_to_axis[MAX_L6470][3];
42
+  static char index_to_axis[MAX_L64XX][3];
45 43
 
46
-  static uint8_t index_to_dir[MAX_L6470];
47
-  static uint8_t dir_commands[MAX_L6470];
44
+  static uint8_t index_to_dir[MAX_L64XX];
45
+  static uint8_t dir_commands[MAX_L64XX];
48 46
 
49 47
   // Flags to guarantee graceful switch if stepper interrupts L6470 SPI transfer
50 48
   static volatile uint8_t spi_abort;

+ 1
- 1
Marlin/src/module/stepper.cpp View File

@@ -119,7 +119,7 @@ Stepper stepper; // Singleton
119 119
 
120 120
 #if HAS_L64XX
121 121
   #include "../libs/L64XX/L64XX_Marlin.h"
122
-  uint8_t L6470_buf[MAX_L6470 + 1];   // chip command sequence - element 0 not used
122
+  uint8_t L6470_buf[MAX_L64XX + 1];   // chip command sequence - element 0 not used
123 123
   bool L64XX_OK_to_power_up = false;  // flag to keep L64xx steppers powered down after a reset or power up
124 124
 #endif
125 125
 

+ 78
- 78
Marlin/src/module/stepper/L64xx.h View File

@@ -44,220 +44,220 @@
44 44
 // X Stepper
45 45
 #if AXIS_IS_L64XX(X)
46 46
   extern L64XX_CLASS(X)         stepperX;
47
-  #define X_ENABLE_INIT         NOOP
47
+  #define X_ENABLE_INIT()       NOOP
48 48
   #define X_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX.free())
49
-  #define X_ENABLE_READ         (stepperX.getStatus() & STATUS_HIZ)
49
+  #define X_ENABLE_READ()       (stepperX.getStatus() & STATUS_HIZ)
50 50
   #if AXIS_DRIVER_TYPE_X(L6474)
51
-    #define X_DIR_INIT          SET_OUTPUT(X_DIR_PIN)
51
+    #define X_DIR_INIT()        SET_OUTPUT(X_DIR_PIN)
52 52
     #define X_DIR_WRITE(STATE)  L6474_DIR_WRITE(X, STATE)
53
-    #define X_DIR_READ          READ(X_DIR_PIN)
53
+    #define X_DIR_READ()        READ(X_DIR_PIN)
54 54
   #else
55
-    #define X_DIR_INIT          NOOP
55
+    #define X_DIR_INIT()        NOOP
56 56
     #define X_DIR_WRITE(STATE)  L64XX_DIR_WRITE(X, STATE)
57
-    #define X_DIR_READ          (stepper##X.getStatus() & STATUS_DIR);
57
+    #define X_DIR_READ()        (stepper##X.getStatus() & STATUS_DIR);
58 58
   #endif
59 59
 #endif
60 60
 
61 61
 // Y Stepper
62 62
 #if AXIS_IS_L64XX(Y)
63 63
   extern L64XX_CLASS(Y)         stepperY;
64
-  #define Y_ENABLE_INIT         NOOP
64
+  #define Y_ENABLE_INIT()       NOOP
65 65
   #define Y_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY.free())
66
-  #define Y_ENABLE_READ         (stepperY.getStatus() & STATUS_HIZ)
66
+  #define Y_ENABLE_READ()       (stepperY.getStatus() & STATUS_HIZ)
67 67
   #if AXIS_DRIVER_TYPE_Y(L6474)
68
-    #define Y_DIR_INIT          SET_OUTPUT(Y_DIR_PIN)
68
+    #define Y_DIR_INIT()        SET_OUTPUT(Y_DIR_PIN)
69 69
     #define Y_DIR_WRITE(STATE)  L6474_DIR_WRITE(Y, STATE)
70
-    #define Y_DIR_READ          READ(Y_DIR_PIN)
70
+    #define Y_DIR_READ()        READ(Y_DIR_PIN)
71 71
   #else
72
-    #define Y_DIR_INIT          NOOP
72
+    #define Y_DIR_INIT()        NOOP
73 73
     #define Y_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Y, STATE)
74
-    #define Y_DIR_READ          (stepper##Y.getStatus() & STATUS_DIR);
74
+    #define Y_DIR_READ()        (stepper##Y.getStatus() & STATUS_DIR);
75 75
   #endif
76 76
 #endif
77 77
 
78 78
 // Z Stepper
79 79
 #if AXIS_IS_L64XX(Z)
80 80
   extern L64XX_CLASS(Z)         stepperZ;
81
-  #define Z_ENABLE_INIT         NOOP
81
+  #define Z_ENABLE_INIT()       NOOP
82 82
   #define Z_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ.free())
83
-  #define Z_ENABLE_READ         (stepperZ.getStatus() & STATUS_HIZ)
83
+  #define Z_ENABLE_READ()       (stepperZ.getStatus() & STATUS_HIZ)
84 84
   #if AXIS_DRIVER_TYPE_Z(L6474)
85
-    #define Z_DIR_INIT          SET_OUTPUT(Z_DIR_PIN)
85
+    #define Z_DIR_INIT()        SET_OUTPUT(Z_DIR_PIN)
86 86
     #define Z_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z, STATE)
87
-    #define Z_DIR_READ          READ(Z_DIR_PIN)
87
+    #define Z_DIR_READ()        READ(Z_DIR_PIN)
88 88
   #else
89
-    #define Z_DIR_INIT          NOOP
89
+    #define Z_DIR_INIT()        NOOP
90 90
     #define Z_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z, STATE)
91
-    #define Z_DIR_READ          (stepper##Z.getStatus() & STATUS_DIR);
91
+    #define Z_DIR_READ()        (stepper##Z.getStatus() & STATUS_DIR);
92 92
   #endif
93 93
 #endif
94 94
 
95 95
 // X2 Stepper
96 96
 #if HAS_X2_ENABLE && AXIS_IS_L64XX(X2)
97 97
   extern L64XX_CLASS(X2)         stepperX2;
98
-  #define X2_ENABLE_INIT         NOOP
98
+  #define X2_ENABLE_INIT()       NOOP
99 99
   #define X2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperX2.free())
100
-  #define X2_ENABLE_READ         (stepperX2.getStatus() & STATUS_HIZ)
100
+  #define X2_ENABLE_READ()       (stepperX2.getStatus() & STATUS_HIZ)
101 101
   #if AXIS_DRIVER_TYPE_X2(L6474)
102
-    #define X2_DIR_INIT          SET_OUTPUT(X2_DIR_PIN)
102
+    #define X2_DIR_INIT()        SET_OUTPUT(X2_DIR_PIN)
103 103
     #define X2_DIR_WRITE(STATE)  L6474_DIR_WRITE(X2, STATE)
104
-    #define X2_DIR_READ          READ(X2_DIR_PIN)
104
+    #define X2_DIR_READ()        READ(X2_DIR_PIN)
105 105
   #else
106
-    #define X2_DIR_INIT          NOOP
106
+    #define X2_DIR_INIT()        NOOP
107 107
     #define X2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(X2, STATE)
108
-    #define X2_DIR_READ          (stepper##X2.getStatus() & STATUS_DIR);
108
+    #define X2_DIR_READ()        (stepper##X2.getStatus() & STATUS_DIR);
109 109
   #endif
110 110
 #endif
111 111
 
112 112
 // Y2 Stepper
113 113
 #if HAS_Y2_ENABLE && AXIS_IS_L64XX(Y2)
114 114
   extern L64XX_CLASS(Y2)         stepperY2;
115
-  #define Y2_ENABLE_INIT         NOOP
115
+  #define Y2_ENABLE_INIT()       NOOP
116 116
   #define Y2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperY2.free())
117
-  #define Y2_ENABLE_READ         (stepperY2.getStatus() & STATUS_HIZ)
117
+  #define Y2_ENABLE_READ()       (stepperY2.getStatus() & STATUS_HIZ)
118 118
   #if AXIS_DRIVER_TYPE_Y2(L6474)
119
-    #define Y2_DIR_INIT          SET_OUTPUT(Y2_DIR_PIN)
119
+    #define Y2_DIR_INIT()        SET_OUTPUT(Y2_DIR_PIN)
120 120
     #define Y2_DIR_WRITE(STATE)  L6474_DIR_WRITE(Y2, STATE)
121
-    #define Y2_DIR_READ          READ(Y2_DIR_PIN)
121
+    #define Y2_DIR_READ()        READ(Y2_DIR_PIN)
122 122
   #else
123
-    #define Y2_DIR_INIT          NOOP
123
+    #define Y2_DIR_INIT()        NOOP
124 124
     #define Y2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Y2, STATE)
125
-    #define Y2_DIR_READ          (stepper##Y2.getStatus() & STATUS_DIR);
125
+    #define Y2_DIR_READ()        (stepper##Y2.getStatus() & STATUS_DIR);
126 126
   #endif
127 127
 #endif
128 128
 
129 129
 // Z2 Stepper
130 130
 #if HAS_Z2_ENABLE && AXIS_IS_L64XX(Z2)
131 131
   extern L64XX_CLASS(Z2)         stepperZ2;
132
-  #define Z2_ENABLE_INIT         NOOP
132
+  #define Z2_ENABLE_INIT()       NOOP
133 133
   #define Z2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ2.free())
134
-  #define Z2_ENABLE_READ         (stepperZ2.getStatus() & STATUS_HIZ)
134
+  #define Z2_ENABLE_READ()       (stepperZ2.getStatus() & STATUS_HIZ)
135 135
   #if AXIS_DRIVER_TYPE_Z2(L6474)
136
-    #define Z2_DIR_INIT          SET_OUTPUT(Z2_DIR_PIN)
136
+    #define Z2_DIR_INIT()        SET_OUTPUT(Z2_DIR_PIN)
137 137
     #define Z2_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z2, STATE)
138
-    #define Z2_DIR_READ          READ(Z2_DIR_PIN)
138
+    #define Z2_DIR_READ()        READ(Z2_DIR_PIN)
139 139
   #else
140
-    #define Z2_DIR_INIT          NOOP
140
+    #define Z2_DIR_INIT()        NOOP
141 141
     #define Z2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z2, STATE)
142
-    #define Z2_DIR_READ          (stepper##Z2.getStatus() & STATUS_DIR);
142
+    #define Z2_DIR_READ()        (stepper##Z2.getStatus() & STATUS_DIR);
143 143
   #endif
144 144
 #endif
145 145
 
146 146
 // Z3 Stepper
147 147
 #if HAS_Z3_ENABLE && AXIS_IS_L64XX(Z3)
148 148
   extern L64XX_CLASS(Z3)         stepperZ3;
149
-  #define Z3_ENABLE_INIT         NOOP
149
+  #define Z3_ENABLE_INIT()       NOOP
150 150
   #define Z3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperZ3.free())
151
-  #define Z3_ENABLE_READ         (stepperZ3.getStatus() & STATUS_HIZ)
151
+  #define Z3_ENABLE_READ()       (stepperZ3.getStatus() & STATUS_HIZ)
152 152
   #if AXIS_DRIVER_TYPE_Z3(L6474)
153
-    #define Z3_DIR_INIT          SET_OUTPUT(Z3_DIR_PIN)
153
+    #define Z3_DIR_INIT()        SET_OUTPUT(Z3_DIR_PIN)
154 154
     #define Z3_DIR_WRITE(STATE)  L6474_DIR_WRITE(Z3, STATE)
155
-    #define Z3_DIR_READ          READ(Z3_DIR_PIN)
155
+    #define Z3_DIR_READ()        READ(Z3_DIR_PIN)
156 156
   #else
157
-    #define Z3_DIR_INIT          NOOP
157
+    #define Z3_DIR_INIT()        NOOP
158 158
     #define Z3_DIR_WRITE(STATE)  L64XX_DIR_WRITE(Z3, STATE)
159
-    #define Z3_DIR_READ          (stepper##Z3.getStatus() & STATUS_DIR);
159
+    #define Z3_DIR_READ()        (stepper##Z3.getStatus() & STATUS_DIR);
160 160
   #endif
161 161
 #endif
162 162
 
163 163
 // E0 Stepper
164 164
 #if AXIS_IS_L64XX(E0)
165 165
   extern L64XX_CLASS(E0)         stepperE0;
166
-  #define E0_ENABLE_INIT         NOOP
166
+  #define E0_ENABLE_INIT()       NOOP
167 167
   #define E0_ENABLE_WRITE(STATE)  (STATE ? NOOP : stepperE0.free())
168
-  #define E0_ENABLE_READ         (stepperE0.getStatus() & STATUS_HIZ)
168
+  #define E0_ENABLE_READ()       (stepperE0.getStatus() & STATUS_HIZ)
169 169
   #if AXIS_DRIVER_TYPE_E0(L6474)
170
-    #define E0_DIR_INIT          SET_OUTPUT(E0_DIR_PIN)
170
+    #define E0_DIR_INIT()        SET_OUTPUT(E0_DIR_PIN)
171 171
     #define E0_DIR_WRITE(STATE)  L6474_DIR_WRITE(E0, STATE)
172
-    #define E0_DIR_READ          READ(E0_DIR_PIN)
172
+    #define E0_DIR_READ()        READ(E0_DIR_PIN)
173 173
   #else
174
-    #define E0_DIR_INIT          NOOP
174
+    #define E0_DIR_INIT()        NOOP
175 175
     #define E0_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E0, STATE)
176
-    #define E0_DIR_READ          (stepper##E0.getStatus() & STATUS_DIR);
176
+    #define E0_DIR_READ()        (stepper##E0.getStatus() & STATUS_DIR);
177 177
   #endif
178 178
 #endif
179 179
 
180 180
 // E1 Stepper
181 181
 #if AXIS_IS_L64XX(E1)
182 182
   extern L64XX_CLASS(E1)         stepperE1;
183
-  #define E1_ENABLE_INIT         NOOP
183
+  #define E1_ENABLE_INIT()       NOOP
184 184
   #define E1_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE1.free())
185
-  #define E1_ENABLE_READ         (stepperE1.getStatus() & STATUS_HIZ)
185
+  #define E1_ENABLE_READ()       (stepperE1.getStatus() & STATUS_HIZ)
186 186
   #if AXIS_DRIVER_TYPE_E1(L6474)
187
-    #define E1_DIR_INIT          SET_OUTPUT(E1_DIR_PIN)
187
+    #define E1_DIR_INIT()        SET_OUTPUT(E1_DIR_PIN)
188 188
     #define E1_DIR_WRITE(STATE)  L6474_DIR_WRITE(E1, STATE)
189
-    #define E1_DIR_READ          READ(E1_DIR_PIN)
189
+    #define E1_DIR_READ()        READ(E1_DIR_PIN)
190 190
   #else
191
-    #define E1_DIR_INIT          NOOP
191
+    #define E1_DIR_INIT()        NOOP
192 192
     #define E1_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E1, STATE)
193
-    #define E1_DIR_READ          (stepper##E1.getStatus() & STATUS_DIR);
193
+    #define E1_DIR_READ()        (stepper##E1.getStatus() & STATUS_DIR);
194 194
   #endif
195 195
 #endif
196 196
 
197 197
 // E2 Stepper
198 198
 #if AXIS_IS_L64XX(E2)
199 199
   extern L64XX_CLASS(E2)         stepperE2;
200
-  #define E2_ENABLE_INIT         NOOP
200
+  #define E2_ENABLE_INIT()       NOOP
201 201
   #define E2_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE2.free())
202
-  #define E2_ENABLE_READ         (stepperE2.getStatus() & STATUS_HIZ)
202
+  #define E2_ENABLE_READ()       (stepperE2.getStatus() & STATUS_HIZ)
203 203
   #if AXIS_DRIVER_TYPE_E2(L6474)
204
-    #define E2_DIR_INIT          SET_OUTPUT(E2_DIR_PIN)
204
+    #define E2_DIR_INIT()        SET_OUTPUT(E2_DIR_PIN)
205 205
     #define E2_DIR_WRITE(STATE)  L6474_DIR_WRITE(E2, STATE)
206
-    #define E2_DIR_READ          READ(E2_DIR_PIN)
206
+    #define E2_DIR_READ()        READ(E2_DIR_PIN)
207 207
   #else
208
-    #define E2_DIR_INIT          NOOP
208
+    #define E2_DIR_INIT()        NOOP
209 209
     #define E2_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E2, STATE)
210
-    #define E2_DIR_READ          (stepper##E2.getStatus() & STATUS_DIR);
210
+    #define E2_DIR_READ()        (stepper##E2.getStatus() & STATUS_DIR);
211 211
   #endif
212 212
 #endif
213 213
 
214 214
 // E3 Stepper
215 215
 #if AXIS_IS_L64XX(E3)
216 216
   extern L64XX_CLASS(E3)         stepperE3;
217
-  #define E3_ENABLE_INIT         NOOP
217
+  #define E3_ENABLE_INIT()       NOOP
218 218
   #define E3_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE3.free())
219
-  #define E3_ENABLE_READ         (stepperE3.getStatus() & STATUS_HIZ)
219
+  #define E3_ENABLE_READ()       (stepperE3.getStatus() & STATUS_HIZ)
220 220
   #if AXIS_DRIVER_TYPE_E3(L6474)
221
-    #define E3_DIR_INIT          SET_OUTPUT(E3_DIR_PIN)
221
+    #define E3_DIR_INIT()        SET_OUTPUT(E3_DIR_PIN)
222 222
     #define E3_DIR_WRITE(STATE)  L6474_DIR_WRITE(E3, STATE)
223
-    #define E3_DIR_READ          READ(E3_DIR_PIN)
223
+    #define E3_DIR_READ()        READ(E3_DIR_PIN)
224 224
   #else
225
-    #define E3_DIR_INIT          NOOP
225
+    #define E3_DIR_INIT()        NOOP
226 226
     #define E3_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E3, STATE)
227
-    #define E3_DIR_READ          (stepper##E3.getStatus() & STATUS_DIR);
227
+    #define E3_DIR_READ()        (stepper##E3.getStatus() & STATUS_DIR);
228 228
   #endif
229 229
 #endif
230 230
 
231 231
 // E4 Stepper
232 232
 #if AXIS_IS_L64XX(E4)
233 233
   extern L64XX_CLASS(E4)         stepperE4;
234
-  #define E4_ENABLE_INIT         NOOP
234
+  #define E4_ENABLE_INIT()       NOOP
235 235
   #define E4_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE4.free())
236
-  #define E4_ENABLE_READ         (stepperE4.getStatus() & STATUS_HIZ)
236
+  #define E4_ENABLE_READ()       (stepperE4.getStatus() & STATUS_HIZ)
237 237
   #if AXIS_DRIVER_TYPE_E4(L6474)
238
-    #define E4_DIR_INIT          SET_OUTPUT(E4_DIR_PIN)
238
+    #define E4_DIR_INIT()        SET_OUTPUT(E4_DIR_PIN)
239 239
     #define E4_DIR_WRITE(STATE)  L6474_DIR_WRITE(E4, STATE)
240
-    #define E4_DIR_READ          READ(E4_DIR_PIN)
240
+    #define E4_DIR_READ()        READ(E4_DIR_PIN)
241 241
   #else
242
-    #define E4_DIR_INIT          NOOP
242
+    #define E4_DIR_INIT()        NOOP
243 243
     #define E4_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E4, STATE)
244
-    #define E4_DIR_READ          (stepper##E4.getStatus() & STATUS_DIR);
244
+    #define E4_DIR_READ()        (stepper##E4.getStatus() & STATUS_DIR);
245 245
   #endif
246 246
 #endif
247 247
 
248 248
 // E5 Stepper
249 249
 #if AXIS_IS_L64XX(E5)
250 250
   extern L64XX_CLASS(E5)         stepperE5;
251
-  #define E5_ENABLE_INIT         NOOP
251
+  #define E5_ENABLE_INIT()       NOOP
252 252
   #define E5_ENABLE_WRITE(STATE) (STATE ? NOOP : stepperE5.free())
253
-  #define E5_ENABLE_READ         (stepperE5.getStatus() & STATUS_HIZ)
253
+  #define E5_ENABLE_READ()       (stepperE5.getStatus() & STATUS_HIZ)
254 254
   #if AXIS_DRIVER_TYPE_E5(L6474)
255
-    #define E5_DIR_INIT          SET_OUTPUT(E5_DIR_PIN)
255
+    #define E5_DIR_INIT()        SET_OUTPUT(E5_DIR_PIN)
256 256
     #define E5_DIR_WRITE(STATE)  L6474_DIR_WRITE(E5, STATE)
257
-    #define E5_DIR_READ          READ(E5_DIR_PIN)
257
+    #define E5_DIR_READ()        READ(E5_DIR_PIN)
258 258
   #else
259
-    #define E5_DIR_INIT          NOOP
259
+    #define E5_DIR_INIT()        NOOP
260 260
     #define E5_DIR_WRITE(STATE)  L64XX_DIR_WRITE(E5, STATE)
261
-    #define E5_DIR_READ          (stepper##E5.getStatus() & STATUS_DIR);
261
+    #define E5_DIR_READ()        (stepper##E5.getStatus() & STATUS_DIR);
262 262
   #endif
263 263
 #endif

+ 14
- 14
Marlin/src/module/stepper/TMC26X.h View File

@@ -42,7 +42,7 @@ void tmc26x_init_to_defaults();
42 42
 // X Stepper
43 43
 #if AXIS_DRIVER_TYPE_X(TMC26X)
44 44
   extern TMC26XStepper stepperX;
45
-  #define X_ENABLE_INIT NOOP
45
+  #define X_ENABLE_INIT() NOOP
46 46
   #define X_ENABLE_WRITE(STATE) stepperX.setEnabled(STATE)
47 47
   #define X_ENABLE_READ() stepperX.isEnabled()
48 48
 #endif
@@ -50,7 +50,7 @@ void tmc26x_init_to_defaults();
50 50
 // Y Stepper
51 51
 #if AXIS_DRIVER_TYPE_Y(TMC26X)
52 52
   extern TMC26XStepper stepperY;
53
-  #define Y_ENABLE_INIT NOOP
53
+  #define Y_ENABLE_INIT() NOOP
54 54
   #define Y_ENABLE_WRITE(STATE) stepperY.setEnabled(STATE)
55 55
   #define Y_ENABLE_READ() stepperY.isEnabled()
56 56
 #endif
@@ -58,7 +58,7 @@ void tmc26x_init_to_defaults();
58 58
 // Z Stepper
59 59
 #if AXIS_DRIVER_TYPE_Z(TMC26X)
60 60
   extern TMC26XStepper stepperZ;
61
-  #define Z_ENABLE_INIT NOOP
61
+  #define Z_ENABLE_INIT() NOOP
62 62
   #define Z_ENABLE_WRITE(STATE) stepperZ.setEnabled(STATE)
63 63
   #define Z_ENABLE_READ() stepperZ.isEnabled()
64 64
 #endif
@@ -66,7 +66,7 @@ void tmc26x_init_to_defaults();
66 66
 // X2 Stepper
67 67
 #if HAS_X2_ENABLE && AXIS_DRIVER_TYPE_X2(TMC26X)
68 68
   extern TMC26XStepper stepperX2;
69
-  #define X2_ENABLE_INIT NOOP
69
+  #define X2_ENABLE_INIT() NOOP
70 70
   #define X2_ENABLE_WRITE(STATE) stepperX2.setEnabled(STATE)
71 71
   #define X2_ENABLE_READ() stepperX2.isEnabled()
72 72
 #endif
@@ -74,7 +74,7 @@ void tmc26x_init_to_defaults();
74 74
 // Y2 Stepper
75 75
 #if HAS_Y2_ENABLE && AXIS_DRIVER_TYPE_Y2(TMC26X)
76 76
   extern TMC26XStepper stepperY2;
77
-  #define Y2_ENABLE_INIT NOOP
77
+  #define Y2_ENABLE_INIT() NOOP
78 78
   #define Y2_ENABLE_WRITE(STATE) stepperY2.setEnabled(STATE)
79 79
   #define Y2_ENABLE_READ() stepperY2.isEnabled()
80 80
 #endif
@@ -82,15 +82,15 @@ void tmc26x_init_to_defaults();
82 82
 // Z2 Stepper
83 83
 #if HAS_Z2_ENABLE && AXIS_DRIVER_TYPE_Z2(TMC26X)
84 84
   extern TMC26XStepper stepperZ2;
85
-  #define Z2_ENABLE_INIT NOOP
85
+  #define Z2_ENABLE_INIT() NOOP
86 86
   #define Z2_ENABLE_WRITE(STATE) stepperZ2.setEnabled(STATE)
87 87
   #define Z2_ENABLE_READ() stepperZ2.isEnabled()
88 88
 #endif
89 89
 
90 90
 // Z3 Stepper
91
-#if HAS_Z3_ENABLE && ENABLED(Z3_IS_TMC26X)
91
+#if HAS_Z3_ENABLE && AXIS_DRIVER_TYPE_Z3(TMC26X)
92 92
   extern TMC26XStepper stepperZ3;
93
-  #define Z3_ENABLE_INIT NOOP
93
+  #define Z3_ENABLE_INIT() NOOP
94 94
   #define Z3_ENABLE_WRITE(STATE) stepperZ3.setEnabled(STATE)
95 95
   #define Z3_ENABLE_READ() stepperZ3.isEnabled()
96 96
 #endif
@@ -98,7 +98,7 @@ void tmc26x_init_to_defaults();
98 98
 // E0 Stepper
99 99
 #if AXIS_DRIVER_TYPE_E0(TMC26X)
100 100
   extern TMC26XStepper stepperE0;
101
-  #define E0_ENABLE_INIT NOOP
101
+  #define E0_ENABLE_INIT() NOOP
102 102
   #define E0_ENABLE_WRITE(STATE) stepperE0.setEnabled(STATE)
103 103
   #define E0_ENABLE_READ() stepperE0.isEnabled()
104 104
 #endif
@@ -106,7 +106,7 @@ void tmc26x_init_to_defaults();
106 106
 // E1 Stepper
107 107
 #if AXIS_DRIVER_TYPE_E1(TMC26X)
108 108
   extern TMC26XStepper stepperE1;
109
-  #define E1_ENABLE_INIT NOOP
109
+  #define E1_ENABLE_INIT() NOOP
110 110
   #define E1_ENABLE_WRITE(STATE) stepperE1.setEnabled(STATE)
111 111
   #define E1_ENABLE_READ() stepperE1.isEnabled()
112 112
 #endif
@@ -114,7 +114,7 @@ void tmc26x_init_to_defaults();
114 114
 // E2 Stepper
115 115
 #if AXIS_DRIVER_TYPE_E2(TMC26X)
116 116
   extern TMC26XStepper stepperE2;
117
-  #define E2_ENABLE_INIT NOOP
117
+  #define E2_ENABLE_INIT() NOOP
118 118
   #define E2_ENABLE_WRITE(STATE) stepperE2.setEnabled(STATE)
119 119
   #define E2_ENABLE_READ() stepperE2.isEnabled()
120 120
 #endif
@@ -122,7 +122,7 @@ void tmc26x_init_to_defaults();
122 122
 // E3 Stepper
123 123
 #if AXIS_DRIVER_TYPE_E3(TMC26X)
124 124
   extern TMC26XStepper stepperE3;
125
-  #define E3_ENABLE_INIT NOOP
125
+  #define E3_ENABLE_INIT() NOOP
126 126
   #define E3_ENABLE_WRITE(STATE) stepperE3.setEnabled(STATE)
127 127
   #define E3_ENABLE_READ() stepperE3.isEnabled()
128 128
 #endif
@@ -130,7 +130,7 @@ void tmc26x_init_to_defaults();
130 130
 // E4 Stepper
131 131
 #if AXIS_DRIVER_TYPE_E4(TMC26X)
132 132
   extern TMC26XStepper stepperE4;
133
-  #define E4_ENABLE_INIT NOOP
133
+  #define E4_ENABLE_INIT() NOOP
134 134
   #define E4_ENABLE_WRITE(STATE) stepperE4.setEnabled(STATE)
135 135
   #define E4_ENABLE_READ() stepperE4.isEnabled()
136 136
 #endif
@@ -138,7 +138,7 @@ void tmc26x_init_to_defaults();
138 138
 // E5 Stepper
139 139
 #if AXIS_DRIVER_TYPE_E5(TMC26X)
140 140
   extern TMC26XStepper stepperE5;
141
-  #define E5_ENABLE_INIT NOOP
141
+  #define E5_ENABLE_INIT() NOOP
142 142
   #define E5_ENABLE_WRITE(STATE) stepperE5.setEnabled(STATE)
143 143
   #define E5_ENABLE_READ() stepperE5.isEnabled()
144 144
 #endif

+ 27
- 27
Marlin/src/module/stepper/indirection.h View File

@@ -49,12 +49,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
49 49
 
50 50
 // X Stepper
51 51
 #ifndef X_ENABLE_INIT
52
-  #define X_ENABLE_INIT SET_OUTPUT(X_ENABLE_PIN)
52
+  #define X_ENABLE_INIT() SET_OUTPUT(X_ENABLE_PIN)
53 53
   #define X_ENABLE_WRITE(STATE) WRITE(X_ENABLE_PIN,STATE)
54 54
   #define X_ENABLE_READ() READ(X_ENABLE_PIN)
55 55
 #endif
56 56
 #ifndef X_DIR_INIT
57
-  #define X_DIR_INIT SET_OUTPUT(X_DIR_PIN)
57
+  #define X_DIR_INIT() SET_OUTPUT(X_DIR_PIN)
58 58
   #define X_DIR_WRITE(STATE) WRITE(X_DIR_PIN,STATE)
59 59
   #define X_DIR_READ() READ(X_DIR_PIN)
60 60
 #endif
@@ -66,12 +66,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
66 66
 
67 67
 // Y Stepper
68 68
 #ifndef Y_ENABLE_INIT
69
-  #define Y_ENABLE_INIT SET_OUTPUT(Y_ENABLE_PIN)
69
+  #define Y_ENABLE_INIT() SET_OUTPUT(Y_ENABLE_PIN)
70 70
   #define Y_ENABLE_WRITE(STATE) WRITE(Y_ENABLE_PIN,STATE)
71 71
   #define Y_ENABLE_READ() READ(Y_ENABLE_PIN)
72 72
 #endif
73 73
 #ifndef Y_DIR_INIT
74
-  #define Y_DIR_INIT SET_OUTPUT(Y_DIR_PIN)
74
+  #define Y_DIR_INIT() SET_OUTPUT(Y_DIR_PIN)
75 75
   #define Y_DIR_WRITE(STATE) WRITE(Y_DIR_PIN,STATE)
76 76
   #define Y_DIR_READ() READ(Y_DIR_PIN)
77 77
 #endif
@@ -83,12 +83,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
83 83
 
84 84
 // Z Stepper
85 85
 #ifndef Z_ENABLE_INIT
86
-  #define Z_ENABLE_INIT SET_OUTPUT(Z_ENABLE_PIN)
86
+  #define Z_ENABLE_INIT() SET_OUTPUT(Z_ENABLE_PIN)
87 87
   #define Z_ENABLE_WRITE(STATE) WRITE(Z_ENABLE_PIN,STATE)
88 88
   #define Z_ENABLE_READ() READ(Z_ENABLE_PIN)
89 89
 #endif
90 90
 #ifndef Z_DIR_INIT
91
-  #define Z_DIR_INIT SET_OUTPUT(Z_DIR_PIN)
91
+  #define Z_DIR_INIT() SET_OUTPUT(Z_DIR_PIN)
92 92
   #define Z_DIR_WRITE(STATE) WRITE(Z_DIR_PIN,STATE)
93 93
   #define Z_DIR_READ() READ(Z_DIR_PIN)
94 94
 #endif
@@ -101,12 +101,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
101 101
 // X2 Stepper
102 102
 #if HAS_X2_ENABLE
103 103
   #ifndef X2_ENABLE_INIT
104
-    #define X2_ENABLE_INIT SET_OUTPUT(X2_ENABLE_PIN)
104
+    #define X2_ENABLE_INIT() SET_OUTPUT(X2_ENABLE_PIN)
105 105
     #define X2_ENABLE_WRITE(STATE) WRITE(X2_ENABLE_PIN,STATE)
106 106
     #define X2_ENABLE_READ() READ(X2_ENABLE_PIN)
107 107
   #endif
108 108
   #ifndef X2_DIR_INIT
109
-    #define X2_DIR_INIT SET_OUTPUT(X2_DIR_PIN)
109
+    #define X2_DIR_INIT() SET_OUTPUT(X2_DIR_PIN)
110 110
     #define X2_DIR_WRITE(STATE) WRITE(X2_DIR_PIN,STATE)
111 111
     #define X2_DIR_READ() READ(X2_DIR_PIN)
112 112
   #endif
@@ -120,12 +120,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
120 120
 // Y2 Stepper
121 121
 #if HAS_Y2_ENABLE
122 122
   #ifndef Y2_ENABLE_INIT
123
-    #define Y2_ENABLE_INIT SET_OUTPUT(Y2_ENABLE_PIN)
123
+    #define Y2_ENABLE_INIT() SET_OUTPUT(Y2_ENABLE_PIN)
124 124
     #define Y2_ENABLE_WRITE(STATE) WRITE(Y2_ENABLE_PIN,STATE)
125 125
     #define Y2_ENABLE_READ() READ(Y2_ENABLE_PIN)
126 126
   #endif
127 127
   #ifndef Y2_DIR_INIT
128
-    #define Y2_DIR_INIT SET_OUTPUT(Y2_DIR_PIN)
128
+    #define Y2_DIR_INIT() SET_OUTPUT(Y2_DIR_PIN)
129 129
     #define Y2_DIR_WRITE(STATE) WRITE(Y2_DIR_PIN,STATE)
130 130
     #define Y2_DIR_READ() READ(Y2_DIR_PIN)
131 131
   #endif
@@ -141,12 +141,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
141 141
 // Z2 Stepper
142 142
 #if HAS_Z2_ENABLE
143 143
   #ifndef Z2_ENABLE_INIT
144
-    #define Z2_ENABLE_INIT SET_OUTPUT(Z2_ENABLE_PIN)
144
+    #define Z2_ENABLE_INIT() SET_OUTPUT(Z2_ENABLE_PIN)
145 145
     #define Z2_ENABLE_WRITE(STATE) WRITE(Z2_ENABLE_PIN,STATE)
146 146
     #define Z2_ENABLE_READ() READ(Z2_ENABLE_PIN)
147 147
   #endif
148 148
   #ifndef Z2_DIR_INIT
149
-    #define Z2_DIR_INIT SET_OUTPUT(Z2_DIR_PIN)
149
+    #define Z2_DIR_INIT() SET_OUTPUT(Z2_DIR_PIN)
150 150
     #define Z2_DIR_WRITE(STATE) WRITE(Z2_DIR_PIN,STATE)
151 151
     #define Z2_DIR_READ() READ(Z2_DIR_PIN)
152 152
   #endif
@@ -162,12 +162,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
162 162
 // Z3 Stepper
163 163
 #if HAS_Z3_ENABLE
164 164
   #ifndef Z3_ENABLE_INIT
165
-    #define Z3_ENABLE_INIT SET_OUTPUT(Z3_ENABLE_PIN)
165
+    #define Z3_ENABLE_INIT() SET_OUTPUT(Z3_ENABLE_PIN)
166 166
     #define Z3_ENABLE_WRITE(STATE) WRITE(Z3_ENABLE_PIN,STATE)
167 167
     #define Z3_ENABLE_READ() READ(Z3_ENABLE_PIN)
168 168
   #endif
169 169
   #ifndef Z3_DIR_INIT
170
-    #define Z3_DIR_INIT SET_OUTPUT(Z3_DIR_PIN)
170
+    #define Z3_DIR_INIT() SET_OUTPUT(Z3_DIR_PIN)
171 171
     #define Z3_DIR_WRITE(STATE) WRITE(Z3_DIR_PIN,STATE)
172 172
     #define Z3_DIR_READ() READ(Z3_DIR_PIN)
173 173
   #endif
@@ -182,12 +182,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
182 182
 
183 183
 // E0 Stepper
184 184
 #ifndef E0_ENABLE_INIT
185
-  #define E0_ENABLE_INIT SET_OUTPUT(E0_ENABLE_PIN)
185
+  #define E0_ENABLE_INIT() SET_OUTPUT(E0_ENABLE_PIN)
186 186
   #define E0_ENABLE_WRITE(STATE) WRITE(E0_ENABLE_PIN,STATE)
187 187
   #define E0_ENABLE_READ() READ(E0_ENABLE_PIN)
188 188
 #endif
189 189
 #ifndef E0_DIR_INIT
190
-  #define E0_DIR_INIT SET_OUTPUT(E0_DIR_PIN)
190
+  #define E0_DIR_INIT() SET_OUTPUT(E0_DIR_PIN)
191 191
   #define E0_DIR_WRITE(STATE) WRITE(E0_DIR_PIN,STATE)
192 192
   #define E0_DIR_READ() READ(E0_DIR_PIN)
193 193
 #endif
@@ -199,12 +199,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
199 199
 
200 200
 // E1 Stepper
201 201
 #ifndef E1_ENABLE_INIT
202
-  #define E1_ENABLE_INIT SET_OUTPUT(E1_ENABLE_PIN)
202
+  #define E1_ENABLE_INIT() SET_OUTPUT(E1_ENABLE_PIN)
203 203
   #define E1_ENABLE_WRITE(STATE) WRITE(E1_ENABLE_PIN,STATE)
204 204
   #define E1_ENABLE_READ() READ(E1_ENABLE_PIN)
205 205
 #endif
206 206
 #ifndef E1_DIR_INIT
207
-  #define E1_DIR_INIT SET_OUTPUT(E1_DIR_PIN)
207
+  #define E1_DIR_INIT() SET_OUTPUT(E1_DIR_PIN)
208 208
   #define E1_DIR_WRITE(STATE) WRITE(E1_DIR_PIN,STATE)
209 209
   #define E1_DIR_READ() READ(E1_DIR_PIN)
210 210
 #endif
@@ -216,12 +216,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
216 216
 
217 217
 // E2 Stepper
218 218
 #ifndef E2_ENABLE_INIT
219
-  #define E2_ENABLE_INIT SET_OUTPUT(E2_ENABLE_PIN)
219
+  #define E2_ENABLE_INIT() SET_OUTPUT(E2_ENABLE_PIN)
220 220
   #define E2_ENABLE_WRITE(STATE) WRITE(E2_ENABLE_PIN,STATE)
221 221
   #define E2_ENABLE_READ() READ(E2_ENABLE_PIN)
222 222
 #endif
223 223
 #ifndef E2_DIR_INIT
224
-  #define E2_DIR_INIT SET_OUTPUT(E2_DIR_PIN)
224
+  #define E2_DIR_INIT() SET_OUTPUT(E2_DIR_PIN)
225 225
   #define E2_DIR_WRITE(STATE) WRITE(E2_DIR_PIN,STATE)
226 226
   #define E2_DIR_READ() READ(E2_DIR_PIN)
227 227
 #endif
@@ -233,12 +233,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
233 233
 
234 234
 // E3 Stepper
235 235
 #ifndef E3_ENABLE_INIT
236
-  #define E3_ENABLE_INIT SET_OUTPUT(E3_ENABLE_PIN)
236
+  #define E3_ENABLE_INIT() SET_OUTPUT(E3_ENABLE_PIN)
237 237
   #define E3_ENABLE_WRITE(STATE) WRITE(E3_ENABLE_PIN,STATE)
238 238
   #define E3_ENABLE_READ() READ(E3_ENABLE_PIN)
239 239
 #endif
240 240
 #ifndef E3_DIR_INIT
241
-  #define E3_DIR_INIT SET_OUTPUT(E3_DIR_PIN)
241
+  #define E3_DIR_INIT() SET_OUTPUT(E3_DIR_PIN)
242 242
   #define E3_DIR_WRITE(STATE) WRITE(E3_DIR_PIN,STATE)
243 243
   #define E3_DIR_READ() READ(E3_DIR_PIN)
244 244
 #endif
@@ -250,12 +250,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
250 250
 
251 251
 // E4 Stepper
252 252
 #ifndef E4_ENABLE_INIT
253
-  #define E4_ENABLE_INIT SET_OUTPUT(E4_ENABLE_PIN)
253
+  #define E4_ENABLE_INIT() SET_OUTPUT(E4_ENABLE_PIN)
254 254
   #define E4_ENABLE_WRITE(STATE) WRITE(E4_ENABLE_PIN,STATE)
255 255
   #define E4_ENABLE_READ() READ(E4_ENABLE_PIN)
256 256
 #endif
257 257
 #ifndef E4_DIR_INIT
258
-  #define E4_DIR_INIT SET_OUTPUT(E4_DIR_PIN)
258
+  #define E4_DIR_INIT() SET_OUTPUT(E4_DIR_PIN)
259 259
   #define E4_DIR_WRITE(STATE) WRITE(E4_DIR_PIN,STATE)
260 260
   #define E4_DIR_READ() READ(E4_DIR_PIN)
261 261
 #endif
@@ -267,12 +267,12 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
267 267
 
268 268
 // E5 Stepper
269 269
 #ifndef E5_ENABLE_INIT
270
-  #define E5_ENABLE_INIT SET_OUTPUT(E5_ENABLE_PIN)
270
+  #define E5_ENABLE_INIT() SET_OUTPUT(E5_ENABLE_PIN)
271 271
   #define E5_ENABLE_WRITE(STATE) WRITE(E5_ENABLE_PIN,STATE)
272 272
   #define E5_ENABLE_READ() READ(E5_ENABLE_PIN)
273 273
 #endif
274 274
 #ifndef E5_DIR_INIT
275
-  #define E5_DIR_INIT SET_OUTPUT(E5_DIR_PIN)
275
+  #define E5_DIR_INIT() SET_OUTPUT(E5_DIR_PIN)
276 276
   #define E5_DIR_WRITE(STATE) WRITE(E5_DIR_PIN,STATE)
277 277
   #define E5_DIR_READ() READ(E5_DIR_PIN)
278 278
 #endif
@@ -491,7 +491,7 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
491 491
   #define Z3_disable() NOOP
492 492
 #endif
493 493
 
494
-#define  enable_Z() do{ Z_enable(); Z2_enable(); Z3_enable(); }while(0)
494
+#define  enable_Z() do{ Z_enable();  Z2_enable();  Z3_enable();  }while(0)
495 495
 #define disable_Z() do{ Z_disable(); Z2_disable(); Z3_disable(); CBI(axis_known_position, Z_AXIS); }while(0)
496 496
 
497 497
 //

+ 13
- 13
Marlin/src/module/stepper/trinamic.h View File

@@ -88,7 +88,7 @@ void reset_trinamic_drivers();
88 88
 #if AXIS_IS_TMC(X)
89 89
   extern TMC_CLASS(X, X) stepperX;
90 90
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
91
-    #define X_ENABLE_INIT NOOP
91
+    #define X_ENABLE_INIT() NOOP
92 92
     #define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
93 93
     #define X_ENABLE_READ() stepperX.isEnabled()
94 94
   #endif
@@ -101,7 +101,7 @@ void reset_trinamic_drivers();
101 101
 #if AXIS_IS_TMC(Y)
102 102
   extern TMC_CLASS(Y, Y) stepperY;
103 103
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
104
-    #define Y_ENABLE_INIT NOOP
104
+    #define Y_ENABLE_INIT() NOOP
105 105
     #define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
106 106
     #define Y_ENABLE_READ() stepperY.isEnabled()
107 107
   #endif
@@ -114,7 +114,7 @@ void reset_trinamic_drivers();
114 114
 #if AXIS_IS_TMC(Z)
115 115
   extern TMC_CLASS(Z, Z) stepperZ;
116 116
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
117
-    #define Z_ENABLE_INIT NOOP
117
+    #define Z_ENABLE_INIT() NOOP
118 118
     #define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
119 119
     #define Z_ENABLE_READ() stepperZ.isEnabled()
120 120
   #endif
@@ -127,7 +127,7 @@ void reset_trinamic_drivers();
127 127
 #if HAS_X2_ENABLE && AXIS_IS_TMC(X2)
128 128
   extern TMC_CLASS(X2, X) stepperX2;
129 129
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
130
-    #define X2_ENABLE_INIT NOOP
130
+    #define X2_ENABLE_INIT() NOOP
131 131
     #define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing.toff : 0)
132 132
     #define X2_ENABLE_READ() stepperX2.isEnabled()
133 133
   #endif
@@ -140,7 +140,7 @@ void reset_trinamic_drivers();
140 140
 #if HAS_Y2_ENABLE && AXIS_IS_TMC(Y2)
141 141
   extern TMC_CLASS(Y2, Y) stepperY2;
142 142
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
143
-    #define Y2_ENABLE_INIT NOOP
143
+    #define Y2_ENABLE_INIT() NOOP
144 144
     #define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing.toff : 0)
145 145
     #define Y2_ENABLE_READ() stepperY2.isEnabled()
146 146
   #endif
@@ -153,7 +153,7 @@ void reset_trinamic_drivers();
153 153
 #if HAS_Z2_ENABLE && AXIS_IS_TMC(Z2)
154 154
   extern TMC_CLASS(Z2, Z) stepperZ2;
155 155
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(Z2)
156
-    #define Z2_ENABLE_INIT NOOP
156
+    #define Z2_ENABLE_INIT() NOOP
157 157
     #define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
158 158
     #define Z2_ENABLE_READ() stepperZ2.isEnabled()
159 159
   #endif
@@ -166,7 +166,7 @@ void reset_trinamic_drivers();
166 166
 #if HAS_Z3_ENABLE && AXIS_IS_TMC(Z3)
167 167
   extern TMC_CLASS(Z3, Z) stepperZ3;
168 168
   #if ENABLED(SOFTWARE_DRIVER_ENABLE)
169
-    #define Z3_ENABLE_INIT NOOP
169
+    #define Z3_ENABLE_INIT() NOOP
170 170
     #define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing.toff : 0)
171 171
     #define Z3_ENABLE_READ() stepperZ3.isEnabled()
172 172
   #endif
@@ -179,7 +179,7 @@ void reset_trinamic_drivers();
179 179
 #if AXIS_IS_TMC(E0)
180 180
   extern TMC_CLASS_E(0) stepperE0;
181 181
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E0)
182
-    #define E0_ENABLE_INIT NOOP
182
+    #define E0_ENABLE_INIT() NOOP
183 183
     #define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
184 184
     #define E0_ENABLE_READ() stepperE0.isEnabled()
185 185
   #endif
@@ -192,7 +192,7 @@ void reset_trinamic_drivers();
192 192
 #if AXIS_IS_TMC(E1)
193 193
   extern TMC_CLASS_E(1) stepperE1;
194 194
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E1)
195
-    #define E1_ENABLE_INIT NOOP
195
+    #define E1_ENABLE_INIT() NOOP
196 196
     #define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
197 197
     #define E1_ENABLE_READ() stepperE1.isEnabled()
198 198
   #endif
@@ -205,7 +205,7 @@ void reset_trinamic_drivers();
205 205
 #if AXIS_IS_TMC(E2)
206 206
   extern TMC_CLASS_E(2) stepperE2;
207 207
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E2)
208
-    #define E2_ENABLE_INIT NOOP
208
+    #define E2_ENABLE_INIT() NOOP
209 209
     #define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
210 210
     #define E2_ENABLE_READ() stepperE2.isEnabled()
211 211
   #endif
@@ -218,7 +218,7 @@ void reset_trinamic_drivers();
218 218
 #if AXIS_IS_TMC(E3)
219 219
   extern TMC_CLASS_E(3) stepperE3;
220 220
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E3)
221
-    #define E3_ENABLE_INIT NOOP
221
+    #define E3_ENABLE_INIT() NOOP
222 222
     #define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
223 223
     #define E3_ENABLE_READ() stepperE3.isEnabled()
224 224
   #endif
@@ -231,7 +231,7 @@ void reset_trinamic_drivers();
231 231
 #if AXIS_IS_TMC(E4)
232 232
   extern TMC_CLASS_E(4) stepperE4;
233 233
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E4)
234
-    #define E4_ENABLE_INIT NOOP
234
+    #define E4_ENABLE_INIT() NOOP
235 235
     #define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
236 236
     #define E4_ENABLE_READ() stepperE4.isEnabled()
237 237
   #endif
@@ -244,7 +244,7 @@ void reset_trinamic_drivers();
244 244
 #if AXIS_IS_TMC(E5)
245 245
   extern TMC_CLASS_E(5) stepperE5;
246 246
   #if ENABLED(SOFTWARE_DRIVER_ENABLE) && AXIS_IS_TMC(E5)
247
-    #define E5_ENABLE_INIT NOOP
247
+    #define E5_ENABLE_INIT() NOOP
248 248
     #define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing.toff : 0)
249 249
     #define E5_ENABLE_READ() stepperE5.isEnabled()
250 250
   #endif

Loading…
Cancel
Save