Bläddra i källkod

Pins post-process header (#19860)

Scott Lahteine 3 år sedan
förälder
incheckning
0967c87a8f
Inget konto är kopplat till bidragsgivarens mejladress
3 ändrade filer med 881 tillägg och 855 borttagningar
  1. 0
    6
      Marlin/src/HAL/ESP32/timers.h
  2. 4
    849
      Marlin/src/pins/pins.h
  3. 877
    0
      Marlin/src/pins/pins_postprocess.h

+ 0
- 6
Marlin/src/HAL/ESP32/timers.h Visa fil

@@ -24,15 +24,9 @@
24 24
 #include <stdint.h>
25 25
 #include <driver/timer.h>
26 26
 
27
-// Includes needed to get I2S_STEPPER_STREAM. Note that pins.h
28
-// is included in case this header is being included early.
29
-#include "../../inc/MarlinConfig.h"
30
-#include "../../pins/pins.h"
31
-
32 27
 // ------------------------
33 28
 // Defines
34 29
 // ------------------------
35
-//
36 30
 #define FORCE_INLINE __attribute__((always_inline)) inline
37 31
 
38 32
 typedef uint64_t hal_timer_t;

+ 4
- 849
Marlin/src/pins/pins.h Visa fil

@@ -21,9 +21,9 @@
21 21
  */
22 22
 #pragma once
23 23
 
24
-#include "../core/boards.h"
25
-
26 24
 /**
25
+ * File: pins/pins.h
26
+ *
27 27
  * Include pins definitions
28 28
  *
29 29
  * Pins numbering schemes:
@@ -783,852 +783,7 @@
783 783
 
784 784
 #endif
785 785
 
786
-// Define certain undefined pins
787
-#ifndef X_MS1_PIN
788
-  #define X_MS1_PIN -1
789
-#endif
790
-#ifndef X_MS2_PIN
791
-  #define X_MS2_PIN -1
792
-#endif
793
-#ifndef X_MS3_PIN
794
-  #define X_MS3_PIN -1
795
-#endif
796
-#ifndef Y_MS1_PIN
797
-  #define Y_MS1_PIN -1
798
-#endif
799
-#ifndef Y_MS2_PIN
800
-  #define Y_MS2_PIN -1
801
-#endif
802
-#ifndef Y_MS3_PIN
803
-  #define Y_MS3_PIN -1
804
-#endif
805
-#ifndef Z_MS1_PIN
806
-  #define Z_MS1_PIN -1
807
-#endif
808
-#ifndef Z_MS2_PIN
809
-  #define Z_MS2_PIN -1
810
-#endif
811
-#ifndef Z_MS3_PIN
812
-  #define Z_MS3_PIN -1
813
-#endif
814
-#ifndef E0_MS1_PIN
815
-  #define E0_MS1_PIN -1
816
-#endif
817
-#ifndef E0_MS2_PIN
818
-  #define E0_MS2_PIN -1
819
-#endif
820
-#ifndef E0_MS3_PIN
821
-  #define E0_MS3_PIN -1
822
-#endif
823
-#ifndef E1_MS1_PIN
824
-  #define E1_MS1_PIN -1
825
-#endif
826
-#ifndef E1_MS2_PIN
827
-  #define E1_MS2_PIN -1
828
-#endif
829
-#ifndef E1_MS3_PIN
830
-  #define E1_MS3_PIN -1
831
-#endif
832
-#ifndef E2_MS1_PIN
833
-  #define E2_MS1_PIN -1
834
-#endif
835
-#ifndef E2_MS2_PIN
836
-  #define E2_MS2_PIN -1
837
-#endif
838
-#ifndef E2_MS3_PIN
839
-  #define E2_MS3_PIN -1
840
-#endif
841
-#ifndef E3_MS1_PIN
842
-  #define E3_MS1_PIN -1
843
-#endif
844
-#ifndef E3_MS2_PIN
845
-  #define E3_MS2_PIN -1
846
-#endif
847
-#ifndef E3_MS3_PIN
848
-  #define E3_MS3_PIN -1
849
-#endif
850
-#ifndef E4_MS1_PIN
851
-  #define E4_MS1_PIN -1
852
-#endif
853
-#ifndef E4_MS2_PIN
854
-  #define E4_MS2_PIN -1
855
-#endif
856
-#ifndef E4_MS3_PIN
857
-  #define E4_MS3_PIN -1
858
-#endif
859
-#ifndef E5_MS1_PIN
860
-  #define E5_MS1_PIN -1
861
-#endif
862
-#ifndef E5_MS2_PIN
863
-  #define E5_MS2_PIN -1
864
-#endif
865
-#ifndef E5_MS3_PIN
866
-  #define E5_MS3_PIN -1
867
-#endif
868
-#ifndef E6_MS1_PIN
869
-  #define E6_MS1_PIN -1
870
-#endif
871
-#ifndef E6_MS2_PIN
872
-  #define E6_MS2_PIN -1
873
-#endif
874
-#ifndef E6_MS3_PIN
875
-  #define E6_MS3_PIN -1
876
-#endif
877
-#ifndef E7_MS1_PIN
878
-  #define E7_MS1_PIN -1
879
-#endif
880
-#ifndef E7_MS2_PIN
881
-  #define E7_MS2_PIN -1
882
-#endif
883
-#ifndef E7_MS3_PIN
884
-  #define E7_MS3_PIN -1
885
-#endif
886
-
887
-#ifndef E0_STEP_PIN
888
-  #define E0_STEP_PIN -1
889
-#endif
890
-#ifndef E0_DIR_PIN
891
-  #define E0_DIR_PIN -1
892
-#endif
893
-#ifndef E0_ENABLE_PIN
894
-  #define E0_ENABLE_PIN -1
895
-#endif
896
-#ifndef E1_STEP_PIN
897
-  #define E1_STEP_PIN -1
898
-#endif
899
-#ifndef E1_DIR_PIN
900
-  #define E1_DIR_PIN -1
901
-#endif
902
-#ifndef E1_ENABLE_PIN
903
-  #define E1_ENABLE_PIN -1
904
-#endif
905
-#ifndef E2_STEP_PIN
906
-  #define E2_STEP_PIN -1
907
-#endif
908
-#ifndef E2_DIR_PIN
909
-  #define E2_DIR_PIN -1
910
-#endif
911
-#ifndef E2_ENABLE_PIN
912
-  #define E2_ENABLE_PIN -1
913
-#endif
914
-#ifndef E3_STEP_PIN
915
-  #define E3_STEP_PIN -1
916
-#endif
917
-#ifndef E3_DIR_PIN
918
-  #define E3_DIR_PIN -1
919
-#endif
920
-#ifndef E3_ENABLE_PIN
921
-  #define E3_ENABLE_PIN -1
922
-#endif
923
-#ifndef E4_STEP_PIN
924
-  #define E4_STEP_PIN -1
925
-#endif
926
-#ifndef E4_DIR_PIN
927
-  #define E4_DIR_PIN -1
928
-#endif
929
-#ifndef E4_ENABLE_PIN
930
-  #define E4_ENABLE_PIN -1
931
-#endif
932
-#ifndef E5_STEP_PIN
933
-  #define E5_STEP_PIN -1
934
-#endif
935
-#ifndef E5_DIR_PIN
936
-  #define E5_DIR_PIN -1
937
-#endif
938
-#ifndef E5_ENABLE_PIN
939
-  #define E5_ENABLE_PIN -1
940
-#endif
941
-#ifndef E6_STEP_PIN
942
-  #define E6_STEP_PIN -1
943
-#endif
944
-#ifndef E6_DIR_PIN
945
-  #define E6_DIR_PIN -1
946
-#endif
947
-#ifndef E6_ENABLE_PIN
948
-  #define E6_ENABLE_PIN -1
949
-#endif
950
-#ifndef E7_STEP_PIN
951
-  #define E7_STEP_PIN -1
952
-#endif
953
-#ifndef E7_DIR_PIN
954
-  #define E7_DIR_PIN -1
955
-#endif
956
-#ifndef E7_ENABLE_PIN
957
-  #define E7_ENABLE_PIN -1
958
-#endif
959
-
960 786
 //
961
-// Destroy unused CS pins
787
+// Post-process pins according to configured settings
962 788
 //
963
-#if !AXIS_HAS_SPI(X)
964
-  #undef X_CS_PIN
965
-#endif
966
-#if !AXIS_HAS_SPI(Y)
967
-  #undef Y_CS_PIN
968
-#endif
969
-#if !AXIS_HAS_SPI(Z)
970
-  #undef Z_CS_PIN
971
-#endif
972
-#if E_STEPPERS && !AXIS_HAS_SPI(E0)
973
-  #undef E0_CS_PIN
974
-#endif
975
-#if E_STEPPERS > 1 && !AXIS_HAS_SPI(E1)
976
-  #undef E1_CS_PIN
977
-#endif
978
-#if E_STEPPERS > 2 && !AXIS_HAS_SPI(E2)
979
-  #undef E2_CS_PIN
980
-#endif
981
-#if E_STEPPERS > 3 && !AXIS_HAS_SPI(E3)
982
-  #undef E3_CS_PIN
983
-#endif
984
-#if E_STEPPERS > 4 && !AXIS_HAS_SPI(E4)
985
-  #undef E4_CS_PIN
986
-#endif
987
-#if E_STEPPERS > 5 && !AXIS_HAS_SPI(E5)
988
-  #undef E5_CS_PIN
989
-#endif
990
-#if E_STEPPERS > 6 && !AXIS_HAS_SPI(E6)
991
-  #undef E6_CS_PIN
992
-#endif
993
-#if E_STEPPERS > 7 && !AXIS_HAS_SPI(E7)
994
-  #undef E7_CS_PIN
995
-#endif
996
-
997
-#ifndef X_CS_PIN
998
-  #define X_CS_PIN -1
999
-#endif
1000
-#ifndef Y_CS_PIN
1001
-  #define Y_CS_PIN -1
1002
-#endif
1003
-#ifndef Z_CS_PIN
1004
-  #define Z_CS_PIN -1
1005
-#endif
1006
-#ifndef E0_CS_PIN
1007
-  #define E0_CS_PIN -1
1008
-#endif
1009
-#ifndef E1_CS_PIN
1010
-  #define E1_CS_PIN -1
1011
-#endif
1012
-#ifndef E2_CS_PIN
1013
-  #define E2_CS_PIN -1
1014
-#endif
1015
-#ifndef E3_CS_PIN
1016
-  #define E3_CS_PIN -1
1017
-#endif
1018
-#ifndef E4_CS_PIN
1019
-  #define E4_CS_PIN -1
1020
-#endif
1021
-#ifndef E5_CS_PIN
1022
-  #define E5_CS_PIN -1
1023
-#endif
1024
-#ifndef E6_CS_PIN
1025
-  #define E6_CS_PIN -1
1026
-#endif
1027
-#ifndef E7_CS_PIN
1028
-  #define E7_CS_PIN -1
1029
-#endif
1030
-
1031
-#ifndef FAN_PIN
1032
-  #define FAN_PIN -1
1033
-#endif
1034
-#define FAN0_PIN FAN_PIN
1035
-#ifndef FAN1_PIN
1036
-  #define FAN1_PIN -1
1037
-#endif
1038
-#ifndef FAN2_PIN
1039
-  #define FAN2_PIN -1
1040
-#endif
1041
-#ifndef CONTROLLER_FAN_PIN
1042
-  #define CONTROLLER_FAN_PIN  -1
1043
-#endif
1044
-
1045
-#ifndef FANMUX0_PIN
1046
-  #define FANMUX0_PIN -1
1047
-#endif
1048
-#ifndef FANMUX1_PIN
1049
-  #define FANMUX1_PIN -1
1050
-#endif
1051
-#ifndef FANMUX2_PIN
1052
-  #define FANMUX2_PIN -1
1053
-#endif
1054
-
1055
-#ifndef HEATER_0_PIN
1056
-  #define HEATER_0_PIN -1
1057
-#endif
1058
-#ifndef HEATER_1_PIN
1059
-  #define HEATER_1_PIN -1
1060
-#endif
1061
-#ifndef HEATER_2_PIN
1062
-  #define HEATER_2_PIN -1
1063
-#endif
1064
-#ifndef HEATER_3_PIN
1065
-  #define HEATER_3_PIN -1
1066
-#endif
1067
-#ifndef HEATER_4_PIN
1068
-  #define HEATER_4_PIN -1
1069
-#endif
1070
-#ifndef HEATER_5_PIN
1071
-  #define HEATER_5_PIN -1
1072
-#endif
1073
-#ifndef HEATER_6_PIN
1074
-  #define HEATER_6_PIN -1
1075
-#endif
1076
-#ifndef HEATER_7_PIN
1077
-  #define HEATER_7_PIN -1
1078
-#endif
1079
-#ifndef HEATER_BED_PIN
1080
-  #define HEATER_BED_PIN -1
1081
-#endif
1082
-
1083
-#ifndef TEMP_0_PIN
1084
-  #define TEMP_0_PIN -1
1085
-#endif
1086
-#ifndef TEMP_1_PIN
1087
-  #define TEMP_1_PIN -1
1088
-#endif
1089
-#ifndef TEMP_2_PIN
1090
-  #define TEMP_2_PIN -1
1091
-#endif
1092
-#ifndef TEMP_3_PIN
1093
-  #define TEMP_3_PIN -1
1094
-#endif
1095
-#ifndef TEMP_4_PIN
1096
-  #define TEMP_4_PIN -1
1097
-#endif
1098
-#ifndef TEMP_5_PIN
1099
-  #define TEMP_5_PIN -1
1100
-#endif
1101
-#ifndef TEMP_6_PIN
1102
-  #define TEMP_6_PIN -1
1103
-#endif
1104
-#ifndef TEMP_7_PIN
1105
-  #define TEMP_7_PIN -1
1106
-#endif
1107
-#ifndef TEMP_BED_PIN
1108
-  #define TEMP_BED_PIN -1
1109
-#endif
1110
-
1111
-#ifndef SD_DETECT_PIN
1112
-  #define SD_DETECT_PIN -1
1113
-#endif
1114
-#ifndef SDPOWER_PIN
1115
-  #define SDPOWER_PIN -1
1116
-#endif
1117
-#ifndef SDSS
1118
-  #define SDSS -1
1119
-#endif
1120
-#ifndef LED_PIN
1121
-  #define LED_PIN -1
1122
-#endif
1123
-#if DISABLED(PSU_CONTROL) || !defined(PS_ON_PIN)
1124
-  #undef PS_ON_PIN
1125
-  #define PS_ON_PIN -1
1126
-#endif
1127
-#ifndef KILL_PIN
1128
-  #define KILL_PIN -1
1129
-#endif
1130
-#ifndef SUICIDE_PIN
1131
-  #define SUICIDE_PIN -1
1132
-#endif
1133
-#ifndef SUICIDE_PIN_INVERTING
1134
-  #define SUICIDE_PIN_INVERTING false
1135
-#endif
1136
-
1137
-#ifndef NUM_SERVO_PLUGS
1138
-  #define NUM_SERVO_PLUGS 4
1139
-#endif
1140
-
1141
-//
1142
-// Assign endstop pins for boards with only 3 connectors
1143
-//
1144
-#ifdef X_STOP_PIN
1145
-  #if X_HOME_DIR < 0
1146
-    #define X_MIN_PIN X_STOP_PIN
1147
-    #ifndef X_MAX_PIN
1148
-      #define X_MAX_PIN -1
1149
-    #endif
1150
-  #else
1151
-    #define X_MAX_PIN X_STOP_PIN
1152
-    #ifndef X_MIN_PIN
1153
-      #define X_MIN_PIN -1
1154
-    #endif
1155
-  #endif
1156
-#elif X_HOME_DIR < 0
1157
-  #define X_STOP_PIN X_MIN_PIN
1158
-#else
1159
-  #define X_STOP_PIN X_MAX_PIN
1160
-#endif
1161
-
1162
-#ifdef Y_STOP_PIN
1163
-  #if Y_HOME_DIR < 0
1164
-    #define Y_MIN_PIN Y_STOP_PIN
1165
-    #ifndef Y_MAX_PIN
1166
-      #define Y_MAX_PIN -1
1167
-    #endif
1168
-  #else
1169
-    #define Y_MAX_PIN Y_STOP_PIN
1170
-    #ifndef Y_MIN_PIN
1171
-      #define Y_MIN_PIN -1
1172
-    #endif
1173
-  #endif
1174
-#elif Y_HOME_DIR < 0
1175
-  #define Y_STOP_PIN Y_MIN_PIN
1176
-#else
1177
-  #define Y_STOP_PIN Y_MAX_PIN
1178
-#endif
1179
-
1180
-#ifdef Z_STOP_PIN
1181
-  #if Z_HOME_DIR < 0
1182
-    #define Z_MIN_PIN Z_STOP_PIN
1183
-    #ifndef Z_MAX_PIN
1184
-      #define Z_MAX_PIN -1
1185
-    #endif
1186
-  #else
1187
-    #define Z_MAX_PIN Z_STOP_PIN
1188
-    #ifndef Z_MIN_PIN
1189
-      #define Z_MIN_PIN -1
1190
-    #endif
1191
-  #endif
1192
-#elif Z_HOME_DIR < 0
1193
-  #define Z_STOP_PIN Z_MIN_PIN
1194
-#else
1195
-  #define Z_STOP_PIN Z_MAX_PIN
1196
-#endif
1197
-
1198
-//
1199
-// Disable unused endstop / probe pins
1200
-//
1201
-#if !HAS_CUSTOM_PROBE_PIN
1202
-  #undef Z_MIN_PROBE_PIN
1203
-  #define Z_MIN_PROBE_PIN    -1
1204
-#endif
1205
-
1206
-#if DISABLED(USE_XMAX_PLUG)
1207
-  #undef X_MAX_PIN
1208
-  #define X_MAX_PIN          -1
1209
-#endif
1210
-
1211
-#if DISABLED(USE_YMAX_PLUG)
1212
-  #undef Y_MAX_PIN
1213
-  #define Y_MAX_PIN          -1
1214
-#endif
1215
-
1216
-#if DISABLED(USE_ZMAX_PLUG)
1217
-  #undef Z_MAX_PIN
1218
-  #define Z_MAX_PIN          -1
1219
-#endif
1220
-
1221
-#if DISABLED(USE_XMIN_PLUG)
1222
-  #undef X_MIN_PIN
1223
-  #define X_MIN_PIN          -1
1224
-#endif
1225
-
1226
-#if DISABLED(USE_YMIN_PLUG)
1227
-  #undef Y_MIN_PIN
1228
-  #define Y_MIN_PIN          -1
1229
-#endif
1230
-
1231
-#if DISABLED(USE_ZMIN_PLUG)
1232
-  #undef Z_MIN_PIN
1233
-  #define Z_MIN_PIN          -1
1234
-#endif
1235
-
1236
-#if HAS_FILAMENT_SENSOR
1237
-  #define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
1238
-#else
1239
-  #undef FIL_RUNOUT_PIN
1240
-  #undef FIL_RUNOUT1_PIN
1241
-#endif
1242
-
1243
-#ifndef LCD_PINS_D4
1244
-  #define LCD_PINS_D4 -1
1245
-#endif
1246
-
1247
-#if HAS_MARLINUI_HD44780 || TOUCH_UI_ULTIPANEL
1248
-  #ifndef LCD_PINS_D5
1249
-    #define LCD_PINS_D5 -1
1250
-  #endif
1251
-  #ifndef LCD_PINS_D6
1252
-    #define LCD_PINS_D6 -1
1253
-  #endif
1254
-  #ifndef LCD_PINS_D7
1255
-    #define LCD_PINS_D7 -1
1256
-  #endif
1257
-#endif
1258
-
1259
-/**
1260
- * Auto-Assignment for Dual X, Dual Y, Multi-Z Steppers
1261
- *
1262
- * By default X2 is assigned to the next open E plug
1263
- * on the board, then in order, Y2, Z2, Z3. These can be
1264
- * overridden in Configuration.h or Configuration_adv.h.
1265
- */
1266
-
1267
-#define __PEXI(p,q) PIN_EXISTS(E##p##_##q)
1268
-#define _PEXI(p,q) __PEXI(p,q)
1269
-#define __EPIN(p,q) E##p##_##q##_PIN
1270
-#define _EPIN(p,q) __EPIN(p,q)
1271
-#define DIAG_REMAPPED(p,q) (PIN_EXISTS(q) && _EPIN(p##_E_INDEX, DIAG) == q##_PIN)
1272
-
1273
-// The X2 axis, if any, should be the next open extruder port
1274
-#define X2_E_INDEX E_STEPPERS
1275
-
1276
-#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
1277
-  #ifndef X2_STEP_PIN
1278
-    #define X2_STEP_PIN   _EPIN(X2_E_INDEX, STEP)
1279
-    #define X2_DIR_PIN    _EPIN(X2_E_INDEX, DIR)
1280
-    #define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE)
1281
-    #if X2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP)
1282
-      #error "No E stepper plug left for X2!"
1283
-    #endif
1284
-  #endif
1285
-  #ifndef X2_MS1_PIN
1286
-    #define X2_MS1_PIN    _EPIN(X2_E_INDEX, MS1)
1287
-  #endif
1288
-  #ifndef X2_MS2_PIN
1289
-    #define X2_MS2_PIN    _EPIN(X2_E_INDEX, MS2)
1290
-  #endif
1291
-  #ifndef X2_MS3_PIN
1292
-    #define X2_MS3_PIN    _EPIN(X2_E_INDEX, MS3)
1293
-  #endif
1294
-  #if AXIS_HAS_SPI(X2) && !defined(X2_CS_PIN)
1295
-    #define X2_CS_PIN     _EPIN(X2_E_INDEX, CS)
1296
-  #endif
1297
-  #if AXIS_HAS_UART(X2)
1298
-    #ifndef X2_SERIAL_TX_PIN
1299
-      #define X2_SERIAL_TX_PIN _EPIN(X2_E_INDEX, SERIAL_TX)
1300
-    #endif
1301
-    #ifndef X2_SERIAL_RX_PIN
1302
-      #define X2_SERIAL_RX_PIN _EPIN(X2_E_INDEX, SERIAL_RX)
1303
-    #endif
1304
-  #endif
1305
-
1306
-  //
1307
-  // Auto-assign pins for stallGuard sensorless homing
1308
-  //
1309
-  #if defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
1310
-    #define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
1311
-    #if   DIAG_REMAPPED(X2, X_MIN)      // If already remapped in the pins file...
1312
-      #define X2_USE_ENDSTOP _XMIN_
1313
-    #elif DIAG_REMAPPED(X2, Y_MIN)
1314
-      #define X2_USE_ENDSTOP _YMIN_
1315
-    #elif DIAG_REMAPPED(X2, Z_MIN)
1316
-      #define X2_USE_ENDSTOP _ZMIN_
1317
-    #elif DIAG_REMAPPED(X2, X_MAX)
1318
-      #define X2_USE_ENDSTOP _XMAX_
1319
-    #elif DIAG_REMAPPED(X2, Y_MAX)
1320
-      #define X2_USE_ENDSTOP _YMAX_
1321
-    #elif DIAG_REMAPPED(X2, Z_MAX)
1322
-      #define X2_USE_ENDSTOP _ZMAX_
1323
-    #else                               // Otherwise use the driver DIAG_PIN directly
1324
-      #define _X2_USE_ENDSTOP(P) _E##P##_DIAG_
1325
-      #define X2_USE_ENDSTOP _X2_USE_ENDSTOP(X2_E_INDEX)
1326
-    #endif
1327
-    #undef X2_DIAG_PIN
1328
-  #endif
1329
-
1330
-  #define Y2_E_INDEX INCREMENT(X2_E_INDEX)
1331
-#else
1332
-  #define Y2_E_INDEX X2_E_INDEX
1333
-#endif
1334
-
1335
-#ifndef X2_CS_PIN
1336
-  #define X2_CS_PIN  -1
1337
-#endif
1338
-#ifndef X2_MS1_PIN
1339
-  #define X2_MS1_PIN -1
1340
-#endif
1341
-#ifndef X2_MS2_PIN
1342
-  #define X2_MS2_PIN -1
1343
-#endif
1344
-#ifndef X2_MS3_PIN
1345
-  #define X2_MS3_PIN -1
1346
-#endif
1347
-
1348
-// The Y2 axis, if any, should be the next open extruder port
1349
-#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
1350
-  #ifndef Y2_STEP_PIN
1351
-    #define Y2_STEP_PIN   _EPIN(Y2_E_INDEX, STEP)
1352
-    #define Y2_DIR_PIN    _EPIN(Y2_E_INDEX, DIR)
1353
-    #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
1354
-    #if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_STEP)
1355
-      #error "No E stepper plug left for Y2!"
1356
-    #endif
1357
-  #endif
1358
-  #ifndef Y2_MS1_PIN
1359
-    #define Y2_MS1_PIN    _EPIN(Y2_E_INDEX, MS1)
1360
-  #endif
1361
-  #ifndef Y2_MS2_PIN
1362
-    #define Y2_MS2_PIN    _EPIN(Y2_E_INDEX, MS2)
1363
-  #endif
1364
-  #ifndef Y2_MS3_PIN
1365
-    #define Y2_MS3_PIN    _EPIN(Y2_E_INDEX, MS3)
1366
-  #endif
1367
-  #if AXIS_HAS_SPI(Y2) && !defined(Y2_CS_PIN)
1368
-    #define Y2_CS_PIN     _EPIN(Y2_E_INDEX, CS)
1369
-  #endif
1370
-  #if AXIS_HAS_UART(Y2)
1371
-    #ifndef Y2_SERIAL_TX_PIN
1372
-      #define Y2_SERIAL_TX_PIN _EPIN(Y2_E_INDEX, SERIAL_TX)
1373
-    #endif
1374
-    #ifndef Y2_SERIAL_RX_PIN
1375
-      #define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
1376
-    #endif
1377
-  #endif
1378
-  #if defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
1379
-    #define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
1380
-    #if   DIAG_REMAPPED(Y2, X_MIN)
1381
-      #define Y2_USE_ENDSTOP _XMIN_
1382
-    #elif DIAG_REMAPPED(Y2, Y_MIN)
1383
-      #define Y2_USE_ENDSTOP _YMIN_
1384
-    #elif DIAG_REMAPPED(Y2, Z_MIN)
1385
-      #define Y2_USE_ENDSTOP _ZMIN_
1386
-    #elif DIAG_REMAPPED(Y2, X_MAX)
1387
-      #define Y2_USE_ENDSTOP _XMAX_
1388
-    #elif DIAG_REMAPPED(Y2, Y_MAX)
1389
-      #define Y2_USE_ENDSTOP _YMAX_
1390
-    #elif DIAG_REMAPPED(Y2, Z_MAX)
1391
-      #define Y2_USE_ENDSTOP _ZMAX_
1392
-    #else
1393
-      #define _Y2_USE_ENDSTOP(P) _E##P##_DIAG_
1394
-      #define Y2_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX)
1395
-    #endif
1396
-    #undef Y2_DIAG_PIN
1397
-  #endif
1398
-  #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
1399
-#else
1400
-  #define Z2_E_INDEX Y2_E_INDEX
1401
-#endif
1402
-
1403
-#ifndef Y2_CS_PIN
1404
-  #define Y2_CS_PIN  -1
1405
-#endif
1406
-#ifndef Y2_MS1_PIN
1407
-  #define Y2_MS1_PIN -1
1408
-#endif
1409
-#ifndef Y2_MS2_PIN
1410
-  #define Y2_MS2_PIN -1
1411
-#endif
1412
-#ifndef Y2_MS3_PIN
1413
-  #define Y2_MS3_PIN -1
1414
-#endif
1415
-
1416
-// The Z2 axis, if any, should be the next open extruder port
1417
-#if NUM_Z_STEPPER_DRIVERS >= 2
1418
-  #ifndef Z2_STEP_PIN
1419
-    #define Z2_STEP_PIN   _EPIN(Z2_E_INDEX, STEP)
1420
-    #define Z2_DIR_PIN    _EPIN(Z2_E_INDEX, DIR)
1421
-    #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
1422
-    #if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_STEP)
1423
-      #error "No E stepper plug left for Z2!"
1424
-    #endif
1425
-  #endif
1426
-  #ifndef Z2_MS1_PIN
1427
-    #define Z2_MS1_PIN    _EPIN(Z2_E_INDEX, MS1)
1428
-  #endif
1429
-  #ifndef Z2_MS2_PIN
1430
-    #define Z2_MS2_PIN    _EPIN(Z2_E_INDEX, MS2)
1431
-  #endif
1432
-  #ifndef Z2_MS3_PIN
1433
-    #define Z2_MS3_PIN    _EPIN(Z2_E_INDEX, MS3)
1434
-  #endif
1435
-  #if AXIS_HAS_SPI(Z2) && !defined(Z2_CS_PIN)
1436
-    #define Z2_CS_PIN     _EPIN(Z2_E_INDEX, CS)
1437
-  #endif
1438
-  #if AXIS_HAS_UART(Z2)
1439
-    #ifndef Z2_SERIAL_TX_PIN
1440
-      #define Z2_SERIAL_TX_PIN _EPIN(Z2_E_INDEX, SERIAL_TX)
1441
-    #endif
1442
-    #ifndef Z2_SERIAL_RX_PIN
1443
-      #define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
1444
-    #endif
1445
-  #endif
1446
-  #if defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
1447
-    #define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
1448
-    #if   DIAG_REMAPPED(Z2, X_MIN)
1449
-      #define Z2_USE_ENDSTOP _XMIN_
1450
-    #elif DIAG_REMAPPED(Z2, Y_MIN)
1451
-      #define Z2_USE_ENDSTOP _YMIN_
1452
-    #elif DIAG_REMAPPED(Z2, Z_MIN)
1453
-      #define Z2_USE_ENDSTOP _ZMIN_
1454
-    #elif DIAG_REMAPPED(Z2, X_MAX)
1455
-      #define Z2_USE_ENDSTOP _XMAX_
1456
-    #elif DIAG_REMAPPED(Z2, Y_MAX)
1457
-      #define Z2_USE_ENDSTOP _YMAX_
1458
-    #elif DIAG_REMAPPED(Z2, Z_MAX)
1459
-      #define Z2_USE_ENDSTOP _ZMAX_
1460
-    #else
1461
-      #define _Z2_USE_ENDSTOP(P) _E##P##_DIAG_
1462
-      #define Z2_USE_ENDSTOP _Z2_USE_ENDSTOP(Z2_E_INDEX)
1463
-    #endif
1464
-    #undef Z2_DIAG_PIN
1465
-  #endif
1466
-  #define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
1467
-#else
1468
-  #define Z3_E_INDEX Z2_E_INDEX
1469
-#endif
1470
-
1471
-#ifndef Z2_CS_PIN
1472
-  #define Z2_CS_PIN  -1
1473
-#endif
1474
-#ifndef Z2_MS1_PIN
1475
-  #define Z2_MS1_PIN -1
1476
-#endif
1477
-#ifndef Z2_MS2_PIN
1478
-  #define Z2_MS2_PIN -1
1479
-#endif
1480
-#ifndef Z2_MS3_PIN
1481
-  #define Z2_MS3_PIN -1
1482
-#endif
1483
-
1484
-#if NUM_Z_STEPPER_DRIVERS >= 3
1485
-  #ifndef Z3_STEP_PIN
1486
-    #define Z3_STEP_PIN   _EPIN(Z3_E_INDEX, STEP)
1487
-    #define Z3_DIR_PIN    _EPIN(Z3_E_INDEX, DIR)
1488
-    #define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
1489
-    #if Z3_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z3_STEP)
1490
-      #error "No E stepper plug left for Z3!"
1491
-    #endif
1492
-  #endif
1493
-  #if AXIS_HAS_SPI(Z3)
1494
-    #ifndef Z3_CS_PIN
1495
-      #define Z3_CS_PIN   _EPIN(Z3_E_INDEX, CS)
1496
-    #endif
1497
-  #endif
1498
-  #ifndef Z3_MS1_PIN
1499
-    #define Z3_MS1_PIN    _EPIN(Z3_E_INDEX, MS1)
1500
-  #endif
1501
-  #ifndef Z3_MS2_PIN
1502
-    #define Z3_MS2_PIN    _EPIN(Z3_E_INDEX, MS2)
1503
-  #endif
1504
-  #ifndef Z3_MS3_PIN
1505
-    #define Z3_MS3_PIN    _EPIN(Z3_E_INDEX, MS3)
1506
-  #endif
1507
-  #if AXIS_HAS_UART(Z3)
1508
-    #ifndef Z3_SERIAL_TX_PIN
1509
-      #define Z3_SERIAL_TX_PIN _EPIN(Z3_E_INDEX, SERIAL_TX)
1510
-    #endif
1511
-    #ifndef Z3_SERIAL_RX_PIN
1512
-      #define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
1513
-    #endif
1514
-  #endif
1515
-  #if defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
1516
-    #define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
1517
-    #if   DIAG_REMAPPED(Z3, X_MIN)
1518
-      #define Z3_USE_ENDSTOP _XMIN_
1519
-    #elif DIAG_REMAPPED(Z3, Y_MIN)
1520
-      #define Z3_USE_ENDSTOP _YMIN_
1521
-    #elif DIAG_REMAPPED(Z3, Z_MIN)
1522
-      #define Z3_USE_ENDSTOP _ZMIN_
1523
-    #elif DIAG_REMAPPED(Z3, X_MAX)
1524
-      #define Z3_USE_ENDSTOP _XMAX_
1525
-    #elif DIAG_REMAPPED(Z3, Y_MAX)
1526
-      #define Z3_USE_ENDSTOP _YMAX_
1527
-    #elif DIAG_REMAPPED(Z3, Z_MAX)
1528
-      #define Z3_USE_ENDSTOP _ZMAX_
1529
-    #else
1530
-      #define _Z3_USE_ENDSTOP(P) _E##P##_DIAG_
1531
-      #define Z3_USE_ENDSTOP _Z3_USE_ENDSTOP(Z3_E_INDEX)
1532
-    #endif
1533
-    #undef Z3_DIAG_PIN
1534
-  #endif
1535
-  #define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
1536
-#endif
1537
-
1538
-#ifndef Z3_CS_PIN
1539
-  #define Z3_CS_PIN  -1
1540
-#endif
1541
-#ifndef Z3_MS1_PIN
1542
-  #define Z3_MS1_PIN -1
1543
-#endif
1544
-#ifndef Z3_MS2_PIN
1545
-  #define Z3_MS2_PIN -1
1546
-#endif
1547
-#ifndef Z3_MS3_PIN
1548
-  #define Z3_MS3_PIN -1
1549
-#endif
1550
-
1551
-#if NUM_Z_STEPPER_DRIVERS >= 4
1552
-  #ifndef Z4_STEP_PIN
1553
-    #define Z4_STEP_PIN   _EPIN(Z4_E_INDEX, STEP)
1554
-    #define Z4_DIR_PIN    _EPIN(Z4_E_INDEX, DIR)
1555
-    #define Z4_ENABLE_PIN _EPIN(Z4_E_INDEX, ENABLE)
1556
-    #if Z4_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z4_STEP)
1557
-      #error "No E stepper plug left for Z4!"
1558
-    #endif
1559
-  #endif
1560
-  #if AXIS_HAS_SPI(Z4)
1561
-    #ifndef Z4_CS_PIN
1562
-      #define Z4_CS_PIN     _EPIN(Z4_E_INDEX, CS)
1563
-    #endif
1564
-  #endif
1565
-  #ifndef Z4_MS1_PIN
1566
-    #define Z4_MS1_PIN    _EPIN(Z4_E_INDEX, MS1)
1567
-  #endif
1568
-  #ifndef Z4_MS2_PIN
1569
-    #define Z4_MS2_PIN    _EPIN(Z4_E_INDEX, MS2)
1570
-  #endif
1571
-  #ifndef Z4_MS3_PIN
1572
-    #define Z4_MS3_PIN    _EPIN(Z4_E_INDEX, MS3)
1573
-  #endif
1574
-  #if AXIS_HAS_UART(Z4)
1575
-    #ifndef Z4_SERIAL_TX_PIN
1576
-      #define Z4_SERIAL_TX_PIN _EPIN(Z4_E_INDEX, SERIAL_TX)
1577
-    #endif
1578
-    #ifndef Z4_SERIAL_RX_PIN
1579
-      #define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX)
1580
-    #endif
1581
-  #endif
1582
-  #if defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
1583
-    #define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
1584
-    #if   DIAG_REMAPPED(Z4, X_MIN)
1585
-      #define Z4_USE_ENDSTOP _XMIN_
1586
-    #elif DIAG_REMAPPED(Z4, Y_MIN)
1587
-      #define Z4_USE_ENDSTOP _YMIN_
1588
-    #elif DIAG_REMAPPED(Z4, Z_MIN)
1589
-      #define Z4_USE_ENDSTOP _ZMIN_
1590
-    #elif DIAG_REMAPPED(Z4, X_MAX)
1591
-      #define Z4_USE_ENDSTOP _XMAX_
1592
-    #elif DIAG_REMAPPED(Z4, Y_MAX)
1593
-      #define Z4_USE_ENDSTOP _YMAX_
1594
-    #elif DIAG_REMAPPED(Z4, Z_MAX)
1595
-      #define Z4_USE_ENDSTOP _ZMAX_
1596
-    #else
1597
-      #define _Z4_USE_ENDSTOP(P) _E##P##_DIAG_
1598
-      #define Z4_USE_ENDSTOP _Z4_USE_ENDSTOP(Z4_E_INDEX)
1599
-    #endif
1600
-    #undef Z4_DIAG_PIN
1601
-  #endif
1602
-#endif
1603
-
1604
-#ifndef Z4_CS_PIN
1605
-  #define Z4_CS_PIN  -1
1606
-#endif
1607
-#ifndef Z4_MS1_PIN
1608
-  #define Z4_MS1_PIN -1
1609
-#endif
1610
-#ifndef Z4_MS2_PIN
1611
-  #define Z4_MS2_PIN -1
1612
-#endif
1613
-#ifndef Z4_MS3_PIN
1614
-  #define Z4_MS3_PIN -1
1615
-#endif
1616
-
1617
-#if HAS_MARLINUI_U8GLIB
1618
-  #if !defined(ST7920_DELAY_1) && defined(BOARD_ST7920_DELAY_1)
1619
-    #define ST7920_DELAY_1 BOARD_ST7920_DELAY_1
1620
-  #endif
1621
-  #if !defined(ST7920_DELAY_2) && defined(BOARD_ST7920_DELAY_2)
1622
-    #define ST7920_DELAY_2 BOARD_ST7920_DELAY_2
1623
-  #endif
1624
-  #if !defined(ST7920_DELAY_3) && defined(BOARD_ST7920_DELAY_3)
1625
-    #define ST7920_DELAY_3 BOARD_ST7920_DELAY_3
1626
-  #endif
1627
-#else
1628
-  #undef ST7920_DELAY_1
1629
-  #undef ST7920_DELAY_2
1630
-  #undef ST7920_DELAY_3
1631
-#endif
1632
-
1633
-#undef HAS_FREE_AUX2_PINS
1634
-#undef DIAG_REMAPPED
789
+#include "pins_postprocess.h"

+ 877
- 0
Marlin/src/pins/pins_postprocess.h Visa fil

@@ -0,0 +1,877 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+//
25
+// File: pins/pins_postprocess.h
26
+// Post-process pins according to configured settings
27
+//
28
+
29
+// Define certain undefined pins
30
+#ifndef X_MS1_PIN
31
+  #define X_MS1_PIN -1
32
+#endif
33
+#ifndef X_MS2_PIN
34
+  #define X_MS2_PIN -1
35
+#endif
36
+#ifndef X_MS3_PIN
37
+  #define X_MS3_PIN -1
38
+#endif
39
+#ifndef Y_MS1_PIN
40
+  #define Y_MS1_PIN -1
41
+#endif
42
+#ifndef Y_MS2_PIN
43
+  #define Y_MS2_PIN -1
44
+#endif
45
+#ifndef Y_MS3_PIN
46
+  #define Y_MS3_PIN -1
47
+#endif
48
+#ifndef Z_MS1_PIN
49
+  #define Z_MS1_PIN -1
50
+#endif
51
+#ifndef Z_MS2_PIN
52
+  #define Z_MS2_PIN -1
53
+#endif
54
+#ifndef Z_MS3_PIN
55
+  #define Z_MS3_PIN -1
56
+#endif
57
+#ifndef E0_MS1_PIN
58
+  #define E0_MS1_PIN -1
59
+#endif
60
+#ifndef E0_MS2_PIN
61
+  #define E0_MS2_PIN -1
62
+#endif
63
+#ifndef E0_MS3_PIN
64
+  #define E0_MS3_PIN -1
65
+#endif
66
+#ifndef E1_MS1_PIN
67
+  #define E1_MS1_PIN -1
68
+#endif
69
+#ifndef E1_MS2_PIN
70
+  #define E1_MS2_PIN -1
71
+#endif
72
+#ifndef E1_MS3_PIN
73
+  #define E1_MS3_PIN -1
74
+#endif
75
+#ifndef E2_MS1_PIN
76
+  #define E2_MS1_PIN -1
77
+#endif
78
+#ifndef E2_MS2_PIN
79
+  #define E2_MS2_PIN -1
80
+#endif
81
+#ifndef E2_MS3_PIN
82
+  #define E2_MS3_PIN -1
83
+#endif
84
+#ifndef E3_MS1_PIN
85
+  #define E3_MS1_PIN -1
86
+#endif
87
+#ifndef E3_MS2_PIN
88
+  #define E3_MS2_PIN -1
89
+#endif
90
+#ifndef E3_MS3_PIN
91
+  #define E3_MS3_PIN -1
92
+#endif
93
+#ifndef E4_MS1_PIN
94
+  #define E4_MS1_PIN -1
95
+#endif
96
+#ifndef E4_MS2_PIN
97
+  #define E4_MS2_PIN -1
98
+#endif
99
+#ifndef E4_MS3_PIN
100
+  #define E4_MS3_PIN -1
101
+#endif
102
+#ifndef E5_MS1_PIN
103
+  #define E5_MS1_PIN -1
104
+#endif
105
+#ifndef E5_MS2_PIN
106
+  #define E5_MS2_PIN -1
107
+#endif
108
+#ifndef E5_MS3_PIN
109
+  #define E5_MS3_PIN -1
110
+#endif
111
+#ifndef E6_MS1_PIN
112
+  #define E6_MS1_PIN -1
113
+#endif
114
+#ifndef E6_MS2_PIN
115
+  #define E6_MS2_PIN -1
116
+#endif
117
+#ifndef E6_MS3_PIN
118
+  #define E6_MS3_PIN -1
119
+#endif
120
+#ifndef E7_MS1_PIN
121
+  #define E7_MS1_PIN -1
122
+#endif
123
+#ifndef E7_MS2_PIN
124
+  #define E7_MS2_PIN -1
125
+#endif
126
+#ifndef E7_MS3_PIN
127
+  #define E7_MS3_PIN -1
128
+#endif
129
+
130
+#ifndef E0_STEP_PIN
131
+  #define E0_STEP_PIN -1
132
+#endif
133
+#ifndef E0_DIR_PIN
134
+  #define E0_DIR_PIN -1
135
+#endif
136
+#ifndef E0_ENABLE_PIN
137
+  #define E0_ENABLE_PIN -1
138
+#endif
139
+#ifndef E1_STEP_PIN
140
+  #define E1_STEP_PIN -1
141
+#endif
142
+#ifndef E1_DIR_PIN
143
+  #define E1_DIR_PIN -1
144
+#endif
145
+#ifndef E1_ENABLE_PIN
146
+  #define E1_ENABLE_PIN -1
147
+#endif
148
+#ifndef E2_STEP_PIN
149
+  #define E2_STEP_PIN -1
150
+#endif
151
+#ifndef E2_DIR_PIN
152
+  #define E2_DIR_PIN -1
153
+#endif
154
+#ifndef E2_ENABLE_PIN
155
+  #define E2_ENABLE_PIN -1
156
+#endif
157
+#ifndef E3_STEP_PIN
158
+  #define E3_STEP_PIN -1
159
+#endif
160
+#ifndef E3_DIR_PIN
161
+  #define E3_DIR_PIN -1
162
+#endif
163
+#ifndef E3_ENABLE_PIN
164
+  #define E3_ENABLE_PIN -1
165
+#endif
166
+#ifndef E4_STEP_PIN
167
+  #define E4_STEP_PIN -1
168
+#endif
169
+#ifndef E4_DIR_PIN
170
+  #define E4_DIR_PIN -1
171
+#endif
172
+#ifndef E4_ENABLE_PIN
173
+  #define E4_ENABLE_PIN -1
174
+#endif
175
+#ifndef E5_STEP_PIN
176
+  #define E5_STEP_PIN -1
177
+#endif
178
+#ifndef E5_DIR_PIN
179
+  #define E5_DIR_PIN -1
180
+#endif
181
+#ifndef E5_ENABLE_PIN
182
+  #define E5_ENABLE_PIN -1
183
+#endif
184
+#ifndef E6_STEP_PIN
185
+  #define E6_STEP_PIN -1
186
+#endif
187
+#ifndef E6_DIR_PIN
188
+  #define E6_DIR_PIN -1
189
+#endif
190
+#ifndef E6_ENABLE_PIN
191
+  #define E6_ENABLE_PIN -1
192
+#endif
193
+#ifndef E7_STEP_PIN
194
+  #define E7_STEP_PIN -1
195
+#endif
196
+#ifndef E7_DIR_PIN
197
+  #define E7_DIR_PIN -1
198
+#endif
199
+#ifndef E7_ENABLE_PIN
200
+  #define E7_ENABLE_PIN -1
201
+#endif
202
+
203
+//
204
+// Destroy unused CS pins
205
+//
206
+#if !AXIS_HAS_SPI(X)
207
+  #undef X_CS_PIN
208
+#endif
209
+#if !AXIS_HAS_SPI(Y)
210
+  #undef Y_CS_PIN
211
+#endif
212
+#if !AXIS_HAS_SPI(Z)
213
+  #undef Z_CS_PIN
214
+#endif
215
+#if E_STEPPERS && !AXIS_HAS_SPI(E0)
216
+  #undef E0_CS_PIN
217
+#endif
218
+#if E_STEPPERS > 1 && !AXIS_HAS_SPI(E1)
219
+  #undef E1_CS_PIN
220
+#endif
221
+#if E_STEPPERS > 2 && !AXIS_HAS_SPI(E2)
222
+  #undef E2_CS_PIN
223
+#endif
224
+#if E_STEPPERS > 3 && !AXIS_HAS_SPI(E3)
225
+  #undef E3_CS_PIN
226
+#endif
227
+#if E_STEPPERS > 4 && !AXIS_HAS_SPI(E4)
228
+  #undef E4_CS_PIN
229
+#endif
230
+#if E_STEPPERS > 5 && !AXIS_HAS_SPI(E5)
231
+  #undef E5_CS_PIN
232
+#endif
233
+#if E_STEPPERS > 6 && !AXIS_HAS_SPI(E6)
234
+  #undef E6_CS_PIN
235
+#endif
236
+#if E_STEPPERS > 7 && !AXIS_HAS_SPI(E7)
237
+  #undef E7_CS_PIN
238
+#endif
239
+
240
+#ifndef X_CS_PIN
241
+  #define X_CS_PIN -1
242
+#endif
243
+#ifndef Y_CS_PIN
244
+  #define Y_CS_PIN -1
245
+#endif
246
+#ifndef Z_CS_PIN
247
+  #define Z_CS_PIN -1
248
+#endif
249
+#ifndef E0_CS_PIN
250
+  #define E0_CS_PIN -1
251
+#endif
252
+#ifndef E1_CS_PIN
253
+  #define E1_CS_PIN -1
254
+#endif
255
+#ifndef E2_CS_PIN
256
+  #define E2_CS_PIN -1
257
+#endif
258
+#ifndef E3_CS_PIN
259
+  #define E3_CS_PIN -1
260
+#endif
261
+#ifndef E4_CS_PIN
262
+  #define E4_CS_PIN -1
263
+#endif
264
+#ifndef E5_CS_PIN
265
+  #define E5_CS_PIN -1
266
+#endif
267
+#ifndef E6_CS_PIN
268
+  #define E6_CS_PIN -1
269
+#endif
270
+#ifndef E7_CS_PIN
271
+  #define E7_CS_PIN -1
272
+#endif
273
+
274
+#ifndef FAN_PIN
275
+  #define FAN_PIN -1
276
+#endif
277
+#define FAN0_PIN FAN_PIN
278
+#ifndef FAN1_PIN
279
+  #define FAN1_PIN -1
280
+#endif
281
+#ifndef FAN2_PIN
282
+  #define FAN2_PIN -1
283
+#endif
284
+#ifndef CONTROLLER_FAN_PIN
285
+  #define CONTROLLER_FAN_PIN  -1
286
+#endif
287
+
288
+#ifndef FANMUX0_PIN
289
+  #define FANMUX0_PIN -1
290
+#endif
291
+#ifndef FANMUX1_PIN
292
+  #define FANMUX1_PIN -1
293
+#endif
294
+#ifndef FANMUX2_PIN
295
+  #define FANMUX2_PIN -1
296
+#endif
297
+
298
+#ifndef HEATER_0_PIN
299
+  #define HEATER_0_PIN -1
300
+#endif
301
+#ifndef HEATER_1_PIN
302
+  #define HEATER_1_PIN -1
303
+#endif
304
+#ifndef HEATER_2_PIN
305
+  #define HEATER_2_PIN -1
306
+#endif
307
+#ifndef HEATER_3_PIN
308
+  #define HEATER_3_PIN -1
309
+#endif
310
+#ifndef HEATER_4_PIN
311
+  #define HEATER_4_PIN -1
312
+#endif
313
+#ifndef HEATER_5_PIN
314
+  #define HEATER_5_PIN -1
315
+#endif
316
+#ifndef HEATER_6_PIN
317
+  #define HEATER_6_PIN -1
318
+#endif
319
+#ifndef HEATER_7_PIN
320
+  #define HEATER_7_PIN -1
321
+#endif
322
+#ifndef HEATER_BED_PIN
323
+  #define HEATER_BED_PIN -1
324
+#endif
325
+
326
+#ifndef TEMP_0_PIN
327
+  #define TEMP_0_PIN -1
328
+#endif
329
+#ifndef TEMP_1_PIN
330
+  #define TEMP_1_PIN -1
331
+#endif
332
+#ifndef TEMP_2_PIN
333
+  #define TEMP_2_PIN -1
334
+#endif
335
+#ifndef TEMP_3_PIN
336
+  #define TEMP_3_PIN -1
337
+#endif
338
+#ifndef TEMP_4_PIN
339
+  #define TEMP_4_PIN -1
340
+#endif
341
+#ifndef TEMP_5_PIN
342
+  #define TEMP_5_PIN -1
343
+#endif
344
+#ifndef TEMP_6_PIN
345
+  #define TEMP_6_PIN -1
346
+#endif
347
+#ifndef TEMP_7_PIN
348
+  #define TEMP_7_PIN -1
349
+#endif
350
+#ifndef TEMP_BED_PIN
351
+  #define TEMP_BED_PIN -1
352
+#endif
353
+
354
+#ifndef SD_DETECT_PIN
355
+  #define SD_DETECT_PIN -1
356
+#endif
357
+#ifndef SDPOWER_PIN
358
+  #define SDPOWER_PIN -1
359
+#endif
360
+#ifndef SDSS
361
+  #define SDSS -1
362
+#endif
363
+#ifndef LED_PIN
364
+  #define LED_PIN -1
365
+#endif
366
+#if DISABLED(PSU_CONTROL) || !defined(PS_ON_PIN)
367
+  #undef PS_ON_PIN
368
+  #define PS_ON_PIN -1
369
+#endif
370
+#ifndef KILL_PIN
371
+  #define KILL_PIN -1
372
+#endif
373
+#ifndef SUICIDE_PIN
374
+  #define SUICIDE_PIN -1
375
+#endif
376
+#ifndef SUICIDE_PIN_INVERTING
377
+  #define SUICIDE_PIN_INVERTING false
378
+#endif
379
+
380
+#ifndef NUM_SERVO_PLUGS
381
+  #define NUM_SERVO_PLUGS 4
382
+#endif
383
+
384
+//
385
+// Assign endstop pins for boards with only 3 connectors
386
+//
387
+#ifdef X_STOP_PIN
388
+  #if X_HOME_DIR < 0
389
+    #define X_MIN_PIN X_STOP_PIN
390
+    #ifndef X_MAX_PIN
391
+      #define X_MAX_PIN -1
392
+    #endif
393
+  #else
394
+    #define X_MAX_PIN X_STOP_PIN
395
+    #ifndef X_MIN_PIN
396
+      #define X_MIN_PIN -1
397
+    #endif
398
+  #endif
399
+#elif X_HOME_DIR < 0
400
+  #define X_STOP_PIN X_MIN_PIN
401
+#else
402
+  #define X_STOP_PIN X_MAX_PIN
403
+#endif
404
+
405
+#ifdef Y_STOP_PIN
406
+  #if Y_HOME_DIR < 0
407
+    #define Y_MIN_PIN Y_STOP_PIN
408
+    #ifndef Y_MAX_PIN
409
+      #define Y_MAX_PIN -1
410
+    #endif
411
+  #else
412
+    #define Y_MAX_PIN Y_STOP_PIN
413
+    #ifndef Y_MIN_PIN
414
+      #define Y_MIN_PIN -1
415
+    #endif
416
+  #endif
417
+#elif Y_HOME_DIR < 0
418
+  #define Y_STOP_PIN Y_MIN_PIN
419
+#else
420
+  #define Y_STOP_PIN Y_MAX_PIN
421
+#endif
422
+
423
+#ifdef Z_STOP_PIN
424
+  #if Z_HOME_DIR < 0
425
+    #define Z_MIN_PIN Z_STOP_PIN
426
+    #ifndef Z_MAX_PIN
427
+      #define Z_MAX_PIN -1
428
+    #endif
429
+  #else
430
+    #define Z_MAX_PIN Z_STOP_PIN
431
+    #ifndef Z_MIN_PIN
432
+      #define Z_MIN_PIN -1
433
+    #endif
434
+  #endif
435
+#elif Z_HOME_DIR < 0
436
+  #define Z_STOP_PIN Z_MIN_PIN
437
+#else
438
+  #define Z_STOP_PIN Z_MAX_PIN
439
+#endif
440
+
441
+//
442
+// Disable unused endstop / probe pins
443
+//
444
+#if !HAS_CUSTOM_PROBE_PIN
445
+  #undef Z_MIN_PROBE_PIN
446
+  #define Z_MIN_PROBE_PIN    -1
447
+#endif
448
+
449
+#if DISABLED(USE_XMAX_PLUG)
450
+  #undef X_MAX_PIN
451
+  #define X_MAX_PIN          -1
452
+#endif
453
+
454
+#if DISABLED(USE_YMAX_PLUG)
455
+  #undef Y_MAX_PIN
456
+  #define Y_MAX_PIN          -1
457
+#endif
458
+
459
+#if DISABLED(USE_ZMAX_PLUG)
460
+  #undef Z_MAX_PIN
461
+  #define Z_MAX_PIN          -1
462
+#endif
463
+
464
+#if DISABLED(USE_XMIN_PLUG)
465
+  #undef X_MIN_PIN
466
+  #define X_MIN_PIN          -1
467
+#endif
468
+
469
+#if DISABLED(USE_YMIN_PLUG)
470
+  #undef Y_MIN_PIN
471
+  #define Y_MIN_PIN          -1
472
+#endif
473
+
474
+#if DISABLED(USE_ZMIN_PLUG)
475
+  #undef Z_MIN_PIN
476
+  #define Z_MIN_PIN          -1
477
+#endif
478
+
479
+#if HAS_FILAMENT_SENSOR
480
+  #define FIL_RUNOUT1_PIN FIL_RUNOUT_PIN
481
+#else
482
+  #undef FIL_RUNOUT_PIN
483
+  #undef FIL_RUNOUT1_PIN
484
+#endif
485
+
486
+#ifndef LCD_PINS_D4
487
+  #define LCD_PINS_D4 -1
488
+#endif
489
+
490
+#if HAS_MARLINUI_HD44780 || TOUCH_UI_ULTIPANEL
491
+  #ifndef LCD_PINS_D5
492
+    #define LCD_PINS_D5 -1
493
+  #endif
494
+  #ifndef LCD_PINS_D6
495
+    #define LCD_PINS_D6 -1
496
+  #endif
497
+  #ifndef LCD_PINS_D7
498
+    #define LCD_PINS_D7 -1
499
+  #endif
500
+#endif
501
+
502
+/**
503
+ * Auto-Assignment for Dual X, Dual Y, Multi-Z Steppers
504
+ *
505
+ * By default X2 is assigned to the next open E plug
506
+ * on the board, then in order, Y2, Z2, Z3. These can be
507
+ * overridden in Configuration.h or Configuration_adv.h.
508
+ */
509
+
510
+#define __PEXI(p,q) PIN_EXISTS(E##p##_##q)
511
+#define _PEXI(p,q) __PEXI(p,q)
512
+#define __EPIN(p,q) E##p##_##q##_PIN
513
+#define _EPIN(p,q) __EPIN(p,q)
514
+#define DIAG_REMAPPED(p,q) (PIN_EXISTS(q) && _EPIN(p##_E_INDEX, DIAG) == q##_PIN)
515
+
516
+// The X2 axis, if any, should be the next open extruder port
517
+#define X2_E_INDEX E_STEPPERS
518
+
519
+#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
520
+  #ifndef X2_STEP_PIN
521
+    #define X2_STEP_PIN   _EPIN(X2_E_INDEX, STEP)
522
+    #define X2_DIR_PIN    _EPIN(X2_E_INDEX, DIR)
523
+    #define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE)
524
+    #if X2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(X2_STEP)
525
+      #error "No E stepper plug left for X2!"
526
+    #endif
527
+  #endif
528
+  #ifndef X2_MS1_PIN
529
+    #define X2_MS1_PIN    _EPIN(X2_E_INDEX, MS1)
530
+  #endif
531
+  #ifndef X2_MS2_PIN
532
+    #define X2_MS2_PIN    _EPIN(X2_E_INDEX, MS2)
533
+  #endif
534
+  #ifndef X2_MS3_PIN
535
+    #define X2_MS3_PIN    _EPIN(X2_E_INDEX, MS3)
536
+  #endif
537
+  #if AXIS_HAS_SPI(X2) && !defined(X2_CS_PIN)
538
+    #define X2_CS_PIN     _EPIN(X2_E_INDEX, CS)
539
+  #endif
540
+  #if AXIS_HAS_UART(X2)
541
+    #ifndef X2_SERIAL_TX_PIN
542
+      #define X2_SERIAL_TX_PIN _EPIN(X2_E_INDEX, SERIAL_TX)
543
+    #endif
544
+    #ifndef X2_SERIAL_RX_PIN
545
+      #define X2_SERIAL_RX_PIN _EPIN(X2_E_INDEX, SERIAL_RX)
546
+    #endif
547
+  #endif
548
+
549
+  //
550
+  // Auto-assign pins for stallGuard sensorless homing
551
+  //
552
+  #if defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
553
+    #define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
554
+    #if   DIAG_REMAPPED(X2, X_MIN)      // If already remapped in the pins file...
555
+      #define X2_USE_ENDSTOP _XMIN_
556
+    #elif DIAG_REMAPPED(X2, Y_MIN)
557
+      #define X2_USE_ENDSTOP _YMIN_
558
+    #elif DIAG_REMAPPED(X2, Z_MIN)
559
+      #define X2_USE_ENDSTOP _ZMIN_
560
+    #elif DIAG_REMAPPED(X2, X_MAX)
561
+      #define X2_USE_ENDSTOP _XMAX_
562
+    #elif DIAG_REMAPPED(X2, Y_MAX)
563
+      #define X2_USE_ENDSTOP _YMAX_
564
+    #elif DIAG_REMAPPED(X2, Z_MAX)
565
+      #define X2_USE_ENDSTOP _ZMAX_
566
+    #else                               // Otherwise use the driver DIAG_PIN directly
567
+      #define _X2_USE_ENDSTOP(P) _E##P##_DIAG_
568
+      #define X2_USE_ENDSTOP _X2_USE_ENDSTOP(X2_E_INDEX)
569
+    #endif
570
+    #undef X2_DIAG_PIN
571
+  #endif
572
+
573
+  #define Y2_E_INDEX INCREMENT(X2_E_INDEX)
574
+#else
575
+  #define Y2_E_INDEX X2_E_INDEX
576
+#endif
577
+
578
+#ifndef X2_CS_PIN
579
+  #define X2_CS_PIN  -1
580
+#endif
581
+#ifndef X2_MS1_PIN
582
+  #define X2_MS1_PIN -1
583
+#endif
584
+#ifndef X2_MS2_PIN
585
+  #define X2_MS2_PIN -1
586
+#endif
587
+#ifndef X2_MS3_PIN
588
+  #define X2_MS3_PIN -1
589
+#endif
590
+
591
+// The Y2 axis, if any, should be the next open extruder port
592
+#if ENABLED(Y_DUAL_STEPPER_DRIVERS)
593
+  #ifndef Y2_STEP_PIN
594
+    #define Y2_STEP_PIN   _EPIN(Y2_E_INDEX, STEP)
595
+    #define Y2_DIR_PIN    _EPIN(Y2_E_INDEX, DIR)
596
+    #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
597
+    #if Y2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Y2_STEP)
598
+      #error "No E stepper plug left for Y2!"
599
+    #endif
600
+  #endif
601
+  #ifndef Y2_MS1_PIN
602
+    #define Y2_MS1_PIN    _EPIN(Y2_E_INDEX, MS1)
603
+  #endif
604
+  #ifndef Y2_MS2_PIN
605
+    #define Y2_MS2_PIN    _EPIN(Y2_E_INDEX, MS2)
606
+  #endif
607
+  #ifndef Y2_MS3_PIN
608
+    #define Y2_MS3_PIN    _EPIN(Y2_E_INDEX, MS3)
609
+  #endif
610
+  #if AXIS_HAS_SPI(Y2) && !defined(Y2_CS_PIN)
611
+    #define Y2_CS_PIN     _EPIN(Y2_E_INDEX, CS)
612
+  #endif
613
+  #if AXIS_HAS_UART(Y2)
614
+    #ifndef Y2_SERIAL_TX_PIN
615
+      #define Y2_SERIAL_TX_PIN _EPIN(Y2_E_INDEX, SERIAL_TX)
616
+    #endif
617
+    #ifndef Y2_SERIAL_RX_PIN
618
+      #define Y2_SERIAL_RX_PIN _EPIN(Y2_E_INDEX, SERIAL_RX)
619
+    #endif
620
+  #endif
621
+  #if defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
622
+    #define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
623
+    #if   DIAG_REMAPPED(Y2, X_MIN)
624
+      #define Y2_USE_ENDSTOP _XMIN_
625
+    #elif DIAG_REMAPPED(Y2, Y_MIN)
626
+      #define Y2_USE_ENDSTOP _YMIN_
627
+    #elif DIAG_REMAPPED(Y2, Z_MIN)
628
+      #define Y2_USE_ENDSTOP _ZMIN_
629
+    #elif DIAG_REMAPPED(Y2, X_MAX)
630
+      #define Y2_USE_ENDSTOP _XMAX_
631
+    #elif DIAG_REMAPPED(Y2, Y_MAX)
632
+      #define Y2_USE_ENDSTOP _YMAX_
633
+    #elif DIAG_REMAPPED(Y2, Z_MAX)
634
+      #define Y2_USE_ENDSTOP _ZMAX_
635
+    #else
636
+      #define _Y2_USE_ENDSTOP(P) _E##P##_DIAG_
637
+      #define Y2_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX)
638
+    #endif
639
+    #undef Y2_DIAG_PIN
640
+  #endif
641
+  #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
642
+#else
643
+  #define Z2_E_INDEX Y2_E_INDEX
644
+#endif
645
+
646
+#ifndef Y2_CS_PIN
647
+  #define Y2_CS_PIN  -1
648
+#endif
649
+#ifndef Y2_MS1_PIN
650
+  #define Y2_MS1_PIN -1
651
+#endif
652
+#ifndef Y2_MS2_PIN
653
+  #define Y2_MS2_PIN -1
654
+#endif
655
+#ifndef Y2_MS3_PIN
656
+  #define Y2_MS3_PIN -1
657
+#endif
658
+
659
+// The Z2 axis, if any, should be the next open extruder port
660
+#if NUM_Z_STEPPER_DRIVERS >= 2
661
+  #ifndef Z2_STEP_PIN
662
+    #define Z2_STEP_PIN   _EPIN(Z2_E_INDEX, STEP)
663
+    #define Z2_DIR_PIN    _EPIN(Z2_E_INDEX, DIR)
664
+    #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
665
+    #if Z2_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z2_STEP)
666
+      #error "No E stepper plug left for Z2!"
667
+    #endif
668
+  #endif
669
+  #ifndef Z2_MS1_PIN
670
+    #define Z2_MS1_PIN    _EPIN(Z2_E_INDEX, MS1)
671
+  #endif
672
+  #ifndef Z2_MS2_PIN
673
+    #define Z2_MS2_PIN    _EPIN(Z2_E_INDEX, MS2)
674
+  #endif
675
+  #ifndef Z2_MS3_PIN
676
+    #define Z2_MS3_PIN    _EPIN(Z2_E_INDEX, MS3)
677
+  #endif
678
+  #if AXIS_HAS_SPI(Z2) && !defined(Z2_CS_PIN)
679
+    #define Z2_CS_PIN     _EPIN(Z2_E_INDEX, CS)
680
+  #endif
681
+  #if AXIS_HAS_UART(Z2)
682
+    #ifndef Z2_SERIAL_TX_PIN
683
+      #define Z2_SERIAL_TX_PIN _EPIN(Z2_E_INDEX, SERIAL_TX)
684
+    #endif
685
+    #ifndef Z2_SERIAL_RX_PIN
686
+      #define Z2_SERIAL_RX_PIN _EPIN(Z2_E_INDEX, SERIAL_RX)
687
+    #endif
688
+  #endif
689
+  #if defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
690
+    #define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
691
+    #if   DIAG_REMAPPED(Z2, X_MIN)
692
+      #define Z2_USE_ENDSTOP _XMIN_
693
+    #elif DIAG_REMAPPED(Z2, Y_MIN)
694
+      #define Z2_USE_ENDSTOP _YMIN_
695
+    #elif DIAG_REMAPPED(Z2, Z_MIN)
696
+      #define Z2_USE_ENDSTOP _ZMIN_
697
+    #elif DIAG_REMAPPED(Z2, X_MAX)
698
+      #define Z2_USE_ENDSTOP _XMAX_
699
+    #elif DIAG_REMAPPED(Z2, Y_MAX)
700
+      #define Z2_USE_ENDSTOP _YMAX_
701
+    #elif DIAG_REMAPPED(Z2, Z_MAX)
702
+      #define Z2_USE_ENDSTOP _ZMAX_
703
+    #else
704
+      #define _Z2_USE_ENDSTOP(P) _E##P##_DIAG_
705
+      #define Z2_USE_ENDSTOP _Z2_USE_ENDSTOP(Z2_E_INDEX)
706
+    #endif
707
+    #undef Z2_DIAG_PIN
708
+  #endif
709
+  #define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
710
+#else
711
+  #define Z3_E_INDEX Z2_E_INDEX
712
+#endif
713
+
714
+#ifndef Z2_CS_PIN
715
+  #define Z2_CS_PIN  -1
716
+#endif
717
+#ifndef Z2_MS1_PIN
718
+  #define Z2_MS1_PIN -1
719
+#endif
720
+#ifndef Z2_MS2_PIN
721
+  #define Z2_MS2_PIN -1
722
+#endif
723
+#ifndef Z2_MS3_PIN
724
+  #define Z2_MS3_PIN -1
725
+#endif
726
+
727
+#if NUM_Z_STEPPER_DRIVERS >= 3
728
+  #ifndef Z3_STEP_PIN
729
+    #define Z3_STEP_PIN   _EPIN(Z3_E_INDEX, STEP)
730
+    #define Z3_DIR_PIN    _EPIN(Z3_E_INDEX, DIR)
731
+    #define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
732
+    #if Z3_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z3_STEP)
733
+      #error "No E stepper plug left for Z3!"
734
+    #endif
735
+  #endif
736
+  #if AXIS_HAS_SPI(Z3)
737
+    #ifndef Z3_CS_PIN
738
+      #define Z3_CS_PIN   _EPIN(Z3_E_INDEX, CS)
739
+    #endif
740
+  #endif
741
+  #ifndef Z3_MS1_PIN
742
+    #define Z3_MS1_PIN    _EPIN(Z3_E_INDEX, MS1)
743
+  #endif
744
+  #ifndef Z3_MS2_PIN
745
+    #define Z3_MS2_PIN    _EPIN(Z3_E_INDEX, MS2)
746
+  #endif
747
+  #ifndef Z3_MS3_PIN
748
+    #define Z3_MS3_PIN    _EPIN(Z3_E_INDEX, MS3)
749
+  #endif
750
+  #if AXIS_HAS_UART(Z3)
751
+    #ifndef Z3_SERIAL_TX_PIN
752
+      #define Z3_SERIAL_TX_PIN _EPIN(Z3_E_INDEX, SERIAL_TX)
753
+    #endif
754
+    #ifndef Z3_SERIAL_RX_PIN
755
+      #define Z3_SERIAL_RX_PIN _EPIN(Z3_E_INDEX, SERIAL_RX)
756
+    #endif
757
+  #endif
758
+  #if defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
759
+    #define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
760
+    #if   DIAG_REMAPPED(Z3, X_MIN)
761
+      #define Z3_USE_ENDSTOP _XMIN_
762
+    #elif DIAG_REMAPPED(Z3, Y_MIN)
763
+      #define Z3_USE_ENDSTOP _YMIN_
764
+    #elif DIAG_REMAPPED(Z3, Z_MIN)
765
+      #define Z3_USE_ENDSTOP _ZMIN_
766
+    #elif DIAG_REMAPPED(Z3, X_MAX)
767
+      #define Z3_USE_ENDSTOP _XMAX_
768
+    #elif DIAG_REMAPPED(Z3, Y_MAX)
769
+      #define Z3_USE_ENDSTOP _YMAX_
770
+    #elif DIAG_REMAPPED(Z3, Z_MAX)
771
+      #define Z3_USE_ENDSTOP _ZMAX_
772
+    #else
773
+      #define _Z3_USE_ENDSTOP(P) _E##P##_DIAG_
774
+      #define Z3_USE_ENDSTOP _Z3_USE_ENDSTOP(Z3_E_INDEX)
775
+    #endif
776
+    #undef Z3_DIAG_PIN
777
+  #endif
778
+  #define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
779
+#endif
780
+
781
+#ifndef Z3_CS_PIN
782
+  #define Z3_CS_PIN  -1
783
+#endif
784
+#ifndef Z3_MS1_PIN
785
+  #define Z3_MS1_PIN -1
786
+#endif
787
+#ifndef Z3_MS2_PIN
788
+  #define Z3_MS2_PIN -1
789
+#endif
790
+#ifndef Z3_MS3_PIN
791
+  #define Z3_MS3_PIN -1
792
+#endif
793
+
794
+#if NUM_Z_STEPPER_DRIVERS >= 4
795
+  #ifndef Z4_STEP_PIN
796
+    #define Z4_STEP_PIN   _EPIN(Z4_E_INDEX, STEP)
797
+    #define Z4_DIR_PIN    _EPIN(Z4_E_INDEX, DIR)
798
+    #define Z4_ENABLE_PIN _EPIN(Z4_E_INDEX, ENABLE)
799
+    #if Z4_E_INDEX >= MAX_EXTRUDERS || !PIN_EXISTS(Z4_STEP)
800
+      #error "No E stepper plug left for Z4!"
801
+    #endif
802
+  #endif
803
+  #if AXIS_HAS_SPI(Z4)
804
+    #ifndef Z4_CS_PIN
805
+      #define Z4_CS_PIN     _EPIN(Z4_E_INDEX, CS)
806
+    #endif
807
+  #endif
808
+  #ifndef Z4_MS1_PIN
809
+    #define Z4_MS1_PIN    _EPIN(Z4_E_INDEX, MS1)
810
+  #endif
811
+  #ifndef Z4_MS2_PIN
812
+    #define Z4_MS2_PIN    _EPIN(Z4_E_INDEX, MS2)
813
+  #endif
814
+  #ifndef Z4_MS3_PIN
815
+    #define Z4_MS3_PIN    _EPIN(Z4_E_INDEX, MS3)
816
+  #endif
817
+  #if AXIS_HAS_UART(Z4)
818
+    #ifndef Z4_SERIAL_TX_PIN
819
+      #define Z4_SERIAL_TX_PIN _EPIN(Z4_E_INDEX, SERIAL_TX)
820
+    #endif
821
+    #ifndef Z4_SERIAL_RX_PIN
822
+      #define Z4_SERIAL_RX_PIN _EPIN(Z4_E_INDEX, SERIAL_RX)
823
+    #endif
824
+  #endif
825
+  #if defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
826
+    #define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
827
+    #if   DIAG_REMAPPED(Z4, X_MIN)
828
+      #define Z4_USE_ENDSTOP _XMIN_
829
+    #elif DIAG_REMAPPED(Z4, Y_MIN)
830
+      #define Z4_USE_ENDSTOP _YMIN_
831
+    #elif DIAG_REMAPPED(Z4, Z_MIN)
832
+      #define Z4_USE_ENDSTOP _ZMIN_
833
+    #elif DIAG_REMAPPED(Z4, X_MAX)
834
+      #define Z4_USE_ENDSTOP _XMAX_
835
+    #elif DIAG_REMAPPED(Z4, Y_MAX)
836
+      #define Z4_USE_ENDSTOP _YMAX_
837
+    #elif DIAG_REMAPPED(Z4, Z_MAX)
838
+      #define Z4_USE_ENDSTOP _ZMAX_
839
+    #else
840
+      #define _Z4_USE_ENDSTOP(P) _E##P##_DIAG_
841
+      #define Z4_USE_ENDSTOP _Z4_USE_ENDSTOP(Z4_E_INDEX)
842
+    #endif
843
+    #undef Z4_DIAG_PIN
844
+  #endif
845
+#endif
846
+
847
+#ifndef Z4_CS_PIN
848
+  #define Z4_CS_PIN  -1
849
+#endif
850
+#ifndef Z4_MS1_PIN
851
+  #define Z4_MS1_PIN -1
852
+#endif
853
+#ifndef Z4_MS2_PIN
854
+  #define Z4_MS2_PIN -1
855
+#endif
856
+#ifndef Z4_MS3_PIN
857
+  #define Z4_MS3_PIN -1
858
+#endif
859
+
860
+#if HAS_MARLINUI_U8GLIB
861
+  #if !defined(ST7920_DELAY_1) && defined(BOARD_ST7920_DELAY_1)
862
+    #define ST7920_DELAY_1 BOARD_ST7920_DELAY_1
863
+  #endif
864
+  #if !defined(ST7920_DELAY_2) && defined(BOARD_ST7920_DELAY_2)
865
+    #define ST7920_DELAY_2 BOARD_ST7920_DELAY_2
866
+  #endif
867
+  #if !defined(ST7920_DELAY_3) && defined(BOARD_ST7920_DELAY_3)
868
+    #define ST7920_DELAY_3 BOARD_ST7920_DELAY_3
869
+  #endif
870
+#else
871
+  #undef ST7920_DELAY_1
872
+  #undef ST7920_DELAY_2
873
+  #undef ST7920_DELAY_3
874
+#endif
875
+
876
+#undef HAS_FREE_AUX2_PINS
877
+#undef DIAG_REMAPPED

Laddar…
Avbryt
Spara