浏览代码

🎨 Handle more pre-defined pins in pins_postprocess (#22771)

Scott Lahteine 3 年前
父节点
当前提交
e31d52184b

+ 0
- 4
Marlin/src/MarlinCore.cpp 查看文件

@@ -30,10 +30,6 @@
30 30
 
31 31
 #include "MarlinCore.h"
32 32
 
33
-#if ENABLED(MARLIN_DEV_MODE)
34
-  #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
35
-#endif
36
-
37 33
 #include "HAL/shared/Delay.h"
38 34
 #include "HAL/shared/esp_wifi.h"
39 35
 #include "HAL/shared/cpu_exception/exception_hook.h"

+ 0
- 4
Marlin/src/inc/SanityCheck.h 查看文件

@@ -1001,10 +1001,6 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
1001 1001
   static_assert(WITHIN(npp_xyz.z, Z_MIN_POS, Z_MAX_POS), "NOZZLE_PARK_POINT.Z is out of bounds (Z_MIN_POS, Z_MAX_POS).");
1002 1002
 #endif
1003 1003
 
1004
-#if !HAS_RESUME_CONTINUE && DISABLED(HOST_PROMPT_SUPPORT) && DISABLED(EXTENSIBLE_UI)
1005
-  #warning "Your Configuration provides no method to acquire user feedback!"
1006
-#endif
1007
-
1008 1004
 /**
1009 1005
  * Instant Freeze
1010 1006
  */

+ 457
- 0
Marlin/src/inc/Warnings.cpp 查看文件

@@ -0,0 +1,457 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 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
+
23
+/**
24
+ * Warnings.cpp
25
+ * Test configuration values and give warnings at compile-time.
26
+ */
27
+
28
+#include "MarlinConfig.h"
29
+
30
+//
31
+// Warnings! Located here so they will appear just once in the build output.
32
+//
33
+
34
+#if ENABLED(MARLIN_DEV_MODE)
35
+  #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!"
36
+#endif
37
+
38
+#if NONE(HAS_RESUME_CONTINUE, HOST_PROMPT_SUPPORT)
39
+  #warning "Your Configuration provides no method to acquire user feedback!"
40
+#endif
41
+
42
+#if AUTO_ASSIGNED_X2_STEPPER
43
+  #warning "Auto-assigned X2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
44
+#endif
45
+#if AUTO_ASSIGNED_X2_MS1
46
+  #warning "Auto-assigned X2_MS1_PIN to an unused En_MS1_PIN."
47
+#endif
48
+#if AUTO_ASSIGNED_X2_MS2
49
+  #warning "Auto-assigned X2_MS2_PIN to an unused En_MS2_PIN."
50
+#endif
51
+#if AUTO_ASSIGNED_X2_MS3
52
+  #warning "Auto-assigned X2_MS3_PIN to an unused En_MS3_PIN."
53
+#endif
54
+#if AUTO_ASSIGNED_X2_CS
55
+  #warning "Auto-assigned X2_CS_PIN to an unused En_CS_PIN."
56
+#endif
57
+#if AUTO_ASSIGNED_X2_DIAG
58
+  #if X2_USE_ENDSTOP == _XMIN_
59
+    #warning "Auto-assigned X2_DIAG_PIN to X_MIN_PIN."
60
+  #elif X2_USE_ENDSTOP == _XMAX_
61
+    #warning "Auto-assigned X2_DIAG_PIN to X_MAX_PIN."
62
+  #elif X2_USE_ENDSTOP == _YMIN_
63
+    #warning "Auto-assigned X2_DIAG_PIN to Y_MIN_PIN."
64
+  #elif X2_USE_ENDSTOP == _YMAX_
65
+    #warning "Auto-assigned X2_DIAG_PIN to Y_MAX_PIN."
66
+  #elif X2_USE_ENDSTOP == _ZMIN_
67
+    #warning "Auto-assigned X2_DIAG_PIN to Z_MIN_PIN."
68
+  #elif X2_USE_ENDSTOP == _ZMAX_
69
+    #warning "Auto-assigned X2_DIAG_PIN to Z_MAX_PIN."
70
+  #elif X2_USE_ENDSTOP == _XDIAG_
71
+    #warning "Auto-assigned X2_DIAG_PIN to X_DIAG_PIN."
72
+  #elif X2_USE_ENDSTOP == _YDIAG_
73
+    #warning "Auto-assigned X2_DIAG_PIN to Y_DIAG_PIN."
74
+  #elif X2_USE_ENDSTOP == _ZDIAG_
75
+    #warning "Auto-assigned X2_DIAG_PIN to Z_DIAG_PIN."
76
+  #elif X2_USE_ENDSTOP == _E0DIAG_
77
+    #warning "Auto-assigned X2_DIAG_PIN to E0_DIAG_PIN."
78
+  #elif X2_USE_ENDSTOP == _E1DIAG_
79
+    #warning "Auto-assigned X2_DIAG_PIN to E1_DIAG_PIN."
80
+  #elif X2_USE_ENDSTOP == _E2DIAG_
81
+    #warning "Auto-assigned X2_DIAG_PIN to E2_DIAG_PIN."
82
+  #elif X2_USE_ENDSTOP == _E3DIAG_
83
+    #warning "Auto-assigned X2_DIAG_PIN to E3_DIAG_PIN."
84
+  #elif X2_USE_ENDSTOP == _E4DIAG_
85
+    #warning "Auto-assigned X2_DIAG_PIN to E4_DIAG_PIN."
86
+  #elif X2_USE_ENDSTOP == _E5DIAG_
87
+    #warning "Auto-assigned X2_DIAG_PIN to E5_DIAG_PIN."
88
+  #elif X2_USE_ENDSTOP == _E6DIAG_
89
+    #warning "Auto-assigned X2_DIAG_PIN to E6_DIAG_PIN."
90
+  #elif X2_USE_ENDSTOP == _E7DIAG_
91
+    #warning "Auto-assigned X2_DIAG_PIN to E7_DIAG_PIN."
92
+  #endif
93
+#endif
94
+#if AUTO_ASSIGNED_Y2_STEPPER
95
+  #warning "Auto-assigned Y2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
96
+#endif
97
+#if AUTO_ASSIGNED_Y2_MS1
98
+  #warning "Auto-assigned Y2_MS1_PIN to an unused En_MS1_PIN."
99
+#endif
100
+#if AUTO_ASSIGNED_Y2_MS2
101
+  #warning "Auto-assigned Y2_MS2_PIN to an unused En_MS2_PIN."
102
+#endif
103
+#if AUTO_ASSIGNED_Y2_MS3
104
+  #warning "Auto-assigned Y2_MS3_PIN to an unused En_MS3_PIN."
105
+#endif
106
+#if AUTO_ASSIGNED_Y2_CS
107
+  #warning "Auto-assigned Y2_CS_PIN to an unused En_CS_PIN."
108
+#endif
109
+#if AUTO_ASSIGNED_Y2_DIAG
110
+  #if Y2_USE_ENDSTOP == _XMIN_
111
+    #warning "Auto-assigned Y2_DIAG_PIN to X_MIN_PIN."
112
+  #elif Y2_USE_ENDSTOP == _XMAX_
113
+    #warning "Auto-assigned Y2_DIAG_PIN to X_MAX_PIN."
114
+  #elif Y2_USE_ENDSTOP == _YMIN_
115
+    #warning "Auto-assigned Y2_DIAG_PIN to Y_MIN_PIN."
116
+  #elif Y2_USE_ENDSTOP == _YMAX_
117
+    #warning "Auto-assigned Y2_DIAG_PIN to Y_MAX_PIN."
118
+  #elif Y2_USE_ENDSTOP == _ZMIN_
119
+    #warning "Auto-assigned Y2_DIAG_PIN to Z_MIN_PIN."
120
+  #elif Y2_USE_ENDSTOP == _ZMAX_
121
+    #warning "Auto-assigned Y2_DIAG_PIN to Z_MAX_PIN."
122
+  #elif Y2_USE_ENDSTOP == _XDIAG_
123
+    #warning "Auto-assigned Y2_DIAG_PIN to X_DIAG_PIN."
124
+  #elif Y2_USE_ENDSTOP == _YDIAG_
125
+    #warning "Auto-assigned Y2_DIAG_PIN to Y_DIAG_PIN."
126
+  #elif Y2_USE_ENDSTOP == _ZDIAG_
127
+    #warning "Auto-assigned Y2_DIAG_PIN to Z_DIAG_PIN."
128
+  #elif Y2_USE_ENDSTOP == _E0DIAG_
129
+    #warning "Auto-assigned Y2_DIAG_PIN to E0_DIAG_PIN."
130
+  #elif Y2_USE_ENDSTOP == _E1DIAG_
131
+    #warning "Auto-assigned Y2_DIAG_PIN to E1_DIAG_PIN."
132
+  #elif Y2_USE_ENDSTOP == _E2DIAG_
133
+    #warning "Auto-assigned Y2_DIAG_PIN to E2_DIAG_PIN."
134
+  #elif Y2_USE_ENDSTOP == _E3DIAG_
135
+    #warning "Auto-assigned Y2_DIAG_PIN to E3_DIAG_PIN."
136
+  #elif Y2_USE_ENDSTOP == _E4DIAG_
137
+    #warning "Auto-assigned Y2_DIAG_PIN to E4_DIAG_PIN."
138
+  #elif Y2_USE_ENDSTOP == _E5DIAG_
139
+    #warning "Auto-assigned Y2_DIAG_PIN to E5_DIAG_PIN."
140
+  #elif Y2_USE_ENDSTOP == _E6DIAG_
141
+    #warning "Auto-assigned Y2_DIAG_PIN to E6_DIAG_PIN."
142
+  #elif Y2_USE_ENDSTOP == _E7DIAG_
143
+    #warning "Auto-assigned Y2_DIAG_PIN to E7_DIAG_PIN."
144
+  #endif
145
+#endif
146
+#if AUTO_ASSIGNED_Z2_STEPPER
147
+  #warning "Auto-assigned Z2 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
148
+#endif
149
+#if AUTO_ASSIGNED_Z2_MS1
150
+  #warning "Auto-assigned Z2_MS1_PIN to an unused En_MS1_PIN."
151
+#endif
152
+#if AUTO_ASSIGNED_Z2_MS2
153
+  #warning "Auto-assigned Z2_MS2_PIN to an unused En_MS2_PIN."
154
+#endif
155
+#if AUTO_ASSIGNED_Z2_MS3
156
+  #warning "Auto-assigned Z2_MS3_PIN to an unused En_MS3_PIN."
157
+#endif
158
+#if AUTO_ASSIGNED_Z2_CS
159
+  #warning "Auto-assigned Z2_CS_PIN to an unused En_CS_PIN."
160
+#endif
161
+#if AUTO_ASSIGNED_Z2_DIAG
162
+  #if Z2_USE_ENDSTOP == _XMIN_
163
+    #warning "Auto-assigned Z2_DIAG_PIN to X_MIN_PIN."
164
+  #elif Z2_USE_ENDSTOP == _XMAX_
165
+    #warning "Auto-assigned Z2_DIAG_PIN to X_MAX_PIN."
166
+  #elif Z2_USE_ENDSTOP == _YMIN_
167
+    #warning "Auto-assigned Z2_DIAG_PIN to Y_MIN_PIN."
168
+  #elif Z2_USE_ENDSTOP == _YMAX_
169
+    #warning "Auto-assigned Z2_DIAG_PIN to Y_MAX_PIN."
170
+  #elif Z2_USE_ENDSTOP == _ZMIN_
171
+    #warning "Auto-assigned Z2_DIAG_PIN to Z_MIN_PIN."
172
+  #elif Z2_USE_ENDSTOP == _ZMAX_
173
+    #warning "Auto-assigned Z2_DIAG_PIN to Z_MAX_PIN."
174
+  #elif Z2_USE_ENDSTOP == _XDIAG_
175
+    #warning "Auto-assigned Z2_DIAG_PIN to X_DIAG_PIN."
176
+  #elif Z2_USE_ENDSTOP == _YDIAG_
177
+    #warning "Auto-assigned Z2_DIAG_PIN to Y_DIAG_PIN."
178
+  #elif Z2_USE_ENDSTOP == _ZDIAG_
179
+    #warning "Auto-assigned Z2_DIAG_PIN to Z_DIAG_PIN."
180
+  #elif Z2_USE_ENDSTOP == _E0DIAG_
181
+    #warning "Auto-assigned Z2_DIAG_PIN to E0_DIAG_PIN."
182
+  #elif Z2_USE_ENDSTOP == _E1DIAG_
183
+    #warning "Auto-assigned Z2_DIAG_PIN to E1_DIAG_PIN."
184
+  #elif Z2_USE_ENDSTOP == _E2DIAG_
185
+    #warning "Auto-assigned Z2_DIAG_PIN to E2_DIAG_PIN."
186
+  #elif Z2_USE_ENDSTOP == _E3DIAG_
187
+    #warning "Auto-assigned Z2_DIAG_PIN to E3_DIAG_PIN."
188
+  #elif Z2_USE_ENDSTOP == _E4DIAG_
189
+    #warning "Auto-assigned Z2_DIAG_PIN to E4_DIAG_PIN."
190
+  #elif Z2_USE_ENDSTOP == _E5DIAG_
191
+    #warning "Auto-assigned Z2_DIAG_PIN to E5_DIAG_PIN."
192
+  #elif Z2_USE_ENDSTOP == _E6DIAG_
193
+    #warning "Auto-assigned Z2_DIAG_PIN to E6_DIAG_PIN."
194
+  #elif Z2_USE_ENDSTOP == _E7DIAG_
195
+    #warning "Auto-assigned Z2_DIAG_PIN to E7_DIAG_PIN."
196
+  #endif
197
+#endif
198
+#if AUTO_ASSIGNED_Z3_STEPPER
199
+  #warning "Auto-assigned Z3 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
200
+#endif
201
+#if AUTO_ASSIGNED_Z3_CS
202
+  #warning "Auto-assigned Z3_CS_PIN to an unused En_CS_PIN."
203
+#endif
204
+#if AUTO_ASSIGNED_Z3_MS1
205
+  #warning "Auto-assigned Z3_MS1_PIN to an unused En_MS1_PIN."
206
+#endif
207
+#if AUTO_ASSIGNED_Z3_MS2
208
+  #warning "Auto-assigned Z3_MS2_PIN to an unused En_MS2_PIN."
209
+#endif
210
+#if AUTO_ASSIGNED_Z3_MS3
211
+  #warning "Auto-assigned Z3_MS3_PIN to an unused En_MS3_PIN."
212
+#endif
213
+#if AUTO_ASSIGNED_Z3_DIAG
214
+  #if Z3_USE_ENDSTOP == _XMIN_
215
+    #warning "Auto-assigned Z3_DIAG_PIN to X_MIN_PIN."
216
+  #elif Z3_USE_ENDSTOP == _XMAX_
217
+    #warning "Auto-assigned Z3_DIAG_PIN to X_MAX_PIN."
218
+  #elif Z3_USE_ENDSTOP == _YMIN_
219
+    #warning "Auto-assigned Z3_DIAG_PIN to Y_MIN_PIN."
220
+  #elif Z3_USE_ENDSTOP == _YMAX_
221
+    #warning "Auto-assigned Z3_DIAG_PIN to Y_MAX_PIN."
222
+  #elif Z3_USE_ENDSTOP == _ZMIN_
223
+    #warning "Auto-assigned Z3_DIAG_PIN to Z_MIN_PIN."
224
+  #elif Z3_USE_ENDSTOP == _ZMAX_
225
+    #warning "Auto-assigned Z3_DIAG_PIN to Z_MAX_PIN."
226
+  #elif Z3_USE_ENDSTOP == _XDIAG_
227
+    #warning "Auto-assigned Z3_DIAG_PIN to X_DIAG_PIN."
228
+  #elif Z3_USE_ENDSTOP == _YDIAG_
229
+    #warning "Auto-assigned Z3_DIAG_PIN to Y_DIAG_PIN."
230
+  #elif Z3_USE_ENDSTOP == _ZDIAG_
231
+    #warning "Auto-assigned Z3_DIAG_PIN to Z_DIAG_PIN."
232
+  #elif Z3_USE_ENDSTOP == _E0DIAG_
233
+    #warning "Auto-assigned Z3_DIAG_PIN to E0_DIAG_PIN."
234
+  #elif Z3_USE_ENDSTOP == _E1DIAG_
235
+    #warning "Auto-assigned Z3_DIAG_PIN to E1_DIAG_PIN."
236
+  #elif Z3_USE_ENDSTOP == _E2DIAG_
237
+    #warning "Auto-assigned Z3_DIAG_PIN to E2_DIAG_PIN."
238
+  #elif Z3_USE_ENDSTOP == _E3DIAG_
239
+    #warning "Auto-assigned Z3_DIAG_PIN to E3_DIAG_PIN."
240
+  #elif Z3_USE_ENDSTOP == _E4DIAG_
241
+    #warning "Auto-assigned Z3_DIAG_PIN to E4_DIAG_PIN."
242
+  #elif Z3_USE_ENDSTOP == _E5DIAG_
243
+    #warning "Auto-assigned Z3_DIAG_PIN to E5_DIAG_PIN."
244
+  #elif Z3_USE_ENDSTOP == _E6DIAG_
245
+    #warning "Auto-assigned Z3_DIAG_PIN to E6_DIAG_PIN."
246
+  #elif Z3_USE_ENDSTOP == _E7DIAG_
247
+    #warning "Auto-assigned Z3_DIAG_PIN to E7_DIAG_PIN."
248
+  #endif
249
+#endif
250
+#if AUTO_ASSIGNED_Z4_STEPPER
251
+  #warning "Auto-assigned Z4 STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
252
+#endif
253
+#if AUTO_ASSIGNED_Z4_CS
254
+  #warning "Auto-assigned Z4_CS_PIN to an unused En_CS_PIN."
255
+#endif
256
+#if AUTO_ASSIGNED_Z4_MS1
257
+  #warning "Auto-assigned Z4_MS1_PIN to an unused En_MS1_PIN."
258
+#endif
259
+#if AUTO_ASSIGNED_Z4_MS2
260
+  #warning "Auto-assigned Z4_MS2_PIN to an unused En_MS2_PIN."
261
+#endif
262
+#if AUTO_ASSIGNED_Z4_MS3
263
+  #warning "Auto-assigned Z4_MS3_PIN to an unused En_MS3_PIN."
264
+#endif
265
+#if AUTO_ASSIGNED_Z4_DIAG
266
+  #if Z4_USE_ENDSTOP == _XMIN_
267
+    #warning "Auto-assigned Z4_DIAG_PIN to X_MIN_PIN."
268
+  #elif Z4_USE_ENDSTOP == _XMAX_
269
+    #warning "Auto-assigned Z4_DIAG_PIN to X_MAX_PIN."
270
+  #elif Z4_USE_ENDSTOP == _YMIN_
271
+    #warning "Auto-assigned Z4_DIAG_PIN to Y_MIN_PIN."
272
+  #elif Z4_USE_ENDSTOP == _YMAX_
273
+    #warning "Auto-assigned Z4_DIAG_PIN to Y_MAX_PIN."
274
+  #elif Z4_USE_ENDSTOP == _ZMIN_
275
+    #warning "Auto-assigned Z4_DIAG_PIN to Z_MIN_PIN."
276
+  #elif Z4_USE_ENDSTOP == _ZMAX_
277
+    #warning "Auto-assigned Z4_DIAG_PIN to Z_MAX_PIN."
278
+  #elif Z4_USE_ENDSTOP == _XDIAG_
279
+    #warning "Auto-assigned Z4_DIAG_PIN to X_DIAG_PIN."
280
+  #elif Z4_USE_ENDSTOP == _YDIAG_
281
+    #warning "Auto-assigned Z4_DIAG_PIN to Y_DIAG_PIN."
282
+  #elif Z4_USE_ENDSTOP == _ZDIAG_
283
+    #warning "Auto-assigned Z4_DIAG_PIN to Z_DIAG_PIN."
284
+  #elif Z4_USE_ENDSTOP == _E0DIAG_
285
+    #warning "Auto-assigned Z4_DIAG_PIN to E0_DIAG_PIN."
286
+  #elif Z4_USE_ENDSTOP == _E1DIAG_
287
+    #warning "Auto-assigned Z4_DIAG_PIN to E1_DIAG_PIN."
288
+  #elif Z4_USE_ENDSTOP == _E2DIAG_
289
+    #warning "Auto-assigned Z4_DIAG_PIN to E2_DIAG_PIN."
290
+  #elif Z4_USE_ENDSTOP == _E3DIAG_
291
+    #warning "Auto-assigned Z4_DIAG_PIN to E3_DIAG_PIN."
292
+  #elif Z4_USE_ENDSTOP == _E4DIAG_
293
+    #warning "Auto-assigned Z4_DIAG_PIN to E4_DIAG_PIN."
294
+  #elif Z4_USE_ENDSTOP == _E5DIAG_
295
+    #warning "Auto-assigned Z4_DIAG_PIN to E5_DIAG_PIN."
296
+  #elif Z4_USE_ENDSTOP == _E6DIAG_
297
+    #warning "Auto-assigned Z4_DIAG_PIN to E6_DIAG_PIN."
298
+  #elif Z4_USE_ENDSTOP == _E7DIAG_
299
+    #warning "Auto-assigned Z4_DIAG_PIN to E7_DIAG_PIN."
300
+  #endif
301
+#endif
302
+#if AUTO_ASSIGNED_I_STEPPER
303
+  #warning "Auto-assigned I STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
304
+#endif
305
+#if AUTO_ASSIGNED_I_CS
306
+  #warning "Auto-assigned I_CS_PIN to an unused En_CS_PIN."
307
+#endif
308
+#if AUTO_ASSIGNED_I_MS1
309
+  #warning "Auto-assigned I_MS1_PIN to an unused En_MS1_PIN."
310
+#endif
311
+#if AUTO_ASSIGNED_I_MS2
312
+  #warning "Auto-assigned I_MS2_PIN to an unused En_MS2_PIN."
313
+#endif
314
+#if AUTO_ASSIGNED_I_MS3
315
+  #warning "Auto-assigned I_MS3_PIN to an unused En_MS3_PIN."
316
+#endif
317
+#if AUTO_ASSIGNED_I_DIAG
318
+  #if I_USE_ENDSTOP == _XMIN_
319
+    #warning "Auto-assigned I_DIAG_PIN to X_MIN_PIN."
320
+  #elif I_USE_ENDSTOP == _XMAX_
321
+    #warning "Auto-assigned I_DIAG_PIN to X_MAX_PIN."
322
+  #elif I_USE_ENDSTOP == _YMIN_
323
+    #warning "Auto-assigned I_DIAG_PIN to Y_MIN_PIN."
324
+  #elif I_USE_ENDSTOP == _YMAX_
325
+    #warning "Auto-assigned I_DIAG_PIN to Y_MAX_PIN."
326
+  #elif I_USE_ENDSTOP == _ZMIN_
327
+    #warning "Auto-assigned I_DIAG_PIN to Z_MIN_PIN."
328
+  #elif I_USE_ENDSTOP == _ZMAX_
329
+    #warning "Auto-assigned I_DIAG_PIN to Z_MAX_PIN."
330
+  #elif I_USE_ENDSTOP == _XDIAG_
331
+    #warning "Auto-assigned I_DIAG_PIN to X_DIAG_PIN."
332
+  #elif I_USE_ENDSTOP == _YDIAG_
333
+    #warning "Auto-assigned I_DIAG_PIN to Y_DIAG_PIN."
334
+  #elif I_USE_ENDSTOP == _ZDIAG_
335
+    #warning "Auto-assigned I_DIAG_PIN to Z_DIAG_PIN."
336
+  #elif I_USE_ENDSTOP == _E0DIAG_
337
+    #warning "Auto-assigned I_DIAG_PIN to E0_DIAG_PIN."
338
+  #elif I_USE_ENDSTOP == _E1DIAG_
339
+    #warning "Auto-assigned I_DIAG_PIN to E1_DIAG_PIN."
340
+  #elif I_USE_ENDSTOP == _E2DIAG_
341
+    #warning "Auto-assigned I_DIAG_PIN to E2_DIAG_PIN."
342
+  #elif I_USE_ENDSTOP == _E3DIAG_
343
+    #warning "Auto-assigned I_DIAG_PIN to E3_DIAG_PIN."
344
+  #elif I_USE_ENDSTOP == _E4DIAG_
345
+    #warning "Auto-assigned I_DIAG_PIN to E4_DIAG_PIN."
346
+  #elif I_USE_ENDSTOP == _E5DIAG_
347
+    #warning "Auto-assigned I_DIAG_PIN to E5_DIAG_PIN."
348
+  #elif I_USE_ENDSTOP == _E6DIAG_
349
+    #warning "Auto-assigned I_DIAG_PIN to E6_DIAG_PIN."
350
+  #elif I_USE_ENDSTOP == _E7DIAG_
351
+    #warning "Auto-assigned I_DIAG_PIN to E7_DIAG_PIN."
352
+  #endif
353
+#endif
354
+#if AUTO_ASSIGNED_J_STEPPER
355
+  #warning "Auto-assigned J STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
356
+#endif
357
+#if AUTO_ASSIGNED_J_CS
358
+  #warning "Auto-assigned J_CS_PIN to an unused En_CS_PIN."
359
+#endif
360
+#if AUTO_ASSIGNED_J_MS1
361
+  #warning "Auto-assigned J_MS1_PIN to an unused En_MS1_PIN."
362
+#endif
363
+#if AUTO_ASSIGNED_J_MS2
364
+  #warning "Auto-assigned J_MS2_PIN to an unused En_MS2_PIN."
365
+#endif
366
+#if AUTO_ASSIGNED_J_MS3
367
+  #warning "Auto-assigned J_MS3_PIN to an unused En_MS3_PIN."
368
+#endif
369
+#if AUTO_ASSIGNED_J_DIAG
370
+  #if J_USE_ENDSTOP == _XMIN_
371
+    #warning "Auto-assigned J_DIAG_PIN to X_MIN_PIN."
372
+  #elif J_USE_ENDSTOP == _XMAX_
373
+    #warning "Auto-assigned J_DIAG_PIN to X_MAX_PIN."
374
+  #elif J_USE_ENDSTOP == _YMIN_
375
+    #warning "Auto-assigned J_DIAG_PIN to Y_MIN_PIN."
376
+  #elif J_USE_ENDSTOP == _YMAX_
377
+    #warning "Auto-assigned J_DIAG_PIN to Y_MAX_PIN."
378
+  #elif J_USE_ENDSTOP == _ZMIN_
379
+    #warning "Auto-assigned J_DIAG_PIN to Z_MIN_PIN."
380
+  #elif J_USE_ENDSTOP == _ZMAX_
381
+    #warning "Auto-assigned J_DIAG_PIN to Z_MAX_PIN."
382
+  #elif J_USE_ENDSTOP == _XDIAG_
383
+    #warning "Auto-assigned J_DIAG_PIN to X_DIAG_PIN."
384
+  #elif J_USE_ENDSTOP == _YDIAG_
385
+    #warning "Auto-assigned J_DIAG_PIN to Y_DIAG_PIN."
386
+  #elif J_USE_ENDSTOP == _ZDIAG_
387
+    #warning "Auto-assigned J_DIAG_PIN to Z_DIAG_PIN."
388
+  #elif J_USE_ENDSTOP == _E0DIAG_
389
+    #warning "Auto-assigned J_DIAG_PIN to E0_DIAG_PIN."
390
+  #elif J_USE_ENDSTOP == _E1DIAG_
391
+    #warning "Auto-assigned J_DIAG_PIN to E1_DIAG_PIN."
392
+  #elif J_USE_ENDSTOP == _E2DIAG_
393
+    #warning "Auto-assigned J_DIAG_PIN to E2_DIAG_PIN."
394
+  #elif J_USE_ENDSTOP == _E3DIAG_
395
+    #warning "Auto-assigned J_DIAG_PIN to E3_DIAG_PIN."
396
+  #elif J_USE_ENDSTOP == _E4DIAG_
397
+    #warning "Auto-assigned J_DIAG_PIN to E4_DIAG_PIN."
398
+  #elif J_USE_ENDSTOP == _E5DIAG_
399
+    #warning "Auto-assigned J_DIAG_PIN to E5_DIAG_PIN."
400
+  #elif J_USE_ENDSTOP == _E6DIAG_
401
+    #warning "Auto-assigned J_DIAG_PIN to E6_DIAG_PIN."
402
+  #elif J_USE_ENDSTOP == _E7DIAG_
403
+    #warning "Auto-assigned J_DIAG_PIN to E7_DIAG_PIN."
404
+  #endif
405
+#endif
406
+#if AUTO_ASSIGNED_K_STEPPER
407
+  #warning "Auto-assigned K STEP/DIR/ENABLE_PINs to unused En_STEP/DIR/ENABLE_PINs."
408
+#endif
409
+#if AUTO_ASSIGNED_K_CS
410
+  #warning "Auto-assigned K_CS_PIN to an unused En_CS_PIN."
411
+#endif
412
+#if AUTO_ASSIGNED_K_MS1
413
+  #warning "Auto-assigned K_MS1_PIN to an unused En_MS1_PIN."
414
+#endif
415
+#if AUTO_ASSIGNED_K_MS2
416
+  #warning "Auto-assigned K_MS2_PIN to an unused En_MS2_PIN."
417
+#endif
418
+#if AUTO_ASSIGNED_K_MS3
419
+  #warning "Auto-assigned K_MS3_PIN to an unused En_MS3_PIN."
420
+#endif
421
+#if AUTO_ASSIGNED_K_DIAG
422
+  #if K_USE_ENDSTOP == _XMIN_
423
+    #warning "Auto-assigned K_DIAG_PIN to X_MIN_PIN."
424
+  #elif K_USE_ENDSTOP == _XMAX_
425
+    #warning "Auto-assigned K_DIAG_PIN to X_MAX_PIN."
426
+  #elif K_USE_ENDSTOP == _YMIN_
427
+    #warning "Auto-assigned K_DIAG_PIN to Y_MIN_PIN."
428
+  #elif K_USE_ENDSTOP == _YMAX_
429
+    #warning "Auto-assigned K_DIAG_PIN to Y_MAX_PIN."
430
+  #elif K_USE_ENDSTOP == _ZMIN_
431
+    #warning "Auto-assigned K_DIAG_PIN to Z_MIN_PIN."
432
+  #elif K_USE_ENDSTOP == _ZMAX_
433
+    #warning "Auto-assigned K_DIAG_PIN to Z_MAX_PIN."
434
+  #elif K_USE_ENDSTOP == _XDIAG_
435
+    #warning "Auto-assigned K_DIAG_PIN to X_DIAG_PIN."
436
+  #elif K_USE_ENDSTOP == _YDIAG_
437
+    #warning "Auto-assigned K_DIAG_PIN to Y_DIAG_PIN."
438
+  #elif K_USE_ENDSTOP == _ZDIAG_
439
+    #warning "Auto-assigned K_DIAG_PIN to Z_DIAG_PIN."
440
+  #elif K_USE_ENDSTOP == _E0DIAG_
441
+    #warning "Auto-assigned K_DIAG_PIN to E0_DIAG_PIN."
442
+  #elif K_USE_ENDSTOP == _E1DIAG_
443
+    #warning "Auto-assigned K_DIAG_PIN to E1_DIAG_PIN."
444
+  #elif K_USE_ENDSTOP == _E2DIAG_
445
+    #warning "Auto-assigned K_DIAG_PIN to E2_DIAG_PIN."
446
+  #elif K_USE_ENDSTOP == _E3DIAG_
447
+    #warning "Auto-assigned K_DIAG_PIN to E3_DIAG_PIN."
448
+  #elif K_USE_ENDSTOP == _E4DIAG_
449
+    #warning "Auto-assigned K_DIAG_PIN to E4_DIAG_PIN."
450
+  #elif K_USE_ENDSTOP == _E5DIAG_
451
+    #warning "Auto-assigned K_DIAG_PIN to E5_DIAG_PIN."
452
+  #elif K_USE_ENDSTOP == _E6DIAG_
453
+    #warning "Auto-assigned K_DIAG_PIN to E6_DIAG_PIN."
454
+  #elif K_USE_ENDSTOP == _E7DIAG_
455
+    #warning "Auto-assigned K_DIAG_PIN to E7_DIAG_PIN."
456
+  #endif
457
+#endif

+ 191
- 70
Marlin/src/pins/pins_postprocess.h 查看文件

@@ -542,6 +542,7 @@
542 542
 #define __EPIN(p,q) E##p##_##q##_PIN
543 543
 #define _EPIN(p,q) __EPIN(p,q)
544 544
 #define DIAG_REMAPPED(p,q) (PIN_EXISTS(q) && _EPIN(p##_E_INDEX, DIAG) == q##_PIN)
545
+#define _En_DIAG_(p) _E##p##_DIAG_
545 546
 
546 547
 // The E0/E1 steppers are always used for Dual E
547 548
 #if ENABLED(E_DUAL_STEPPER_DRIVERS)
@@ -554,6 +555,11 @@
554 555
 #endif
555 556
 
556 557
 // The X2 axis, if any, should be the next open extruder port
558
+#if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS) && !defined(X2_DIAG_PIN) && !defined(X2_STEP_PIN) && !PIN_EXISTS(X2_CS_PIN)
559
+  #define Y2_E_INDEX INCREMENT(X2_E_INDEX)
560
+#else
561
+  #define Y2_E_INDEX X2_E_INDEX
562
+#endif
557 563
 #if EITHER(DUAL_X_CARRIAGE, X_DUAL_STEPPER_DRIVERS)
558 564
   #ifndef X2_STEP_PIN
559 565
     #define X2_STEP_PIN   _EPIN(X2_E_INDEX, STEP)
@@ -561,19 +567,33 @@
561 567
     #define X2_ENABLE_PIN _EPIN(X2_E_INDEX, ENABLE)
562 568
     #if X2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(X2_STEP)
563 569
       #error "No E stepper plug left for X2!"
570
+    #else
571
+      #define AUTO_ASSIGNED_X2_STEPPER 1
564 572
     #endif
565 573
   #endif
566 574
   #ifndef X2_MS1_PIN
567 575
     #define X2_MS1_PIN    _EPIN(X2_E_INDEX, MS1)
576
+    #if PIN_EXISTS(X2_MS1)
577
+      #define AUTO_ASSIGNED_X2_MS1 1
578
+    #endif
568 579
   #endif
569 580
   #ifndef X2_MS2_PIN
570 581
     #define X2_MS2_PIN    _EPIN(X2_E_INDEX, MS2)
582
+    #if PIN_EXISTS(X2_MS2)
583
+      #define AUTO_ASSIGNED_X2_MS2 1
584
+    #endif
571 585
   #endif
572 586
   #ifndef X2_MS3_PIN
573 587
     #define X2_MS3_PIN    _EPIN(X2_E_INDEX, MS3)
588
+    #if PIN_EXISTS(X2_MS3)
589
+      #define AUTO_ASSIGNED_X2_MS3 1
590
+    #endif
574 591
   #endif
575 592
   #if AXIS_HAS_SPI(X2) && !defined(X2_CS_PIN)
576 593
     #define X2_CS_PIN     _EPIN(X2_E_INDEX, CS)
594
+    #if PIN_EXISTS(X2_CS)
595
+      #define AUTO_ASSIGNED_X2_CS 1
596
+    #endif
577 597
   #endif
578 598
   #if AXIS_HAS_UART(X2)
579 599
     #ifndef X2_SERIAL_TX_PIN
@@ -587,7 +607,7 @@
587 607
   //
588 608
   // Auto-assign pins for stallGuard sensorless homing
589 609
   //
590
-  #if !defined(X2_USE_ENDSTOP) && defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
610
+  #if !defined(X2_DIAG_PIN) && !defined(X2_USE_ENDSTOP) && defined(X2_STALL_SENSITIVITY) && ENABLED(X_DUAL_ENDSTOPS) && _PEXI(X2_E_INDEX, DIAG)
591 611
     #define X2_DIAG_PIN _EPIN(X2_E_INDEX, DIAG)
592 612
     #if   DIAG_REMAPPED(X2, X_MIN)      // If already remapped in the pins file...
593 613
       #define X2_USE_ENDSTOP _XMIN_
@@ -601,16 +621,12 @@
601 621
       #define X2_USE_ENDSTOP _YMAX_
602 622
     #elif DIAG_REMAPPED(X2, Z_MAX)
603 623
       #define X2_USE_ENDSTOP _ZMAX_
604
-    #else                               // Otherwise use the driver DIAG_PIN directly
605
-      #define _X2_USE_ENDSTOP(P) _E##P##_DIAG_
606
-      #define X2_USE_ENDSTOP _X2_USE_ENDSTOP(X2_E_INDEX)
624
+    #else                               // Otherwise pick the next free En_DIAG_PIN directly
625
+      #define X2_USE_ENDSTOP _En_DIAG_(X2_E_INDEX)
607 626
     #endif
608
-    #undef X2_DIAG_PIN
627
+    #define AUTO_ASSIGNED_X2_DIAG 1
628
+    #undef X2_DIAG_PIN // Defined in Conditionals_post.h based on X2_USE_ENDSTOP
609 629
   #endif
610
-
611
-  #define Y2_E_INDEX INCREMENT(X2_E_INDEX)
612
-#else
613
-  #define Y2_E_INDEX X2_E_INDEX
614 630
 #endif
615 631
 
616 632
 #ifndef X2_CS_PIN
@@ -627,6 +643,11 @@
627 643
 #endif
628 644
 
629 645
 // The Y2 axis, if any, should be the next open extruder port
646
+#if ENABLED(Y_DUAL_STEPPER_DRIVERS) && !defined(Y2_DIAG_PIN) && !defined(Y2_STEP_PIN) && !PIN_EXISTS(Y2_CS_PIN)
647
+  #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
648
+#else
649
+  #define Z2_E_INDEX Y2_E_INDEX
650
+#endif
630 651
 #if ENABLED(Y_DUAL_STEPPER_DRIVERS)
631 652
   #ifndef Y2_STEP_PIN
632 653
     #define Y2_STEP_PIN   _EPIN(Y2_E_INDEX, STEP)
@@ -634,19 +655,33 @@
634 655
     #define Y2_ENABLE_PIN _EPIN(Y2_E_INDEX, ENABLE)
635 656
     #if Y2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Y2_STEP)
636 657
       #error "No E stepper plug left for Y2!"
658
+    #else
659
+      #define AUTO_ASSIGNED_Y2_STEPPER 1
637 660
     #endif
638 661
   #endif
639 662
   #ifndef Y2_MS1_PIN
640 663
     #define Y2_MS1_PIN    _EPIN(Y2_E_INDEX, MS1)
664
+    #if PIN_EXISTS(Y2_MS1)
665
+      #define AUTO_ASSIGNED_Y2_MS1 1
666
+    #endif
641 667
   #endif
642 668
   #ifndef Y2_MS2_PIN
643 669
     #define Y2_MS2_PIN    _EPIN(Y2_E_INDEX, MS2)
670
+    #if PIN_EXISTS(Y2_MS2)
671
+      #define AUTO_ASSIGNED_Y2_MS2 1
672
+    #endif
644 673
   #endif
645 674
   #ifndef Y2_MS3_PIN
646 675
     #define Y2_MS3_PIN    _EPIN(Y2_E_INDEX, MS3)
676
+    #if PIN_EXISTS(Y2_MS3)
677
+      #define AUTO_ASSIGNED_Y2_MS3 1
678
+    #endif
647 679
   #endif
648 680
   #if AXIS_HAS_SPI(Y2) && !defined(Y2_CS_PIN)
649 681
     #define Y2_CS_PIN     _EPIN(Y2_E_INDEX, CS)
682
+    #if PIN_EXISTS(Y2_CS)
683
+      #define AUTO_ASSIGNED_Y2_CS 1
684
+    #endif
650 685
   #endif
651 686
   #if AXIS_HAS_UART(Y2)
652 687
     #ifndef Y2_SERIAL_TX_PIN
@@ -657,7 +692,7 @@
657 692
     #endif
658 693
   #endif
659 694
   // Auto-assign pins for stallGuard sensorless homing
660
-  #if !defined(Y2_USE_ENDSTOP) && defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
695
+  #if !defined(Y2_DIAG_PIN) && !defined(Y2_USE_ENDSTOP) && defined(Y2_STALL_SENSITIVITY) && ENABLED(Y_DUAL_ENDSTOPS) && _PEXI(Y2_E_INDEX, DIAG)
661 696
     #define Y2_DIAG_PIN _EPIN(Y2_E_INDEX, DIAG)
662 697
     #if   DIAG_REMAPPED(Y2, X_MIN)
663 698
       #define Y2_USE_ENDSTOP _XMIN_
@@ -672,14 +707,11 @@
672 707
     #elif DIAG_REMAPPED(Y2, Z_MAX)
673 708
       #define Y2_USE_ENDSTOP _ZMAX_
674 709
     #else
675
-      #define _Y2_USE_ENDSTOP(P) _E##P##_DIAG_
676
-      #define Y2_USE_ENDSTOP _Y2_USE_ENDSTOP(Y2_E_INDEX)
710
+      #define Y2_USE_ENDSTOP _En_DIAG_(Y2_E_INDEX)
677 711
     #endif
678
-    #undef Y2_DIAG_PIN
712
+    #define AUTO_ASSIGNED_Y2_DIAG 1
713
+    #undef Y2_DIAG_PIN // Defined in Conditionals_post.h based on Y2_USE_ENDSTOP
679 714
   #endif
680
-  #define Z2_E_INDEX INCREMENT(Y2_E_INDEX)
681
-#else
682
-  #define Z2_E_INDEX Y2_E_INDEX
683 715
 #endif
684 716
 
685 717
 #ifndef Y2_CS_PIN
@@ -696,6 +728,11 @@
696 728
 #endif
697 729
 
698 730
 // The Z2 axis, if any, should be the next open extruder port
731
+#if NUM_Z_STEPPER_DRIVERS >= 2 && !defined(Z2_DIAG_PIN) && !defined(Z2_STEP_PIN) && !PIN_EXISTS(Z2_CS_PIN)
732
+  #define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
733
+#else
734
+  #define Z3_E_INDEX Z2_E_INDEX
735
+#endif
699 736
 #if NUM_Z_STEPPER_DRIVERS >= 2
700 737
   #ifndef Z2_STEP_PIN
701 738
     #define Z2_STEP_PIN   _EPIN(Z2_E_INDEX, STEP)
@@ -703,19 +740,33 @@
703 740
     #define Z2_ENABLE_PIN _EPIN(Z2_E_INDEX, ENABLE)
704 741
     #if Z2_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z2_STEP)
705 742
       #error "No E stepper plug left for Z2!"
743
+    #else
744
+      #define AUTO_ASSIGNED_Z2_STEPPER 1
706 745
     #endif
707 746
   #endif
708 747
   #ifndef Z2_MS1_PIN
709 748
     #define Z2_MS1_PIN    _EPIN(Z2_E_INDEX, MS1)
749
+    #if PIN_EXISTS(Z2_MS1)
750
+      #define AUTO_ASSIGNED_Z2_MS1 1
751
+    #endif
710 752
   #endif
711 753
   #ifndef Z2_MS2_PIN
712 754
     #define Z2_MS2_PIN    _EPIN(Z2_E_INDEX, MS2)
755
+    #if PIN_EXISTS(Z2_MS2)
756
+      #define AUTO_ASSIGNED_Z2_MS2 1
757
+    #endif
713 758
   #endif
714 759
   #ifndef Z2_MS3_PIN
715 760
     #define Z2_MS3_PIN    _EPIN(Z2_E_INDEX, MS3)
761
+    #if PIN_EXISTS(Z2_MS3)
762
+      #define AUTO_ASSIGNED_Z2_MS3 1
763
+    #endif
716 764
   #endif
717 765
   #if AXIS_HAS_SPI(Z2) && !defined(Z2_CS_PIN)
718 766
     #define Z2_CS_PIN     _EPIN(Z2_E_INDEX, CS)
767
+    #if PIN_EXISTS(Z2_CS)
768
+      #define AUTO_ASSIGNED_Z2_CS 1
769
+    #endif
719 770
   #endif
720 771
   #if AXIS_HAS_UART(Z2)
721 772
     #ifndef Z2_SERIAL_TX_PIN
@@ -726,7 +777,7 @@
726 777
     #endif
727 778
   #endif
728 779
   // Auto-assign pins for stallGuard sensorless homing
729
-  #if !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
780
+  #if !defined(Z2_DIAG_PIN) && !defined(Z2_USE_ENDSTOP) && defined(Z2_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 2 && _PEXI(Z2_E_INDEX, DIAG)
730 781
     #define Z2_DIAG_PIN _EPIN(Z2_E_INDEX, DIAG)
731 782
     #if   DIAG_REMAPPED(Z2, X_MIN)
732 783
       #define Z2_USE_ENDSTOP _XMIN_
@@ -741,14 +792,11 @@
741 792
     #elif DIAG_REMAPPED(Z2, Z_MAX)
742 793
       #define Z2_USE_ENDSTOP _ZMAX_
743 794
     #else
744
-      #define _Z2_USE_ENDSTOP(P) _E##P##_DIAG_
745
-      #define Z2_USE_ENDSTOP _Z2_USE_ENDSTOP(Z2_E_INDEX)
795
+      #define Z2_USE_ENDSTOP _En_DIAG_(Z2_E_INDEX)
746 796
     #endif
747
-    #undef Z2_DIAG_PIN
797
+    #define AUTO_ASSIGNED_Z2_DIAG 1
798
+    #undef Z2_DIAG_PIN // Defined in Conditionals_post.h based on Z2_USE_ENDSTOP
748 799
   #endif
749
-  #define Z3_E_INDEX INCREMENT(Z2_E_INDEX)
750
-#else
751
-  #define Z3_E_INDEX Z2_E_INDEX
752 800
 #endif
753 801
 
754 802
 #ifndef Z2_CS_PIN
@@ -764,6 +812,12 @@
764 812
   #define Z2_MS3_PIN -1
765 813
 #endif
766 814
 
815
+// The Z3 axis, if any, should be the next open extruder port
816
+#if NUM_Z_STEPPER_DRIVERS >= 3 && !defined(Z3_DIAG_PIN) && !defined(Z3_STEP_PIN) && !PIN_EXISTS(Z3_CS_PIN)
817
+  #define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
818
+#else
819
+  #define Z4_E_INDEX Z3_E_INDEX
820
+#endif
767 821
 #if NUM_Z_STEPPER_DRIVERS >= 3
768 822
   #ifndef Z3_STEP_PIN
769 823
     #define Z3_STEP_PIN   _EPIN(Z3_E_INDEX, STEP)
@@ -771,21 +825,33 @@
771 825
     #define Z3_ENABLE_PIN _EPIN(Z3_E_INDEX, ENABLE)
772 826
     #if Z3_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z3_STEP)
773 827
       #error "No E stepper plug left for Z3!"
828
+    #else
829
+      #define AUTO_ASSIGNED_Z3_STEPPER 1
774 830
     #endif
775 831
   #endif
776
-  #if AXIS_HAS_SPI(Z3)
777
-    #ifndef Z3_CS_PIN
778
-      #define Z3_CS_PIN   _EPIN(Z3_E_INDEX, CS)
832
+  #if AXIS_HAS_SPI(Z3) && !defined(Z3_CS_PIN)
833
+    #define Z3_CS_PIN     _EPIN(Z3_E_INDEX, CS)
834
+    #if PIN_EXISTS(Z3_CS)
835
+      #define AUTO_ASSIGNED_Z3_CS 1
779 836
     #endif
780 837
   #endif
781 838
   #ifndef Z3_MS1_PIN
782 839
     #define Z3_MS1_PIN    _EPIN(Z3_E_INDEX, MS1)
840
+    #if PIN_EXISTS(Z3_MS1)
841
+      #define AUTO_ASSIGNED_Z3_MS1 1
842
+    #endif
783 843
   #endif
784 844
   #ifndef Z3_MS2_PIN
785 845
     #define Z3_MS2_PIN    _EPIN(Z3_E_INDEX, MS2)
846
+    #if PIN_EXISTS(Z3_MS2)
847
+      #define AUTO_ASSIGNED_Z3_MS2 1
848
+    #endif
786 849
   #endif
787 850
   #ifndef Z3_MS3_PIN
788 851
     #define Z3_MS3_PIN    _EPIN(Z3_E_INDEX, MS3)
852
+    #if PIN_EXISTS(Z3_MS3)
853
+      #define AUTO_ASSIGNED_Z3_MS3 1
854
+    #endif
789 855
   #endif
790 856
   #if AXIS_HAS_UART(Z3)
791 857
     #ifndef Z3_SERIAL_TX_PIN
@@ -796,7 +862,7 @@
796 862
     #endif
797 863
   #endif
798 864
   // Auto-assign pins for stallGuard sensorless homing
799
-  #if !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
865
+  #if !defined(Z3_DIAG_PIN) && !defined(Z3_USE_ENDSTOP) && defined(Z3_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3 && _PEXI(Z3_E_INDEX, DIAG)
800 866
     #define Z3_DIAG_PIN _EPIN(Z3_E_INDEX, DIAG)
801 867
     #if   DIAG_REMAPPED(Z3, X_MIN)
802 868
       #define Z3_USE_ENDSTOP _XMIN_
@@ -811,14 +877,11 @@
811 877
     #elif DIAG_REMAPPED(Z3, Z_MAX)
812 878
       #define Z3_USE_ENDSTOP _ZMAX_
813 879
     #else
814
-      #define _Z3_USE_ENDSTOP(P) _E##P##_DIAG_
815
-      #define Z3_USE_ENDSTOP _Z3_USE_ENDSTOP(Z3_E_INDEX)
880
+      #define Z3_USE_ENDSTOP _En_DIAG_(Z3_E_INDEX)
816 881
     #endif
817
-    #undef Z3_DIAG_PIN
882
+    #define AUTO_ASSIGNED_Z3_DIAG 1
883
+    #undef Z3_DIAG_PIN // Defined in Conditionals_post.h based on Z3_USE_ENDSTOP
818 884
   #endif
819
-  #define Z4_E_INDEX INCREMENT(Z3_E_INDEX)
820
-#else
821
-  #define Z4_E_INDEX Z3_E_INDEX
822 885
 #endif
823 886
 
824 887
 #ifndef Z3_CS_PIN
@@ -834,6 +897,12 @@
834 897
   #define Z3_MS3_PIN -1
835 898
 #endif
836 899
 
900
+// The Z4 axis, if any, should be the next open extruder port
901
+#if NUM_Z_STEPPER_DRIVERS >= 4 && !defined(Z4_DIAG_PIN) && !defined(Z4_STEP_PIN) && !PIN_EXISTS(Z4_CS_PIN)
902
+  #define I_E_INDEX INCREMENT(Z4_E_INDEX)
903
+#else
904
+  #define I_E_INDEX Z4_E_INDEX
905
+#endif
837 906
 #if NUM_Z_STEPPER_DRIVERS >= 4
838 907
   #ifndef Z4_STEP_PIN
839 908
     #define Z4_STEP_PIN   _EPIN(Z4_E_INDEX, STEP)
@@ -841,21 +910,33 @@
841 910
     #define Z4_ENABLE_PIN _EPIN(Z4_E_INDEX, ENABLE)
842 911
     #if Z4_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(Z4_STEP)
843 912
       #error "No E stepper plug left for Z4!"
913
+    #else
914
+      #define AUTO_ASSIGNED_Z4_STEPPER 1
844 915
     #endif
845 916
   #endif
846
-  #if AXIS_HAS_SPI(Z4)
847
-    #ifndef Z4_CS_PIN
848
-      #define Z4_CS_PIN     _EPIN(Z4_E_INDEX, CS)
917
+  #if AXIS_HAS_SPI(Z4) && !defined(Z4_CS_PIN)
918
+    #define Z4_CS_PIN     _EPIN(Z4_E_INDEX, CS)
919
+    #if PIN_EXISTS(Z4_CS)
920
+      #define AUTO_ASSIGNED_Z4_CS 1
849 921
     #endif
850 922
   #endif
851 923
   #ifndef Z4_MS1_PIN
852 924
     #define Z4_MS1_PIN    _EPIN(Z4_E_INDEX, MS1)
925
+    #if PIN_EXISTS(Z4_MS1)
926
+      #define AUTO_ASSIGNED_Z4_MS1 1
927
+    #endif
853 928
   #endif
854 929
   #ifndef Z4_MS2_PIN
855 930
     #define Z4_MS2_PIN    _EPIN(Z4_E_INDEX, MS2)
931
+    #if PIN_EXISTS(Z4_MS2)
932
+      #define AUTO_ASSIGNED_Z4_MS2 1
933
+    #endif
856 934
   #endif
857 935
   #ifndef Z4_MS3_PIN
858 936
     #define Z4_MS3_PIN    _EPIN(Z4_E_INDEX, MS3)
937
+    #if PIN_EXISTS(Z4_MS3)
938
+      #define AUTO_ASSIGNED_Z4_MS3 1
939
+    #endif
859 940
   #endif
860 941
   #if AXIS_HAS_UART(Z4)
861 942
     #ifndef Z4_SERIAL_TX_PIN
@@ -866,7 +947,7 @@
866 947
     #endif
867 948
   #endif
868 949
   // Auto-assign pins for stallGuard sensorless homing
869
-  #if !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
950
+  #if !defined(Z4_DIAG_PIN) && !defined(Z4_USE_ENDSTOP) && defined(Z4_STALL_SENSITIVITY) && ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && _PEXI(Z4_E_INDEX, DIAG)
870 951
     #define Z4_DIAG_PIN _EPIN(Z4_E_INDEX, DIAG)
871 952
     #if   DIAG_REMAPPED(Z4, X_MIN)
872 953
       #define Z4_USE_ENDSTOP _XMIN_
@@ -881,14 +962,11 @@
881 962
     #elif DIAG_REMAPPED(Z4, Z_MAX)
882 963
       #define Z4_USE_ENDSTOP _ZMAX_
883 964
     #else
884
-      #define _Z4_USE_ENDSTOP(P) _E##P##_DIAG_
885
-      #define Z4_USE_ENDSTOP _Z4_USE_ENDSTOP(Z4_E_INDEX)
965
+      #define Z4_USE_ENDSTOP _En_DIAG_(Z4_E_INDEX)
886 966
     #endif
887
-    #undef Z4_DIAG_PIN
967
+    #define AUTO_ASSIGNED_Z4_DIAG 1
968
+    #undef Z4_DIAG_PIN // Defined in Conditionals_post.h based on Z4_USE_ENDSTOP
888 969
   #endif
889
-  #define I_E_INDEX INCREMENT(Z4_E_INDEX)
890
-#else
891
-  #define I_E_INDEX Z4_E_INDEX
892 970
 #endif
893 971
 
894 972
 #ifndef Z4_CS_PIN
@@ -904,6 +982,12 @@
904 982
   #define Z4_MS3_PIN -1
905 983
 #endif
906 984
 
985
+// The I axis, if any, should be the next open extruder port
986
+#if LINEAR_AXES >= 4 && !defined(I_DIAG_PIN) && !defined(I_STEP_PIN) && !PIN_EXISTS(I_CS_PIN)
987
+  #define J_E_INDEX INCREMENT(I_E_INDEX)
988
+#else
989
+  #define J_E_INDEX I_E_INDEX
990
+#endif
907 991
 #if LINEAR_AXES >= 4
908 992
   #ifndef I_STEP_PIN
909 993
     #define I_STEP_PIN   _EPIN(I_E_INDEX, STEP)
@@ -911,21 +995,33 @@
911 995
     #define I_ENABLE_PIN _EPIN(I_E_INDEX, ENABLE)
912 996
     #if I_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(I_STEP)
913 997
       #error "No E stepper plug left for I!"
998
+    #else
999
+      #define AUTO_ASSIGNED_I_STEPPER 1
914 1000
     #endif
915 1001
   #endif
916
-  #if AXIS_HAS_SPI(I)
917
-    #ifndef I_CS_PIN
918
-      #define I_CS_PIN   _EPIN(I_E_INDEX, CS)
1002
+  #if AXIS_HAS_SPI(I) && !defined(I_CS_PIN)
1003
+    #define I_CS_PIN     _EPIN(I_E_INDEX, CS)
1004
+    #if PIN_EXISTS(I_CS)
1005
+      #define AUTO_ASSIGNED_I_CS 1
919 1006
     #endif
920 1007
   #endif
921 1008
   #ifndef I_MS1_PIN
922 1009
     #define I_MS1_PIN    _EPIN(I_E_INDEX, MS1)
1010
+    #if PIN_EXISTS(I_MS1)
1011
+      #define AUTO_ASSIGNED_I_MS1 1
1012
+    #endif
923 1013
   #endif
924 1014
   #ifndef I_MS2_PIN
925 1015
     #define I_MS2_PIN    _EPIN(I_E_INDEX, MS2)
1016
+    #if PIN_EXISTS(I_MS2)
1017
+      #define AUTO_ASSIGNED_I_MS2 1
1018
+    #endif
926 1019
   #endif
927 1020
   #ifndef I_MS3_PIN
928 1021
     #define I_MS3_PIN    _EPIN(I_E_INDEX, MS3)
1022
+    #if PIN_EXISTS(I_MS3)
1023
+      #define AUTO_ASSIGNED_I_MS3 1
1024
+    #endif
929 1025
   #endif
930 1026
   #if AXIS_HAS_UART(I)
931 1027
     #ifndef I_SERIAL_TX_PIN
@@ -936,7 +1032,7 @@
936 1032
     #endif
937 1033
   #endif
938 1034
   // Auto-assign pins for stallGuard sensorless homing
939
-  #if !defined(I_USE_ENDSTOP) && defined(I_STALL_SENSITIVITY) && _PEXI(I_E_INDEX, DIAG)
1035
+  #if !defined(I_DIAG_PIN) && !defined(I_USE_ENDSTOP) && defined(I_STALL_SENSITIVITY) && _PEXI(I_E_INDEX, DIAG)
940 1036
     #define I_DIAG_PIN _EPIN(I_E_INDEX, DIAG)
941 1037
     #if   DIAG_REMAPPED(I, X_MIN)
942 1038
       #define I_USE_ENDSTOP _XMIN_
@@ -951,14 +1047,11 @@
951 1047
     #elif DIAG_REMAPPED(I, Z_MAX)
952 1048
       #define I_USE_ENDSTOP _ZMAX_
953 1049
     #else
954
-      #define _I_USE_ENDSTOP(P) _E##P##_DIAG_
955
-      #define I_USE_ENDSTOP _I_USE_ENDSTOP(I_E_INDEX)
1050
+      #define I_USE_ENDSTOP _En_DIAG_(I_E_INDEX)
956 1051
     #endif
957
-    #undef I_DIAG_PIN
1052
+    #define AUTO_ASSIGNED_I_DIAG 1
1053
+    #undef I_DIAG_PIN // Defined in Conditionals_post.h based on I_USE_ENDSTOP
958 1054
   #endif
959
-  #define J_E_INDEX INCREMENT(I_E_INDEX)
960
-#else
961
-  #define J_E_INDEX I_E_INDEX
962 1055
 #endif
963 1056
 
964 1057
 #ifndef I_CS_PIN
@@ -974,6 +1067,12 @@
974 1067
   #define I_MS3_PIN -1
975 1068
 #endif
976 1069
 
1070
+// The J axis, if any, should be the next open extruder port
1071
+#if LINEAR_AXES >= 5 && !defined(J_DIAG_PIN) && !defined(J_STEP_PIN) && !PIN_EXISTS(J_CS_PIN)
1072
+  #define K_E_INDEX INCREMENT(J_E_INDEX)
1073
+#else
1074
+  #define K_E_INDEX J_E_INDEX
1075
+#endif
977 1076
 #if LINEAR_AXES >= 5
978 1077
   #ifndef J_STEP_PIN
979 1078
     #define J_STEP_PIN   _EPIN(J_E_INDEX, STEP)
@@ -981,21 +1080,33 @@
981 1080
     #define J_ENABLE_PIN _EPIN(J_E_INDEX, ENABLE)
982 1081
     #if I_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(J_STEP)
983 1082
       #error "No E stepper plug left for J!"
1083
+    #else
1084
+      #define AUTO_ASSIGNED_J_STEPPER 1
984 1085
     #endif
985 1086
   #endif
986
-  #if AXIS_HAS_SPI(J)
987
-    #ifndef J_CS_PIN
988
-      #define J_CS_PIN   _EPIN(J_E_INDEX, CS)
1087
+  #if AXIS_HAS_SPI(J) && !defined(J_CS_PIN)
1088
+    #define J_CS_PIN     _EPIN(J_E_INDEX, CS)
1089
+    #if PIN_EXISTS(J_CS)
1090
+      #define AUTO_ASSIGNED_J_CS 1
989 1091
     #endif
990 1092
   #endif
991 1093
   #ifndef J_MS1_PIN
992 1094
     #define J_MS1_PIN    _EPIN(J_E_INDEX, MS1)
1095
+    #if PIN_EXISTS(J_MS1)
1096
+      #define AUTO_ASSIGNED_J_MS1 1
1097
+    #endif
993 1098
   #endif
994 1099
   #ifndef J_MS2_PIN
995 1100
     #define J_MS2_PIN    _EPIN(J_E_INDEX, MS2)
1101
+    #if PIN_EXISTS(J_MS2)
1102
+      #define AUTO_ASSIGNED_J_MS2 1
1103
+    #endif
996 1104
   #endif
997 1105
   #ifndef J_MS3_PIN
998 1106
     #define J_MS3_PIN    _EPIN(J_E_INDEX, MS3)
1107
+    #if PIN_EXISTS(J_MS3)
1108
+      #define AUTO_ASSIGNED_J_MS3 1
1109
+    #endif
999 1110
   #endif
1000 1111
   #if AXIS_HAS_UART(J)
1001 1112
     #ifndef J_SERIAL_TX_PIN
@@ -1006,7 +1117,7 @@
1006 1117
     #endif
1007 1118
   #endif
1008 1119
   // Auto-assign pins for stallGuard sensorless homing
1009
-  #if !defined(J_USE_ENDSTOP) && defined(J_STALL_SENSITIVITY) && _PEXI(J_E_INDEX, DIAG)
1120
+  #if !defined(J_DIAG_PIN) && !defined(J_USE_ENDSTOP) && defined(J_STALL_SENSITIVITY) && _PEXI(J_E_INDEX, DIAG)
1010 1121
     #define J_DIAG_PIN _EPIN(J_E_INDEX, DIAG)
1011 1122
     #if   DIAG_REMAPPED(J, X_MIN)
1012 1123
       #define J_USE_ENDSTOP _XMIN_
@@ -1021,14 +1132,11 @@
1021 1132
     #elif DIAG_REMAPPED(I, Z_MAX)
1022 1133
       #define J_USE_ENDSTOP _ZMAX_
1023 1134
     #else
1024
-      #define _J_USE_ENDSTOP(P) _E##P##_DIAG_
1025
-      #define J_USE_ENDSTOP _J_USE_ENDSTOP(J_E_INDEX)
1135
+      #define J_USE_ENDSTOP _En_DIAG_(J_E_INDEX)
1026 1136
     #endif
1027
-    #undef J_DIAG_PIN
1137
+    #define AUTO_ASSIGNED_J_DIAG 1
1138
+    #undef J_DIAG_PIN // Defined in Conditionals_post.h based on J_USE_ENDSTOP
1028 1139
   #endif
1029
-  #define K_E_INDEX INCREMENT(J_E_INDEX)
1030
-#else
1031
-  #define K_E_INDEX J_E_INDEX
1032 1140
 #endif
1033 1141
 
1034 1142
 #ifndef J_CS_PIN
@@ -1044,6 +1152,7 @@
1044 1152
   #define J_MS3_PIN -1
1045 1153
 #endif
1046 1154
 
1155
+// The K axis, if any, should be the next open extruder port
1047 1156
 #if LINEAR_AXES >= 6
1048 1157
   #ifndef K_STEP_PIN
1049 1158
     #define K_STEP_PIN   _EPIN(K_E_INDEX, STEP)
@@ -1051,21 +1160,33 @@
1051 1160
     #define K_ENABLE_PIN _EPIN(K_E_INDEX, ENABLE)
1052 1161
     #if K_E_INDEX >= MAX_E_STEPPERS || !PIN_EXISTS(K_STEP)
1053 1162
       #error "No E stepper plug left for K!"
1163
+    #else
1164
+      #define AUTO_ASSIGNED_K_STEPPER 1
1054 1165
     #endif
1055 1166
   #endif
1056
-  #if AXIS_HAS_SPI(K)
1057
-    #ifndef K_CS_PIN
1058
-      #define K_CS_PIN   _EPIN(K_E_INDEX, CS)
1167
+  #if AXIS_HAS_SPI(K) && !defined(K_CS_PIN)
1168
+    #define K_CS_PIN     _EPIN(K_E_INDEX, CS)
1169
+    #if PIN_EXISTS(K_CS)
1170
+      #define AUTO_ASSIGNED_K_CS 1
1059 1171
     #endif
1060 1172
   #endif
1061 1173
   #ifndef K_MS1_PIN
1062 1174
     #define K_MS1_PIN    _EPIN(K_E_INDEX, MS1)
1175
+    #if PIN_EXISTS(K_MS1)
1176
+      #define AUTO_ASSIGNED_K_MS1 1
1177
+    #endif
1063 1178
   #endif
1064 1179
   #ifndef K_MS2_PIN
1065 1180
     #define K_MS2_PIN    _EPIN(K_E_INDEX, MS2)
1181
+    #if PIN_EXISTS(K_MS2)
1182
+      #define AUTO_ASSIGNED_K_MS2 1
1183
+    #endif
1066 1184
   #endif
1067 1185
   #ifndef K_MS3_PIN
1068 1186
     #define K_MS3_PIN    _EPIN(K_E_INDEX, MS3)
1187
+    #if PIN_EXISTS(K_MS3)
1188
+      #define AUTO_ASSIGNED_K_MS3 1
1189
+    #endif
1069 1190
   #endif
1070 1191
   #if AXIS_HAS_UART(K)
1071 1192
     #ifndef K_SERIAL_TX_PIN
@@ -1076,7 +1197,7 @@
1076 1197
     #endif
1077 1198
   #endif
1078 1199
   // Auto-assign pins for stallGuard sensorless homing
1079
-  #if !defined(K_USE_ENDSTOP) && defined(K_STALL_SENSITIVITY) && _PEXI(K_E_INDEX, DIAG)
1200
+  #if !defined(K_DIAG_PIN) && !defined(K_USE_ENDSTOP) && defined(K_STALL_SENSITIVITY) && _PEXI(K_E_INDEX, DIAG)
1080 1201
     #define K_DIAG_PIN _EPIN(K_E_INDEX, DIAG)
1081 1202
     #if   DIAG_REMAPPED(K, X_MIN)
1082 1203
       #define K_USE_ENDSTOP _XMIN_
@@ -1091,10 +1212,10 @@
1091 1212
     #elif DIAG_REMAPPED(K, Z_MAX)
1092 1213
       #define K_USE_ENDSTOP _ZMAX_
1093 1214
     #else
1094
-      #define _K_USE_ENDSTOP(P) _E##P##_DIAG_
1095
-      #define K_USE_ENDSTOP _K_USE_ENDSTOP(K_E_INDEX)
1215
+      #define K_USE_ENDSTOP _En_DIAG_(K_E_INDEX)
1096 1216
     #endif
1097
-    #undef K_DIAG_PIN
1217
+    #define AUTO_ASSIGNED_K_DIAG 1
1218
+    #undef K_DIAG_PIN // Defined in Conditionals_post.h based on K_USE_ENDSTOP
1098 1219
   #endif
1099 1220
 #endif
1100 1221
 

+ 12
- 5
buildroot/share/PlatformIO/scripts/preflight-checks.py 查看文件

@@ -76,13 +76,20 @@ def sanity_check_target():
76 76
 				raise SystemExit(err)
77 77
 
78 78
 	#
79
+	# Give warnings on every build
80
+	#
81
+	warnfile = os.path.join(env['PROJECT_BUILD_DIR'], build_env, "src", "src", "inc", "Warnings.cpp.o")
82
+	if os.path.exists(warnfile):
83
+		os.remove(warnfile)
84
+
85
+	#
79 86
 	# Check for old files indicating an entangled Marlin (mixing old and new code)
80 87
 	#
81 88
 	mixedin = []
82
-	for p in [ os.path.join(env['PROJECT_DIR'], "Marlin/src/lcd/dogm") ]:
83
-		for f in [ "ultralcd_DOGM.cpp", "ultralcd_DOGM.h" ]:
84
-			if os.path.isfile(os.path.join(p, f)):
85
-				mixedin += [ f ]
89
+	p = os.path.join(env['PROJECT_DIR'], "Marlin", "src", "lcd", "dogm")
90
+	for f in [ "ultralcd_DOGM.cpp", "ultralcd_DOGM.h" ]:
91
+		if os.path.isfile(os.path.join(p, f)):
92
+			mixedin += [ f ]
86 93
 	if mixedin:
87 94
 		err = "ERROR: Old files fell into your Marlin folder. Remove %s and try again" % ", ".join(mixedin)
88 95
 		raise SystemExit(err)
@@ -90,4 +97,4 @@ def sanity_check_target():
90 97
 # Detect that 'vscode init' is running
91 98
 from SCons.Script import COMMAND_LINE_TARGETS
92 99
 if "idedata" not in COMMAND_LINE_TARGETS:
93
-    sanity_check_target()
100
+	sanity_check_target()

正在加载...
取消
保存