Kaynağa Gözat

🔧 Base NUM_AXES on defined DRIVER_TYPEs (#24106)

Scott Lahteine 2 yıl önce
ebeveyn
işleme
b37d13af72

+ 42
- 58
Marlin/Configuration.h Dosyayı Görüntüle

@@ -150,20 +150,45 @@
150 150
 //#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
151 151
 
152 152
 /**
153
- * Define the number of coordinated axes.
154
- * See https://github.com/DerAndere1/Marlin/wiki
155
- * Each axis gets its own stepper control and endstop:
153
+ * Stepper Drivers
154
+ *
155
+ * These settings allow Marlin to tune stepper driver timing and enable advanced options for
156
+ * stepper drivers that support them. You may also override timing options in Configuration_adv.h.
157
+ *
158
+ * A4988 is assumed for unspecified drivers.
156 159
  *
157
- *   Steppers: *_STEP_PIN, *_ENABLE_PIN, *_DIR_PIN, *_ENABLE_ON
158
- *   Endstops: *_STOP_PIN, USE_*MIN_PLUG, USE_*MAX_PLUG
159
- *       Axes: *_MIN_POS, *_MAX_POS, INVERT_*_DIR
160
- *    Planner: DEFAULT_AXIS_STEPS_PER_UNIT, DEFAULT_MAX_FEEDRATE
161
- *             DEFAULT_MAX_ACCELERATION, AXIS_RELATIVE_MODES,
162
- *             MICROSTEP_MODES, MANUAL_FEEDRATE
160
+ * Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
163 161
  *
164
- * :[3, 4, 5, 6, 7, 8, 9]
162
+ * Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
163
+ *          TB6560, TB6600, TMC2100,
164
+ *          TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
165
+ *          TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
166
+ *          TMC26X,  TMC26X_STANDALONE,  TMC2660, TMC2660_STANDALONE,
167
+ *          TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
168
+ * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
165 169
  */
166
-//#define NUM_AXES 3
170
+#define X_DRIVER_TYPE  A4988
171
+#define Y_DRIVER_TYPE  A4988
172
+#define Z_DRIVER_TYPE  A4988
173
+//#define X2_DRIVER_TYPE A4988
174
+//#define Y2_DRIVER_TYPE A4988
175
+//#define Z2_DRIVER_TYPE A4988
176
+//#define Z3_DRIVER_TYPE A4988
177
+//#define Z4_DRIVER_TYPE A4988
178
+//#define I_DRIVER_TYPE  A4988
179
+//#define J_DRIVER_TYPE  A4988
180
+//#define K_DRIVER_TYPE  A4988
181
+//#define U_DRIVER_TYPE  A4988
182
+//#define V_DRIVER_TYPE  A4988
183
+//#define W_DRIVER_TYPE  A4988
184
+#define E0_DRIVER_TYPE A4988
185
+//#define E1_DRIVER_TYPE A4988
186
+//#define E2_DRIVER_TYPE A4988
187
+//#define E3_DRIVER_TYPE A4988
188
+//#define E4_DRIVER_TYPE A4988
189
+//#define E5_DRIVER_TYPE A4988
190
+//#define E6_DRIVER_TYPE A4988
191
+//#define E7_DRIVER_TYPE A4988
167 192
 
168 193
 /**
169 194
  * Additional Axis Settings
@@ -182,27 +207,27 @@
182 207
  *
183 208
  * Regardless of these settings the axes are internally named I, J, K, U, V, W.
184 209
  */
185
-#if NUM_AXES >= 4
210
+#ifdef I_DRIVER_TYPE
186 211
   #define AXIS4_NAME 'A' // :['A', 'B', 'C', 'U', 'V', 'W']
187 212
   #define AXIS4_ROTATES
188 213
 #endif
189
-#if NUM_AXES >= 5
214
+#ifdef J_DRIVER_TYPE
190 215
   #define AXIS5_NAME 'B' // :['B', 'C', 'U', 'V', 'W']
191 216
   #define AXIS5_ROTATES
192 217
 #endif
193
-#if NUM_AXES >= 6
218
+#ifdef K_DRIVER_TYPE
194 219
   #define AXIS6_NAME 'C' // :['C', 'U', 'V', 'W']
195 220
   #define AXIS6_ROTATES
196 221
 #endif
197
-#if NUM_AXES >= 7
222
+#ifdef U_DRIVER_TYPE
198 223
   #define AXIS7_NAME 'U' // :['U', 'V', 'W']
199 224
   //#define AXIS7_ROTATES
200 225
 #endif
201
-#if NUM_AXES >= 8
226
+#ifdef V_DRIVER_TYPE
202 227
   #define AXIS8_NAME 'V' // :['V', 'W']
203 228
   //#define AXIS8_ROTATES
204 229
 #endif
205
-#if NUM_AXES >= 9
230
+#ifdef W_DRIVER_TYPE
206 231
   #define AXIS9_NAME 'W' // :['W']
207 232
   //#define AXIS9_ROTATES
208 233
 #endif
@@ -941,47 +966,6 @@
941 966
 #define W_MAX_ENDSTOP_INVERTING false // Set to true to invert the logic of the endstop.
942 967
 #define Z_MIN_PROBE_ENDSTOP_INVERTING false // Set to true to invert the logic of the probe.
943 968
 
944
-/**
945
- * Stepper Drivers
946
- *
947
- * These settings allow Marlin to tune stepper driver timing and enable advanced options for
948
- * stepper drivers that support them. You may also override timing options in Configuration_adv.h.
949
- *
950
- * A4988 is assumed for unspecified drivers.
951
- *
952
- * Use TMC2208/TMC2208_STANDALONE for TMC2225 drivers and TMC2209/TMC2209_STANDALONE for TMC2226 drivers.
953
- *
954
- * Options: A4988, A5984, DRV8825, LV8729, L6470, L6474, POWERSTEP01,
955
- *          TB6560, TB6600, TMC2100,
956
- *          TMC2130, TMC2130_STANDALONE, TMC2160, TMC2160_STANDALONE,
957
- *          TMC2208, TMC2208_STANDALONE, TMC2209, TMC2209_STANDALONE,
958
- *          TMC26X,  TMC26X_STANDALONE,  TMC2660, TMC2660_STANDALONE,
959
- *          TMC5130, TMC5130_STANDALONE, TMC5160, TMC5160_STANDALONE
960
- * :['A4988', 'A5984', 'DRV8825', 'LV8729', 'L6470', 'L6474', 'POWERSTEP01', 'TB6560', 'TB6600', 'TMC2100', 'TMC2130', 'TMC2130_STANDALONE', 'TMC2160', 'TMC2160_STANDALONE', 'TMC2208', 'TMC2208_STANDALONE', 'TMC2209', 'TMC2209_STANDALONE', 'TMC26X', 'TMC26X_STANDALONE', 'TMC2660', 'TMC2660_STANDALONE', 'TMC5130', 'TMC5130_STANDALONE', 'TMC5160', 'TMC5160_STANDALONE']
961
- */
962
-#define X_DRIVER_TYPE  A4988
963
-#define Y_DRIVER_TYPE  A4988
964
-#define Z_DRIVER_TYPE  A4988
965
-//#define X2_DRIVER_TYPE A4988
966
-//#define Y2_DRIVER_TYPE A4988
967
-//#define Z2_DRIVER_TYPE A4988
968
-//#define Z3_DRIVER_TYPE A4988
969
-//#define Z4_DRIVER_TYPE A4988
970
-//#define I_DRIVER_TYPE  A4988
971
-//#define J_DRIVER_TYPE  A4988
972
-//#define K_DRIVER_TYPE  A4988
973
-//#define U_DRIVER_TYPE  A4988
974
-//#define V_DRIVER_TYPE  A4988
975
-//#define W_DRIVER_TYPE  A4988
976
-#define E0_DRIVER_TYPE A4988
977
-//#define E1_DRIVER_TYPE A4988
978
-//#define E2_DRIVER_TYPE A4988
979
-//#define E3_DRIVER_TYPE A4988
980
-//#define E4_DRIVER_TYPE A4988
981
-//#define E5_DRIVER_TYPE A4988
982
-//#define E6_DRIVER_TYPE A4988
983
-//#define E7_DRIVER_TYPE A4988
984
-
985 969
 // Enable this feature if all enabled endstop pins are interrupt-capable.
986 970
 // This will remove the need to poll the interrupt pins, saving many CPU cycles.
987 971
 //#define ENDSTOP_INTERRUPTS_FEATURE

+ 164
- 100
Marlin/src/inc/Conditionals_LCD.h Dosyayı Görüntüle

@@ -679,8 +679,29 @@
679 679
  * Number of Linear Axes (e.g., XYZIJKUVW)
680 680
  * All the logical axes except for the tool (E) axis
681 681
  */
682
-#ifndef NUM_AXES
683
-  #define NUM_AXES XYZ
682
+#ifdef NUM_AXES
683
+  #undef NUM_AXES
684
+  #define NUM_AXES_WARNING 1
685
+#endif
686
+
687
+#ifdef W_DRIVER_TYPE
688
+  #define NUM_AXES 9
689
+#elif defined(V_DRIVER_TYPE)
690
+  #define NUM_AXES 8
691
+#elif defined(U_DRIVER_TYPE)
692
+  #define NUM_AXES 7
693
+#elif defined(K_DRIVER_TYPE)
694
+  #define NUM_AXES 6
695
+#elif defined(J_DRIVER_TYPE)
696
+  #define NUM_AXES 5
697
+#elif defined(I_DRIVER_TYPE)
698
+  #define NUM_AXES 4
699
+#elif defined(Z_DRIVER_TYPE)
700
+  #define NUM_AXES 3
701
+#elif defined(Y_DRIVER_TYPE)
702
+  #define NUM_AXES 2
703
+#else
704
+  #define NUM_AXES 1
684 705
 #endif
685 706
 #if NUM_AXES >= XY
686 707
   #define HAS_Y_AXIS 1
@@ -707,6 +728,147 @@
707 728
   #endif
708 729
 #endif
709 730
 
731
+#if E_STEPPERS <= 0
732
+  #undef E0_DRIVER_TYPE
733
+#endif
734
+#if E_STEPPERS <= 1
735
+  #undef E1_DRIVER_TYPE
736
+#endif
737
+#if E_STEPPERS <= 2
738
+  #undef E2_DRIVER_TYPE
739
+#endif
740
+#if E_STEPPERS <= 3
741
+  #undef E3_DRIVER_TYPE
742
+#endif
743
+#if E_STEPPERS <= 4
744
+  #undef E4_DRIVER_TYPE
745
+#endif
746
+#if E_STEPPERS <= 5
747
+  #undef E5_DRIVER_TYPE
748
+#endif
749
+#if E_STEPPERS <= 6
750
+  #undef E6_DRIVER_TYPE
751
+#endif
752
+#if E_STEPPERS <= 7
753
+  #undef E7_DRIVER_TYPE
754
+#endif
755
+
756
+#if !HAS_Y_AXIS
757
+  #undef ENDSTOPPULLUP_YMIN
758
+  #undef ENDSTOPPULLUP_YMAX
759
+  #undef Y_MIN_ENDSTOP_INVERTING
760
+  #undef Y_MAX_ENDSTOP_INVERTING
761
+  #undef Y2_DRIVER_TYPE
762
+  #undef Y_ENABLE_ON
763
+  #undef DISABLE_Y
764
+  #undef INVERT_Y_DIR
765
+  #undef Y_HOME_DIR
766
+  #undef Y_MIN_POS
767
+  #undef Y_MAX_POS
768
+  #undef MANUAL_Y_HOME_POS
769
+#endif
770
+
771
+#if !HAS_Z_AXIS
772
+  #undef ENDSTOPPULLUP_ZMIN
773
+  #undef ENDSTOPPULLUP_ZMAX
774
+  #undef Z_MIN_ENDSTOP_INVERTING
775
+  #undef Z_MAX_ENDSTOP_INVERTING
776
+  #undef Z2_DRIVER_TYPE
777
+  #undef Z3_DRIVER_TYPE
778
+  #undef Z4_DRIVER_TYPE
779
+  #undef Z_ENABLE_ON
780
+  #undef DISABLE_Z
781
+  #undef INVERT_Z_DIR
782
+  #undef Z_HOME_DIR
783
+  #undef Z_MIN_POS
784
+  #undef Z_MAX_POS
785
+  #undef MANUAL_Z_HOME_POS
786
+#endif
787
+
788
+#if !HAS_I_AXIS
789
+  #undef ENDSTOPPULLUP_IMIN
790
+  #undef ENDSTOPPULLUP_IMAX
791
+  #undef I_MIN_ENDSTOP_INVERTING
792
+  #undef I_MAX_ENDSTOP_INVERTING
793
+  #undef I_ENABLE_ON
794
+  #undef DISABLE_I
795
+  #undef INVERT_I_DIR
796
+  #undef I_HOME_DIR
797
+  #undef I_MIN_POS
798
+  #undef I_MAX_POS
799
+  #undef MANUAL_I_HOME_POS
800
+#endif
801
+
802
+#if !HAS_J_AXIS
803
+  #undef ENDSTOPPULLUP_JMIN
804
+  #undef ENDSTOPPULLUP_JMAX
805
+  #undef J_MIN_ENDSTOP_INVERTING
806
+  #undef J_MAX_ENDSTOP_INVERTING
807
+  #undef J_ENABLE_ON
808
+  #undef DISABLE_J
809
+  #undef INVERT_J_DIR
810
+  #undef J_HOME_DIR
811
+  #undef J_MIN_POS
812
+  #undef J_MAX_POS
813
+  #undef MANUAL_J_HOME_POS
814
+#endif
815
+
816
+#if !HAS_K_AXIS
817
+  #undef ENDSTOPPULLUP_KMIN
818
+  #undef ENDSTOPPULLUP_KMAX
819
+  #undef K_MIN_ENDSTOP_INVERTING
820
+  #undef K_MAX_ENDSTOP_INVERTING
821
+  #undef K_ENABLE_ON
822
+  #undef DISABLE_K
823
+  #undef INVERT_K_DIR
824
+  #undef K_HOME_DIR
825
+  #undef K_MIN_POS
826
+  #undef K_MAX_POS
827
+  #undef MANUAL_K_HOME_POS
828
+#endif
829
+
830
+#if !HAS_U_AXIS
831
+  #undef ENDSTOPPULLUP_UMIN
832
+  #undef ENDSTOPPULLUP_UMAX
833
+  #undef U_MIN_ENDSTOP_INVERTING
834
+  #undef U_MAX_ENDSTOP_INVERTING
835
+  #undef U_ENABLE_ON
836
+  #undef DISABLE_U
837
+  #undef INVERT_U_DIR
838
+  #undef U_HOME_DIR
839
+  #undef U_MIN_POS
840
+  #undef U_MAX_POS
841
+  #undef MANUAL_U_HOME_POS
842
+#endif
843
+
844
+#if !HAS_V_AXIS
845
+  #undef ENDSTOPPULLUP_VMIN
846
+  #undef ENDSTOPPULLUP_VMAX
847
+  #undef V_MIN_ENDSTOP_INVERTING
848
+  #undef V_MAX_ENDSTOP_INVERTING
849
+  #undef V_ENABLE_ON
850
+  #undef DISABLE_V
851
+  #undef INVERT_V_DIR
852
+  #undef V_HOME_DIR
853
+  #undef V_MIN_POS
854
+  #undef V_MAX_POS
855
+  #undef MANUAL_V_HOME_POS
856
+#endif
857
+
858
+#if !HAS_W_AXIS
859
+  #undef ENDSTOPPULLUP_WMIN
860
+  #undef ENDSTOPPULLUP_WMAX
861
+  #undef W_MIN_ENDSTOP_INVERTING
862
+  #undef W_MAX_ENDSTOP_INVERTING
863
+  #undef W_ENABLE_ON
864
+  #undef DISABLE_W
865
+  #undef INVERT_W_DIR
866
+  #undef W_HOME_DIR
867
+  #undef W_MIN_POS
868
+  #undef W_MAX_POS
869
+  #undef MANUAL_W_HOME_POS
870
+#endif
871
+
710 872
 /**
711 873
  * Number of Primary Linear Axes (e.g., XYZ)
712 874
  * X, XY, or XYZ axes. Excluding duplicate axes (X2, Y2. Z2. Z3, Z4)
@@ -1214,104 +1376,6 @@
1214 1376
   #define HAS_ETHERNET 1
1215 1377
 #endif
1216 1378
 
1217
-// Fallback Stepper Driver types that don't depend on Configuration_adv.h
1218
-#ifndef X_DRIVER_TYPE
1219
-  #define X_DRIVER_TYPE  A4988
1220
-#endif
1221
-#ifndef X2_DRIVER_TYPE
1222
-  #define X2_DRIVER_TYPE A4988
1223
-#endif
1224
-#ifndef Y_DRIVER_TYPE
1225
-  #define Y_DRIVER_TYPE  A4988
1226
-#endif
1227
-#ifndef Y2_DRIVER_TYPE
1228
-  #define Y2_DRIVER_TYPE A4988
1229
-#endif
1230
-#ifndef Z_DRIVER_TYPE
1231
-  #define Z_DRIVER_TYPE  A4988
1232
-#endif
1233
-#ifndef Z2_DRIVER_TYPE
1234
-  #define Z2_DRIVER_TYPE A4988
1235
-#endif
1236
-#ifndef Z3_DRIVER_TYPE
1237
-  #define Z3_DRIVER_TYPE A4988
1238
-#endif
1239
-#ifndef Z4_DRIVER_TYPE
1240
-  #define Z4_DRIVER_TYPE A4988
1241
-#endif
1242
-#if E_STEPPERS <= 0
1243
-  #undef E0_DRIVER_TYPE
1244
-#elif !defined(E0_DRIVER_TYPE)
1245
-  #define E0_DRIVER_TYPE A4988
1246
-#endif
1247
-#if E_STEPPERS <= 1
1248
-  #undef E1_DRIVER_TYPE
1249
-#elif !defined(E1_DRIVER_TYPE)
1250
-  #define E1_DRIVER_TYPE A4988
1251
-#endif
1252
-#if E_STEPPERS <= 2
1253
-  #undef E2_DRIVER_TYPE
1254
-#elif !defined(E2_DRIVER_TYPE)
1255
-  #define E2_DRIVER_TYPE A4988
1256
-#endif
1257
-#if E_STEPPERS <= 3
1258
-  #undef E3_DRIVER_TYPE
1259
-#elif !defined(E3_DRIVER_TYPE)
1260
-  #define E3_DRIVER_TYPE A4988
1261
-#endif
1262
-#if E_STEPPERS <= 4
1263
-  #undef E4_DRIVER_TYPE
1264
-#elif !defined(E4_DRIVER_TYPE)
1265
-  #define E4_DRIVER_TYPE A4988
1266
-#endif
1267
-#if E_STEPPERS <= 5
1268
-  #undef E5_DRIVER_TYPE
1269
-#elif !defined(E5_DRIVER_TYPE)
1270
-  #define E5_DRIVER_TYPE A4988
1271
-#endif
1272
-#if E_STEPPERS <= 6
1273
-  #undef E6_DRIVER_TYPE
1274
-#elif !defined(E6_DRIVER_TYPE)
1275
-  #define E6_DRIVER_TYPE A4988
1276
-#endif
1277
-#if E_STEPPERS <= 7
1278
-  #undef E7_DRIVER_TYPE
1279
-#elif !defined(E7_DRIVER_TYPE)
1280
-  #define E7_DRIVER_TYPE A4988
1281
-#endif
1282
-
1283
-// Fallback axis inverting
1284
-#ifndef INVERT_X_DIR
1285
-  #define INVERT_X_DIR false
1286
-#endif
1287
-#if HAS_Y_AXIS && !defined(INVERT_Y_DIR)
1288
-  #define INVERT_Y_DIR false
1289
-#endif
1290
-#if HAS_Z_AXIS && !defined(INVERT_Z_DIR)
1291
-  #define INVERT_Z_DIR false
1292
-#endif
1293
-#if HAS_I_AXIS && !defined(INVERT_I_DIR)
1294
-  #define INVERT_I_DIR false
1295
-#endif
1296
-#if HAS_J_AXIS && !defined(INVERT_J_DIR)
1297
-  #define INVERT_J_DIR false
1298
-#endif
1299
-#if HAS_K_AXIS && !defined(INVERT_K_DIR)
1300
-  #define INVERT_K_DIR false
1301
-#endif
1302
-#if HAS_U_AXIS && !defined(INVERT_U_DIR)
1303
-  #define INVERT_U_DIR false
1304
-#endif
1305
-#if HAS_V_AXIS && !defined(INVERT_V_DIR)
1306
-  #define INVERT_V_DIR false
1307
-#endif
1308
-#if HAS_W_AXIS && !defined(INVERT_W_DIR)
1309
-  #define INVERT_W_DIR false
1310
-#endif
1311
-#if HAS_EXTRUDERS && !defined(INVERT_E_DIR)
1312
-  #define INVERT_E_DIR false
1313
-#endif
1314
-
1315 1379
 /**
1316 1380
  * This setting is also used by M109 when trying to calculate
1317 1381
  * a ballpark safe margin to prevent wait-forever situation.

+ 4
- 0
Marlin/src/inc/Warnings.cpp Dosyayı Görüntüle

@@ -35,6 +35,10 @@
35 35
   #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
36 36
 #endif
37 37
 
38
+#if NUM_AXES_WARNING
39
+  #warning "Note: NUM_AXES is now based on the *_DRIVER_TYPE settings so you can remove NUM_AXES from Configuration.h."
40
+#endif
41
+
38 42
 // Safety Features
39 43
 #if DISABLED(USE_WATCHDOG)
40 44
   #warning "Safety Alert! Enable USE_WATCHDOG for the final build!"

+ 7
- 7
Marlin/src/libs/L64XX/L64XX_Marlin.cpp Dosyayı Görüntüle

@@ -66,14 +66,14 @@ void echo_yes_no(const bool yes) { DEBUG_ECHOPGM_P(yes ? PSTR(" YES") : PSTR(" N
66 66
 
67 67
 uint8_t L64XX_Marlin::dir_commands[MAX_L64XX];  // array to hold direction command for each driver
68 68
 
69
-#define _EN_ITEM(N) , INVERT_E##N##_DIR
69
+#define _EN_ITEM(N) , ENABLED(INVERT_E##N##_DIR)
70 70
 const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = {
71
-    NUM_AXIS_LIST(INVERT_X_DIR, INVERT_Y_DIR, INVERT_Z_DIR, INVERT_I_DIR, INVERT_J_DIR, INVERT_K_DIR)
72
-  , (INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2
73
-  , (INVERT_Y_DIR) ^ BOTH(Y_DUAL_STEPPER_DRIVERS, INVERT_Y2_VS_Y_DIR) // Y2
74
-  , (INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2
75
-  , (INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3
76
-  , (INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4
71
+    NUM_AXIS_LIST(ENABLED(INVERT_X_DIR), ENABLED(INVERT_Y_DIR), ENABLED(INVERT_Z_DIR), ENABLED(INVERT_I_DIR), ENABLED(INVERT_J_DIR), ENABLED(INVERT_K_DIR), ENABLED(INVERT_U_DIR), ENABLED(INVERT_V_DIR), ENABLED(INVERT_W_DIR))
72
+  , ENABLED(INVERT_X_DIR) ^ BOTH(X_DUAL_STEPPER_DRIVERS, INVERT_X2_VS_X_DIR) // X2
73
+  , ENABLED(INVERT_Y_DIR) ^ BOTH(Y_DUAL_STEPPER_DRIVERS, INVERT_Y2_VS_Y_DIR) // Y2
74
+  , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z2_VS_Z_DIR) // Z2
75
+  , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z3_VS_Z_DIR) // Z3
76
+  , ENABLED(INVERT_Z_DIR) ^ ENABLED(INVERT_Z4_VS_Z_DIR) // Z4
77 77
     REPEAT(E_STEPPERS, _EN_ITEM)
78 78
 };
79 79
 #undef _EN_ITEM

+ 9
- 9
Marlin/src/module/motion.cpp Dosyayı Görüntüle

@@ -1754,7 +1754,7 @@ void prepare_line_to_destination() {
1754 1754
             phasePerUStep = PHASE_PER_MICROSTEP(X);
1755 1755
             phaseCurrent = stepperX.get_microstep_counter();
1756 1756
             effectorBackoutDir = -X_HOME_DIR;
1757
-            stepperBackoutDir = INVERT_X_DIR ? effectorBackoutDir : -effectorBackoutDir;
1757
+            stepperBackoutDir = IF_DISABLED(INVERT_X_DIR, -)effectorBackoutDir;
1758 1758
             break;
1759 1759
         #endif
1760 1760
         #ifdef Y_MICROSTEPS
@@ -1762,7 +1762,7 @@ void prepare_line_to_destination() {
1762 1762
             phasePerUStep = PHASE_PER_MICROSTEP(Y);
1763 1763
             phaseCurrent = stepperY.get_microstep_counter();
1764 1764
             effectorBackoutDir = -Y_HOME_DIR;
1765
-            stepperBackoutDir = INVERT_Y_DIR ? effectorBackoutDir : -effectorBackoutDir;
1765
+            stepperBackoutDir = IF_DISABLED(INVERT_Y_DIR, -)effectorBackoutDir;
1766 1766
             break;
1767 1767
         #endif
1768 1768
         #ifdef Z_MICROSTEPS
@@ -1770,7 +1770,7 @@ void prepare_line_to_destination() {
1770 1770
             phasePerUStep = PHASE_PER_MICROSTEP(Z);
1771 1771
             phaseCurrent = stepperZ.get_microstep_counter();
1772 1772
             effectorBackoutDir = -Z_HOME_DIR;
1773
-            stepperBackoutDir = INVERT_Z_DIR ? effectorBackoutDir : -effectorBackoutDir;
1773
+            stepperBackoutDir = IF_DISABLED(INVERT_Z_DIR, -)effectorBackoutDir;
1774 1774
             break;
1775 1775
         #endif
1776 1776
         #ifdef I_MICROSTEPS
@@ -1778,7 +1778,7 @@ void prepare_line_to_destination() {
1778 1778
             phasePerUStep = PHASE_PER_MICROSTEP(I);
1779 1779
             phaseCurrent = stepperI.get_microstep_counter();
1780 1780
             effectorBackoutDir = -I_HOME_DIR;
1781
-            stepperBackoutDir = INVERT_I_DIR ? effectorBackoutDir : -effectorBackoutDir;
1781
+            stepperBackoutDir = IF_DISABLED(INVERT_I_DIR, -)effectorBackoutDir;
1782 1782
             break;
1783 1783
         #endif
1784 1784
         #ifdef J_MICROSTEPS
@@ -1786,7 +1786,7 @@ void prepare_line_to_destination() {
1786 1786
             phasePerUStep = PHASE_PER_MICROSTEP(J);
1787 1787
             phaseCurrent = stepperJ.get_microstep_counter();
1788 1788
             effectorBackoutDir = -J_HOME_DIR;
1789
-            stepperBackoutDir = INVERT_J_DIR ? effectorBackoutDir : -effectorBackoutDir;
1789
+            stepperBackoutDir = IF_DISABLED(INVERT_J_DIR, -)effectorBackoutDir;
1790 1790
             break;
1791 1791
         #endif
1792 1792
         #ifdef K_MICROSTEPS
@@ -1794,7 +1794,7 @@ void prepare_line_to_destination() {
1794 1794
             phasePerUStep = PHASE_PER_MICROSTEP(K);
1795 1795
             phaseCurrent = stepperK.get_microstep_counter();
1796 1796
             effectorBackoutDir = -K_HOME_DIR;
1797
-            stepperBackoutDir = INVERT_K_DIR ? effectorBackoutDir : -effectorBackoutDir;
1797
+            stepperBackoutDir = IF_DISABLED(INVERT_K_DIR, -)effectorBackoutDir;
1798 1798
             break;
1799 1799
         #endif
1800 1800
         #ifdef U_MICROSTEPS
@@ -1802,7 +1802,7 @@ void prepare_line_to_destination() {
1802 1802
             phasePerUStep = PHASE_PER_MICROSTEP(U);
1803 1803
             phaseCurrent = stepperU.get_microstep_counter();
1804 1804
             effectorBackoutDir = -U_HOME_DIR;
1805
-            stepperBackoutDir = INVERT_U_DIR ? effectorBackoutDir : -effectorBackoutDir;
1805
+            stepperBackoutDir = IF_DISABLED(INVERT_U_DIR, -)effectorBackoutDir;
1806 1806
             break;
1807 1807
         #endif
1808 1808
         #ifdef V_MICROSTEPS
@@ -1810,7 +1810,7 @@ void prepare_line_to_destination() {
1810 1810
             phasePerUStep = PHASE_PER_MICROSTEP(V);
1811 1811
             phaseCurrent = stepperV.get_microstep_counter();
1812 1812
             effectorBackoutDir = -V_HOME_DIR;
1813
-            stepperBackoutDir = INVERT_V_DIR ? effectorBackoutDir : -effectorBackoutDir;
1813
+            stepperBackoutDir = IF_DISABLED(INVERT_V_DIR, -)effectorBackoutDir;
1814 1814
             break;
1815 1815
         #endif
1816 1816
         #ifdef W_MICROSTEPS
@@ -1818,7 +1818,7 @@ void prepare_line_to_destination() {
1818 1818
             phasePerUStep = PHASE_PER_MICROSTEP(W);
1819 1819
             phaseCurrent = stepperW.get_microstep_counter();
1820 1820
             effectorBackoutDir = -W_HOME_DIR;
1821
-            stepperBackoutDir = INVERT_W_DIR ? effectorBackoutDir : -effectorBackoutDir;
1821
+            stepperBackoutDir = IF_DISABLED(INVERT_W_DIR, -)effectorBackoutDir;
1822 1822
             break;
1823 1823
         #endif
1824 1824
         default: return;

+ 10
- 10
Marlin/src/module/stepper.cpp Dosyayı Görüntüle

@@ -3058,7 +3058,7 @@ void Stepper::report_positions() {
3058 3058
 
3059 3059
   #define _ENABLE_AXIS(A) enable_axis(_AXIS(A))
3060 3060
   #define _READ_DIR(AXIS) AXIS ##_DIR_READ()
3061
-  #define _INVERT_DIR(AXIS) INVERT_## AXIS ##_DIR
3061
+  #define _INVERT_DIR(AXIS) ENABLED(INVERT_## AXIS ##_DIR)
3062 3062
   #define _APPLY_DIR(AXIS, INVERT) AXIS ##_APPLY_DIR(INVERT, true)
3063 3063
 
3064 3064
   #if MINIMUM_STEPPER_PULSE
@@ -3203,30 +3203,30 @@ void Stepper::report_positions() {
3203 3203
             U_DIR_READ(), V_DIR_READ(), W_DIR_READ()
3204 3204
           );
3205 3205
 
3206
-          X_DIR_WRITE(INVERT_X_DIR ^ z_direction);
3206
+          X_DIR_WRITE(ENABLED(INVERT_X_DIR) ^ z_direction);
3207 3207
           #ifdef Y_DIR_WRITE
3208
-            Y_DIR_WRITE(INVERT_Y_DIR ^ z_direction);
3208
+            Y_DIR_WRITE(ENABLED(INVERT_Y_DIR) ^ z_direction);
3209 3209
           #endif
3210 3210
           #ifdef Z_DIR_WRITE
3211
-            Z_DIR_WRITE(INVERT_Z_DIR ^ z_direction);
3211
+            Z_DIR_WRITE(ENABLED(INVERT_Z_DIR) ^ z_direction);
3212 3212
           #endif
3213 3213
           #ifdef I_DIR_WRITE
3214
-            I_DIR_WRITE(INVERT_I_DIR ^ z_direction);
3214
+            I_DIR_WRITE(ENABLED(INVERT_I_DIR) ^ z_direction);
3215 3215
           #endif
3216 3216
           #ifdef J_DIR_WRITE
3217
-            J_DIR_WRITE(INVERT_J_DIR ^ z_direction);
3217
+            J_DIR_WRITE(ENABLED(INVERT_J_DIR) ^ z_direction);
3218 3218
           #endif
3219 3219
           #ifdef K_DIR_WRITE
3220
-            K_DIR_WRITE(INVERT_K_DIR ^ z_direction);
3220
+            K_DIR_WRITE(ENABLED(INVERT_K_DIR) ^ z_direction);
3221 3221
           #endif
3222 3222
           #ifdef U_DIR_WRITE
3223
-            U_DIR_WRITE(INVERT_U_DIR ^ z_direction);
3223
+            U_DIR_WRITE(ENABLED(INVERT_U_DIR) ^ z_direction);
3224 3224
           #endif
3225 3225
           #ifdef V_DIR_WRITE
3226
-            V_DIR_WRITE(INVERT_V_DIR ^ z_direction);
3226
+            V_DIR_WRITE(ENABLED(INVERT_V_DIR) ^ z_direction);
3227 3227
           #endif
3228 3228
           #ifdef W_DIR_WRITE
3229
-            W_DIR_WRITE(INVERT_W_DIR ^ z_direction);
3229
+            W_DIR_WRITE(ENABLED(INVERT_W_DIR) ^ z_direction);
3230 3230
           #endif
3231 3231
 
3232 3232
           DIR_WAIT_AFTER();

+ 84
- 84
Marlin/src/module/stepper/indirection.h Dosyayı Görüntüle

@@ -462,91 +462,91 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
462 462
   #if EXTRUDERS > 7
463 463
     #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0)
464 464
     #define   NORM_E_DIR(E)   do{ switch (E) { \
465
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
466
-        case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
467
-        case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \
468
-        case 6: E3_DIR_WRITE( INVERT_E3_DIR); break; case 7: E3_DIR_WRITE( INVERT_E3_DIR); break; \
465
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
466
+        case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
467
+        case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
468
+        case 6: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; case 7: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
469 469
       } }while(0)
470 470
     #define    REV_E_DIR(E)   do{ switch (E) { \
471
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
472
-        case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
473
-        case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
474
-        case 6: E3_DIR_WRITE(!INVERT_E3_DIR); break; case 7: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
471
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
472
+        case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
473
+        case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
474
+        case 6: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; case 7: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
475 475
       } }while(0)
476 476
   #elif EXTRUDERS > 6
477 477
     #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else if (E < 6) { E2_STEP_WRITE(V); } else { E3_STEP_WRITE(V); } }while(0)
478 478
     #define   NORM_E_DIR(E)   do{ switch (E) { \
479
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
480
-        case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
481
-        case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \
482
-        case 6: E3_DIR_WRITE( INVERT_E3_DIR); break; \
479
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
480
+        case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
481
+        case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
482
+        case 6: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
483 483
       } }while(0)
484 484
     #define    REV_E_DIR(E)   do{ switch (E) { \
485
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
486
-        case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
487
-        case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
488
-        case 6: E3_DIR_WRITE(!INVERT_E3_DIR); } }while(0)
485
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
486
+        case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
487
+        case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
488
+        case 6: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); } }while(0)
489 489
   #elif EXTRUDERS > 5
490 490
     #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0)
491 491
     #define   NORM_E_DIR(E)   do{ switch (E) { \
492
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
493
-        case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
494
-        case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 5: E2_DIR_WRITE( INVERT_E2_DIR); break; \
492
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
493
+        case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
494
+        case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
495 495
       } }while(0)
496 496
     #define    REV_E_DIR(E)   do{ switch (E) { \
497
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
498
-        case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
499
-        case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; case 5: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
497
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
498
+        case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
499
+        case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 5: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
500 500
       } }while(0)
501 501
   #elif EXTRUDERS > 4
502 502
     #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else if (E < 4) { E1_STEP_WRITE(V); } else { E2_STEP_WRITE(V); } }while(0)
503 503
     #define   NORM_E_DIR(E)   do{ switch (E) { \
504
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
505
-        case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
506
-        case 4: E2_DIR_WRITE(!INVERT_E2_DIR); break; \
504
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
505
+        case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
506
+        case 4: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; \
507 507
       } }while(0)
508 508
     #define    REV_E_DIR(E)   do{ switch (E) { \
509
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
510
-        case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
511
-        case 4: E2_DIR_WRITE( INVERT_E2_DIR); break; \
509
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
510
+        case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
511
+        case 4: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; \
512 512
       } }while(0)
513 513
   #elif EXTRUDERS > 3
514 514
     #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
515 515
     #define   NORM_E_DIR(E)   do{ switch (E) { \
516
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
517
-        case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 3: E1_DIR_WRITE( INVERT_E1_DIR); break; \
516
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
517
+        case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
518 518
       } }while(0)
519 519
     #define    REV_E_DIR(E)   do{ switch (E) { \
520
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
521
-        case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; case 3: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
520
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
521
+        case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 3: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
522 522
       } }while(0)
523 523
   #elif EXTRUDERS > 2
524 524
     #define E_STEP_WRITE(E,V) do{ if (E < 2) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
525 525
     #define   NORM_E_DIR(E)   do{ switch (E) { \
526
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E0_DIR_WRITE( INVERT_E0_DIR); break; \
527
-        case 2: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
526
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; \
527
+        case 2: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
528 528
       } }while(0)
529 529
     #define    REV_E_DIR(E)   do{ switch (E) { \
530
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E0_DIR_WRITE(!INVERT_E0_DIR); break; \
531
-        case 2: E1_DIR_WRITE( INVERT_E1_DIR); break; \
530
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; \
531
+        case 2: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
532 532
       } }while(0)
533 533
   #else
534 534
     #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
535
-    #define   NORM_E_DIR(E)   do{ E0_DIR_WRITE(E ?  INVERT_E0_DIR : !INVERT_E0_DIR); }while(0)
536
-    #define    REV_E_DIR(E)   do{ E0_DIR_WRITE(E ? !INVERT_E0_DIR :  INVERT_E0_DIR); }while(0)
535
+    #define   NORM_E_DIR(E)   do{ E0_DIR_WRITE(E ?  ENABLED(INVERT_E0_DIR) : DISABLED(INVERT_E0_DIR)); }while(0)
536
+    #define    REV_E_DIR(E)   do{ E0_DIR_WRITE(E ? DISABLED(INVERT_E0_DIR) :  ENABLED(INVERT_E0_DIR)); }while(0)
537 537
   #endif
538 538
 
539 539
 #elif HAS_PRUSA_MMU2  // One multiplexed stepper driver
540 540
 
541 541
   #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
542
-  #define   NORM_E_DIR(E)   E0_DIR_WRITE(!INVERT_E0_DIR)
543
-  #define    REV_E_DIR(E)   E0_DIR_WRITE( INVERT_E0_DIR)
542
+  #define   NORM_E_DIR(E)   E0_DIR_WRITE(DISABLED(INVERT_E0_DIR))
543
+  #define    REV_E_DIR(E)   E0_DIR_WRITE( ENABLED(INVERT_E0_DIR))
544 544
 
545 545
 #elif HAS_PRUSA_MMU1  // One multiplexed stepper driver, reversed on odd index
546 546
 
547 547
   #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
548
-  #define   NORM_E_DIR(E)   do{ E0_DIR_WRITE(TEST(E, 0) ? !INVERT_E0_DIR:  INVERT_E0_DIR); }while(0)
549
-  #define    REV_E_DIR(E)   do{ E0_DIR_WRITE(TEST(E, 0) ?  INVERT_E0_DIR: !INVERT_E0_DIR); }while(0)
548
+  #define   NORM_E_DIR(E)   do{ E0_DIR_WRITE(TEST(E, 0) ? DISABLED(INVERT_E0_DIR):  ENABLED(INVERT_E0_DIR)); }while(0)
549
+  #define    REV_E_DIR(E)   do{ E0_DIR_WRITE(TEST(E, 0) ?  ENABLED(INVERT_E0_DIR): DISABLED(INVERT_E0_DIR)); }while(0)
550 550
 
551 551
 #elif E_STEPPERS > 1
552 552
 
@@ -557,16 +557,16 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
557 557
         case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; case 7: E7_STEP_WRITE(V); break; \
558 558
       } }while(0)
559 559
     #define   _NORM_E_DIR(E)   do{ switch (E) { \
560
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
561
-        case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
562
-        case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \
563
-        case 6: E6_DIR_WRITE(!INVERT_E6_DIR); break; case 7: E7_DIR_WRITE(!INVERT_E7_DIR); break; \
560
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
561
+        case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
562
+        case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \
563
+        case 6: E6_DIR_WRITE(DISABLED(INVERT_E6_DIR)); break; case 7: E7_DIR_WRITE(DISABLED(INVERT_E7_DIR)); break; \
564 564
       } }while(0)
565 565
     #define    _REV_E_DIR(E)   do{ switch (E) { \
566
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
567
-        case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
568
-        case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \
569
-        case 6: E6_DIR_WRITE( INVERT_E6_DIR); break; case 7: E7_DIR_WRITE( INVERT_E7_DIR); break; \
566
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
567
+        case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
568
+        case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \
569
+        case 6: E6_DIR_WRITE( ENABLED(INVERT_E6_DIR)); break; case 7: E7_DIR_WRITE( ENABLED(INVERT_E7_DIR)); break; \
570 570
       } }while(0)
571 571
 
572 572
   #elif E_STEPPERS > 6
@@ -576,16 +576,16 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
576 576
         case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; case 6: E6_STEP_WRITE(V); break; \
577 577
       } }while(0)
578 578
     #define   _NORM_E_DIR(E)   do{ switch (E) { \
579
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
580
-        case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
581
-        case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \
582
-        case 6: E6_DIR_WRITE(!INVERT_E6_DIR); break; \
579
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
580
+        case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
581
+        case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \
582
+        case 6: E6_DIR_WRITE(DISABLED(INVERT_E6_DIR)); break; \
583 583
       } }while(0)
584 584
     #define    _REV_E_DIR(E)   do{ switch (E) { \
585
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
586
-        case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
587
-        case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \
588
-        case 6: E6_DIR_WRITE( INVERT_E6_DIR); break; \
585
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
586
+        case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
587
+        case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \
588
+        case 6: E6_DIR_WRITE( ENABLED(INVERT_E6_DIR)); break; \
589 589
       } }while(0)
590 590
 
591 591
   #elif E_STEPPERS > 5
@@ -595,14 +595,14 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
595 595
         case 4: E4_STEP_WRITE(V); break; case 5: E5_STEP_WRITE(V); break; \
596 596
       } }while(0)
597 597
     #define   _NORM_E_DIR(E)   do{ switch (E) { \
598
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
599
-        case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
600
-        case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; case 5: E5_DIR_WRITE(!INVERT_E5_DIR); break; \
598
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
599
+        case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
600
+        case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE(DISABLED(INVERT_E5_DIR)); break; \
601 601
       } }while(0)
602 602
     #define    _REV_E_DIR(E)   do{ switch (E) { \
603
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
604
-        case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
605
-        case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; case 5: E5_DIR_WRITE( INVERT_E5_DIR); break; \
603
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
604
+        case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
605
+        case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; case 5: E5_DIR_WRITE( ENABLED(INVERT_E5_DIR)); break; \
606 606
       } }while(0)
607 607
 
608 608
   #elif E_STEPPERS > 4
@@ -612,14 +612,14 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
612 612
         case 4: E4_STEP_WRITE(V); break; \
613 613
       } }while(0)
614 614
     #define   _NORM_E_DIR(E)   do{ switch (E) { \
615
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
616
-        case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
617
-        case 4: E4_DIR_WRITE(!INVERT_E4_DIR); break; \
615
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
616
+        case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
617
+        case 4: E4_DIR_WRITE(DISABLED(INVERT_E4_DIR)); break; \
618 618
       } }while(0)
619 619
     #define    _REV_E_DIR(E)   do{ switch (E) { \
620
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
621
-        case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
622
-        case 4: E4_DIR_WRITE( INVERT_E4_DIR); break; \
620
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
621
+        case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
622
+        case 4: E4_DIR_WRITE( ENABLED(INVERT_E4_DIR)); break; \
623 623
       } }while(0)
624 624
 
625 625
   #elif E_STEPPERS > 3
@@ -628,25 +628,25 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
628 628
         case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); break; case 3: E3_STEP_WRITE(V); break; \
629 629
       } }while(0)
630 630
     #define   _NORM_E_DIR(E)   do{ switch (E) { \
631
-        case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; \
632
-        case 2: E2_DIR_WRITE(!INVERT_E2_DIR); break; case 3: E3_DIR_WRITE(!INVERT_E3_DIR); break; \
631
+        case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; \
632
+        case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE(DISABLED(INVERT_E3_DIR)); break; \
633 633
       } }while(0)
634 634
     #define    _REV_E_DIR(E)   do{ switch (E) { \
635
-        case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; \
636
-        case 2: E2_DIR_WRITE( INVERT_E2_DIR); break; case 3: E3_DIR_WRITE( INVERT_E3_DIR); break; \
635
+        case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; \
636
+        case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); break; case 3: E3_DIR_WRITE( ENABLED(INVERT_E3_DIR)); break; \
637 637
       } }while(0)
638 638
 
639 639
   #elif E_STEPPERS > 2
640 640
 
641 641
     #define _E_STEP_WRITE(E,V) do{ switch (E) { case 0: E0_STEP_WRITE(V); break; case 1: E1_STEP_WRITE(V); break; case 2: E2_STEP_WRITE(V); } }while(0)
642
-    #define   _NORM_E_DIR(E)   do{ switch (E) { case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 2: E2_DIR_WRITE(!INVERT_E2_DIR); } }while(0)
643
-    #define    _REV_E_DIR(E)   do{ switch (E) { case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 2: E2_DIR_WRITE( INVERT_E2_DIR); } }while(0)
642
+    #define   _NORM_E_DIR(E)   do{ switch (E) { case 0: E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); break; case 2: E2_DIR_WRITE(DISABLED(INVERT_E2_DIR)); } }while(0)
643
+    #define    _REV_E_DIR(E)   do{ switch (E) { case 0: E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); break; case 1: E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); break; case 2: E2_DIR_WRITE( ENABLED(INVERT_E2_DIR)); } }while(0)
644 644
 
645 645
   #else
646 646
 
647 647
     #define _E_STEP_WRITE(E,V) do{ if (E == 0) { E0_STEP_WRITE(V); } else { E1_STEP_WRITE(V); } }while(0)
648
-    #define   _NORM_E_DIR(E)   do{ if (E == 0) { E0_DIR_WRITE(!INVERT_E0_DIR); } else { E1_DIR_WRITE(!INVERT_E1_DIR); } }while(0)
649
-    #define    _REV_E_DIR(E)   do{ if (E == 0) { E0_DIR_WRITE( INVERT_E0_DIR); } else { E1_DIR_WRITE( INVERT_E1_DIR); } }while(0)
648
+    #define   _NORM_E_DIR(E)   do{ if (E == 0) { E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); } else { E1_DIR_WRITE(DISABLED(INVERT_E1_DIR)); } }while(0)
649
+    #define    _REV_E_DIR(E)   do{ if (E == 0) { E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); } else { E1_DIR_WRITE( ENABLED(INVERT_E1_DIR)); } }while(0)
650 650
   #endif
651 651
 
652 652
   #if HAS_DUPLICATION_MODE
@@ -657,8 +657,8 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
657 657
       #define _DUPE(N,T,V)  E##N##_##T##_WRITE(V)
658 658
     #endif
659 659
 
660
-    #define NDIR(N) _DUPE(N,DIR,!INVERT_E##N##_DIR)
661
-    #define RDIR(N) _DUPE(N,DIR, INVERT_E##N##_DIR)
660
+    #define NDIR(N) _DUPE(N,DIR,DISABLED(INVERT_E##N##_DIR))
661
+    #define RDIR(N) _DUPE(N,DIR, ENABLED(INVERT_E##N##_DIR))
662 662
 
663 663
     #define E_STEP_WRITE(E,V) do{ if (extruder_duplication_enabled) { DUPE(STEP,V); } else _E_STEP_WRITE(E,V); }while(0)
664 664
 
@@ -704,13 +704,13 @@ void reset_stepper_drivers();    // Called by settings.load / settings.reset
704 704
 
705 705
 #elif ENABLED(E_DUAL_STEPPER_DRIVERS)
706 706
   #define E_STEP_WRITE(E,V) do{ E0_STEP_WRITE(V); E1_STEP_WRITE(V); }while(0)
707
-  #define   NORM_E_DIR(E)   do{ E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
708
-  #define    REV_E_DIR(E)   do{ E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E0_DIR ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
707
+  #define   NORM_E_DIR(E)   do{ E0_DIR_WRITE(DISABLED(INVERT_E0_DIR)); E1_DIR_WRITE(DISABLED(INVERT_E0_DIR) ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
708
+  #define    REV_E_DIR(E)   do{ E0_DIR_WRITE( ENABLED(INVERT_E0_DIR)); E1_DIR_WRITE( ENABLED(INVERT_E0_DIR) ^ ENABLED(INVERT_E1_VS_E0_DIR)); }while(0)
709 709
 
710 710
 #elif E_STEPPERS
711 711
   #define E_STEP_WRITE(E,V) E0_STEP_WRITE(V)
712
-  #define   NORM_E_DIR(E)   E0_DIR_WRITE(!INVERT_E0_DIR)
713
-  #define    REV_E_DIR(E)   E0_DIR_WRITE( INVERT_E0_DIR)
712
+  #define   NORM_E_DIR(E)   E0_DIR_WRITE(DISABLED(INVERT_E0_DIR))
713
+  #define    REV_E_DIR(E)   E0_DIR_WRITE( ENABLED(INVERT_E0_DIR))
714 714
 
715 715
 #else
716 716
   #define E_STEP_WRITE(E,V) NOOP

Loading…
İptal
Kaydet