Переглянути джерело

Simplify macro expansion with recursion (#21859)

Scott Lahteine 4 роки тому
джерело
коміт
e5dc2c5321
Аккаунт користувача з таким Email не знайдено
3 змінених файлів з 55 додано та 157 видалено
  1. 14
    22
      Marlin/src/core/macros.h
  2. 39
    133
      Marlin/src/core/serial.h
  3. 2
    2
      Marlin/src/module/settings.cpp

+ 14
- 22
Marlin/src/core/macros.h Переглянути файл

301
 #define HYPOT(x,y)  SQRT(HYPOT2(x,y))
301
 #define HYPOT(x,y)  SQRT(HYPOT2(x,y))
302
 
302
 
303
 // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
303
 // Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
304
-#define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
305
-#define NUM_ARGS(V...) _NUM_ARGS(0,V,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
304
+#define _NUM_ARGS(_,n,m,l,k,j,i,h,g,f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
305
+#define NUM_ARGS(V...) _NUM_ARGS(0,V,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
306
+
307
+// Use TWO_ARGS(__VA_ARGS__) to get whether there are 1, 2, or >2 arguments
308
+#define _TWO_ARGS(_,n,m,l,k,j,i,h,g,f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
309
+#define TWO_ARGS(V...) _TWO_ARGS(0,V,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,1,0)
306
 
310
 
307
 #ifdef __cplusplus
311
 #ifdef __cplusplus
308
 
312
 
414
 
418
 
415
 #else
419
 #else
416
 
420
 
417
-  #define MIN_2(a,b)      ((a)<(b)?(a):(b))
418
-  #define MIN_3(a,V...)   MIN_2(a,MIN_2(V))
419
-  #define MIN_4(a,V...)   MIN_2(a,MIN_3(V))
420
-  #define MIN_5(a,V...)   MIN_2(a,MIN_4(V))
421
-  #define MIN_6(a,V...)   MIN_2(a,MIN_5(V))
422
-  #define MIN_7(a,V...)   MIN_2(a,MIN_6(V))
423
-  #define MIN_8(a,V...)   MIN_2(a,MIN_7(V))
424
-  #define MIN_9(a,V...)   MIN_2(a,MIN_8(V))
425
-  #define MIN_10(a,V...)  MIN_2(a,MIN_9(V))
426
   #define __MIN_N(N,V...) MIN_##N(V)
421
   #define __MIN_N(N,V...) MIN_##N(V)
427
   #define _MIN_N(N,V...)  __MIN_N(N,V)
422
   #define _MIN_N(N,V...)  __MIN_N(N,V)
428
-  #define _MIN(V...)      _MIN_N(NUM_ARGS(V), V)
423
+  #define _MIN_N_REF()    _MIN_N
424
+  #define _MIN(V...)      EVAL(_MIN_N(TWO_ARGS(V),V))
425
+  #define MIN_2(a,b)      ((a)<(b)?(a):(b))
426
+  #define MIN_3(a,V...)   MIN_2(a,DEFER2(_MIN_N_REF)()(TWO_ARGS(V),V))
429
 
427
 
430
-  #define MAX_2(a,b)      ((a)>(b)?(a):(b))
431
-  #define MAX_3(a,V...)   MAX_2(a,MAX_2(V))
432
-  #define MAX_4(a,V...)   MAX_2(a,MAX_3(V))
433
-  #define MAX_5(a,V...)   MAX_2(a,MAX_4(V))
434
-  #define MAX_6(a,V...)   MAX_2(a,MAX_5(V))
435
-  #define MAX_7(a,V...)   MAX_2(a,MAX_6(V))
436
-  #define MAX_8(a,V...)   MAX_2(a,MAX_7(V))
437
-  #define MAX_9(a,V...)   MAX_2(a,MAX_8(V))
438
-  #define MAX_10(a,V...)  MAX_2(a,MAX_9(V))
439
   #define __MAX_N(N,V...) MAX_##N(V)
428
   #define __MAX_N(N,V...) MAX_##N(V)
440
   #define _MAX_N(N,V...)  __MAX_N(N,V)
429
   #define _MAX_N(N,V...)  __MAX_N(N,V)
441
-  #define _MAX(V...)      _MAX_N(NUM_ARGS(V), V)
430
+  #define _MAX_N_REF()    _MAX_N
431
+  #define _MAX(V...)      EVAL(_MAX_N(TWO_ARGS(V),V))
432
+  #define MAX_2(a,b)      ((a)>(b)?(a):(b))
433
+  #define MAX_3(a,V...)   MAX_2(a,DEFER2(_MAX_N_REF)()(TWO_ARGS(V),V))
442
 
434
 
443
 #endif
435
 #endif
444
 
436
 

+ 39
- 133
Marlin/src/core/serial.h Переглянути файл

182
 // Print a single PROGMEM string to serial
182
 // Print a single PROGMEM string to serial
183
 void serialprintPGM(PGM_P str);
183
 void serialprintPGM(PGM_P str);
184
 
184
 
185
-// SERIAL_ECHOPAIR / SERIAL_ECHOPAIR_P is used to output a key value pair. The key must be a string and the value can be anything
186
-// Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR().
187
-#define __SEP_N(N,V...)   _SEP_##N(V)
188
-#define _SEP_N(N,V...)    __SEP_N(N,V)
189
-#define _SEP_1(PRE)       SERIAL_ECHOPGM(PRE)
190
-#define _SEP_2(PRE,V)     serial_echopair_PGM(PSTR(PRE),V)
191
-#define _SEP_3(a,b,c)     do{ _SEP_2(a,b); SERIAL_ECHOPGM(c); }while(0)
192
-#define _SEP_4(a,b,V...)  do{ _SEP_2(a,b); _SEP_2(V); }while(0)
193
-#define _SEP_5(a,b,V...)  do{ _SEP_2(a,b); _SEP_3(V); }while(0)
194
-#define _SEP_6(a,b,V...)  do{ _SEP_2(a,b); _SEP_4(V); }while(0)
195
-#define _SEP_7(a,b,V...)  do{ _SEP_2(a,b); _SEP_5(V); }while(0)
196
-#define _SEP_8(a,b,V...)  do{ _SEP_2(a,b); _SEP_6(V); }while(0)
197
-#define _SEP_9(a,b,V...)  do{ _SEP_2(a,b); _SEP_7(V); }while(0)
198
-#define _SEP_10(a,b,V...) do{ _SEP_2(a,b); _SEP_8(V); }while(0)
199
-#define _SEP_11(a,b,V...) do{ _SEP_2(a,b); _SEP_9(V); }while(0)
200
-#define _SEP_12(a,b,V...) do{ _SEP_2(a,b); _SEP_10(V); }while(0)
201
-#define _SEP_13(a,b,V...) do{ _SEP_2(a,b); _SEP_11(V); }while(0)
202
-#define _SEP_14(a,b,V...) do{ _SEP_2(a,b); _SEP_12(V); }while(0)
203
-#define _SEP_15(a,b,V...) do{ _SEP_2(a,b); _SEP_13(V); }while(0)
204
-#define _SEP_16(a,b,V...) do{ _SEP_2(a,b); _SEP_14(V); }while(0)
205
-#define _SEP_17(a,b,V...) do{ _SEP_2(a,b); _SEP_15(V); }while(0)
206
-#define _SEP_18(a,b,V...) do{ _SEP_2(a,b); _SEP_16(V); }while(0)
207
-#define _SEP_19(a,b,V...) do{ _SEP_2(a,b); _SEP_17(V); }while(0)
208
-#define _SEP_20(a,b,V...) do{ _SEP_2(a,b); _SEP_18(V); }while(0)
209
-#define _SEP_21(a,b,V...) do{ _SEP_2(a,b); _SEP_19(V); }while(0)
210
-#define _SEP_22(a,b,V...) do{ _SEP_2(a,b); _SEP_20(V); }while(0)
211
-#define _SEP_23(a,b,V...) do{ _SEP_2(a,b); _SEP_21(V); }while(0)
212
-#define _SEP_24(a,b,V...) do{ _SEP_2(a,b); _SEP_22(V); }while(0)
213
-
214
-#define SERIAL_ECHOPAIR(V...) _SEP_N(NUM_ARGS(V),V)
215
-
216
-// Print up to 12 pairs of values. Odd elements must be PSTR pointers.
217
-#define __SEP_N_P(N,V...)   _SEP_##N##_P(V)
218
-#define _SEP_N_P(N,V...)    __SEP_N_P(N,V)
219
-#define _SEP_1_P(PRE)       serialprintPGM(PRE)
220
-#define _SEP_2_P(PRE,V)     serial_echopair_PGM(PRE,V)
221
-#define _SEP_3_P(a,b,c)     do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0)
222
-#define _SEP_4_P(a,b,V...)  do{ _SEP_2_P(a,b); _SEP_2_P(V); }while(0)
223
-#define _SEP_5_P(a,b,V...)  do{ _SEP_2_P(a,b); _SEP_3_P(V); }while(0)
224
-#define _SEP_6_P(a,b,V...)  do{ _SEP_2_P(a,b); _SEP_4_P(V); }while(0)
225
-#define _SEP_7_P(a,b,V...)  do{ _SEP_2_P(a,b); _SEP_5_P(V); }while(0)
226
-#define _SEP_8_P(a,b,V...)  do{ _SEP_2_P(a,b); _SEP_6_P(V); }while(0)
227
-#define _SEP_9_P(a,b,V...)  do{ _SEP_2_P(a,b); _SEP_7_P(V); }while(0)
228
-#define _SEP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_8_P(V); }while(0)
229
-#define _SEP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_9_P(V); }while(0)
230
-#define _SEP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_10_P(V); }while(0)
231
-#define _SEP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_11_P(V); }while(0)
232
-#define _SEP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_12_P(V); }while(0)
233
-#define _SEP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_13_P(V); }while(0)
234
-#define _SEP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_14_P(V); }while(0)
235
-#define _SEP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_15_P(V); }while(0)
236
-#define _SEP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_16_P(V); }while(0)
237
-#define _SEP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_17_P(V); }while(0)
238
-#define _SEP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_18_P(V); }while(0)
239
-#define _SEP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_19_P(V); }while(0)
240
-#define _SEP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_20_P(V); }while(0)
241
-#define _SEP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_21_P(V); }while(0)
242
-#define _SEP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_22_P(V); }while(0)
243
-
244
-// SERIAL_ECHOPAIR_P is used to output a key value pair. Unlike SERIAL_ECHOPAIR, the key must be a PGM string already and the value can be anything
245
-#define SERIAL_ECHOPAIR_P(V...) _SEP_N_P(NUM_ARGS(V),V)
246
-
247
-// Print up to 12 pairs of values followed by newline
248
-#define __SELP_N(N,V...)   _SELP_##N(V)
249
-#define _SELP_N(N,V...)    __SELP_N(N,V)
250
-#define _SELP_1(PRE)       SERIAL_ECHOLNPGM(PRE)
251
-#define _SELP_2(PRE,V)     do{ serial_echopair_PGM(PSTR(PRE),V); SERIAL_EOL(); }while(0)
252
-#define _SELP_3(a,b,c)     do{ _SEP_2(a,b); SERIAL_ECHOLNPGM(c); }while(0)
253
-#define _SELP_4(a,b,V...)  do{ _SEP_2(a,b); _SELP_2(V); }while(0)
254
-#define _SELP_5(a,b,V...)  do{ _SEP_2(a,b); _SELP_3(V); }while(0)
255
-#define _SELP_6(a,b,V...)  do{ _SEP_2(a,b); _SELP_4(V); }while(0)
256
-#define _SELP_7(a,b,V...)  do{ _SEP_2(a,b); _SELP_5(V); }while(0)
257
-#define _SELP_8(a,b,V...)  do{ _SEP_2(a,b); _SELP_6(V); }while(0)
258
-#define _SELP_9(a,b,V...)  do{ _SEP_2(a,b); _SELP_7(V); }while(0)
259
-#define _SELP_10(a,b,V...) do{ _SEP_2(a,b); _SELP_8(V); }while(0)
260
-#define _SELP_11(a,b,V...) do{ _SEP_2(a,b); _SELP_9(V); }while(0)
261
-#define _SELP_12(a,b,V...) do{ _SEP_2(a,b); _SELP_10(V); }while(0)
262
-#define _SELP_13(a,b,V...) do{ _SEP_2(a,b); _SELP_11(V); }while(0)
263
-#define _SELP_14(a,b,V...) do{ _SEP_2(a,b); _SELP_12(V); }while(0)
264
-#define _SELP_15(a,b,V...) do{ _SEP_2(a,b); _SELP_13(V); }while(0)
265
-#define _SELP_16(a,b,V...) do{ _SEP_2(a,b); _SELP_14(V); }while(0)
266
-#define _SELP_17(a,b,V...) do{ _SEP_2(a,b); _SELP_15(V); }while(0)
267
-#define _SELP_18(a,b,V...) do{ _SEP_2(a,b); _SELP_16(V); }while(0)
268
-#define _SELP_19(a,b,V...) do{ _SEP_2(a,b); _SELP_17(V); }while(0)
269
-#define _SELP_20(a,b,V...) do{ _SEP_2(a,b); _SELP_18(V); }while(0)
270
-#define _SELP_21(a,b,V...) do{ _SEP_2(a,b); _SELP_19(V); }while(0)
271
-#define _SELP_22(a,b,V...) do{ _SEP_2(a,b); _SELP_20(V); }while(0)
272
-#define _SELP_23(a,b,V...) do{ _SEP_2(a,b); _SELP_21(V); }while(0)
273
-#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0)
274
-#define _SELP_25(a,b,V...) do{ _SEP_2(a,b); _SELP_23(V); }while(0)
275
-#define _SELP_26(a,b,V...) do{ _SEP_2(a,b); _SELP_24(V); }while(0)
276
-#define _SELP_27(a,b,V...) do{ _SEP_2(a,b); _SELP_25(V); }while(0)
277
-#define _SELP_28(a,b,V...) do{ _SEP_2(a,b); _SELP_26(V); }while(0)
278
-#define _SELP_29(a,b,V...) do{ _SEP_2(a,b); _SELP_27(V); }while(0)
279
-#define _SELP_30(a,b,V...) do{ _SEP_2(a,b); _SELP_28(V); }while(0) // Eat two args, pass the rest up
280
-
281
-#define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V)
282
-
283
-// Print up to 12 pairs of values followed by newline
284
-#define __SELP_N_P(N,V...)   _SELP_##N##_P(V)
285
-#define _SELP_N_P(N,V...)    __SELP_N_P(N,V)
286
-#define _SELP_1_P(PRE)       serialprintPGM(PRE)
287
-#define _SELP_2_P(PRE,V)     do{ serial_echopair_PGM(PRE,V); SERIAL_EOL(); }while(0)
288
-#define _SELP_3_P(a,b,c)     do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0)
289
-#define _SELP_4_P(a,b,V...)  do{ _SEP_2_P(a,b); _SELP_2_P(V); }while(0)
290
-#define _SELP_5_P(a,b,V...)  do{ _SEP_2_P(a,b); _SELP_3_P(V); }while(0)
291
-#define _SELP_6_P(a,b,V...)  do{ _SEP_2_P(a,b); _SELP_4_P(V); }while(0)
292
-#define _SELP_7_P(a,b,V...)  do{ _SEP_2_P(a,b); _SELP_5_P(V); }while(0)
293
-#define _SELP_8_P(a,b,V...)  do{ _SEP_2_P(a,b); _SELP_6_P(V); }while(0)
294
-#define _SELP_9_P(a,b,V...)  do{ _SEP_2_P(a,b); _SELP_7_P(V); }while(0)
295
-#define _SELP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_8_P(V); }while(0)
296
-#define _SELP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_9_P(V); }while(0)
297
-#define _SELP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_10_P(V); }while(0)
298
-#define _SELP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_11_P(V); }while(0)
299
-#define _SELP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_12_P(V); }while(0)
300
-#define _SELP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_13_P(V); }while(0)
301
-#define _SELP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_14_P(V); }while(0)
302
-#define _SELP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_15_P(V); }while(0)
303
-#define _SELP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_16_P(V); }while(0)
304
-#define _SELP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_17_P(V); }while(0)
305
-#define _SELP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_18_P(V); }while(0)
306
-#define _SELP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_19_P(V); }while(0)
307
-#define _SELP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_20_P(V); }while(0)
308
-#define _SELP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_21_P(V); }while(0)
309
-#define _SELP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_22_P(V); }while(0)
310
-#define _SELP_25_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_23_P(V); }while(0)
311
-#define _SELP_26_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_24_P(V); }while(0)
312
-#define _SELP_27_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_25_P(V); }while(0)
313
-#define _SELP_28_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_26_P(V); }while(0)
314
-#define _SELP_29_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_27_P(V); }while(0)
315
-#define _SELP_30_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_28_P(V); }while(0) // Eat two args, pass the rest up
316
-
317
-#define SERIAL_ECHOLNPAIR_P(V...) _SELP_N_P(NUM_ARGS(V),V)
185
+//
186
+// SERIAL_ECHOPAIR... macros are used to output string-value pairs.
187
+//
188
+
189
+// Print up to 20 pairs of values. Odd elements must be literal strings.
190
+#define __SEP_N(N,V...)           _SEP_##N(V)
191
+#define _SEP_N(N,V...)            __SEP_N(N,V)
192
+#define _SEP_N_REF()              _SEP_N
193
+#define _SEP_1(s)                 SERIAL_ECHOPGM(s);
194
+#define _SEP_2(s,v)               serial_echopair_PGM(PSTR(s),v);
195
+#define _SEP_3(s,v,V...)          _SEP_2(s,v); DEFER2(_SEP_N_REF)()(TWO_ARGS(V),V);
196
+#define SERIAL_ECHOPAIR(V...)     do{ EVAL(_SEP_N(TWO_ARGS(V),V)); }while(0)
197
+
198
+// Print up to 20 pairs of values followed by newline. Odd elements must be literal strings.
199
+#define __SELP_N(N,V...)          _SELP_##N(V)
200
+#define _SELP_N(N,V...)           __SELP_N(N,V)
201
+#define _SELP_N_REF()             _SELP_N
202
+#define _SELP_1(s)                SERIAL_ECHOLNPGM(s);
203
+#define _SELP_2(s,v)              serial_echopair_PGM(PSTR(s),v); SERIAL_EOL();
204
+#define _SELP_3(s,v,V...)         _SEP_2(s,v); DEFER2(_SELP_N_REF)()(TWO_ARGS(V),V);
205
+#define SERIAL_ECHOLNPAIR(V...)   do{ EVAL(_SELP_N(TWO_ARGS(V),V)); }while(0)
206
+
207
+// Print up to 20 pairs of values. Odd elements must be PSTR pointers.
208
+#define __SEP_N_P(N,V...)         _SEP_##N##_P(V)
209
+#define _SEP_N_P(N,V...)          __SEP_N_P(N,V)
210
+#define _SEP_N_P_REF()            _SEP_N_P
211
+#define _SEP_1_P(s)               serialprintPGM(s);
212
+#define _SEP_2_P(s,v)             serial_echopair_PGM(s,v);
213
+#define _SEP_3_P(s,v,V...)        _SEP_2_P(s,v); DEFER(_SEP_N_P_REF)()(TWO_ARGS(V),V);
214
+#define SERIAL_ECHOPAIR_P(V...)   do{ EVAL(_SEP_N_P(TWO_ARGS(V),V)); }while(0)
215
+
216
+// Print up to 20 pairs of values followed by newline. Odd elements must be PSTR pointers.
217
+#define __SELP_N_P(N,V...)        _SELP_##N##_P(V)
218
+#define _SELP_N_P(N,V...)         __SELP_N_P(N,V)
219
+#define _SELP_N_P_REF()           _SELP_N_P
220
+#define _SELP_1_P(s)              { serialprintPGM(s); SERIAL_EOL(); }
221
+#define _SELP_2_P(s,v)            { serial_echopair_PGM(s,v); SERIAL_EOL(); }
222
+#define _SELP_3_P(s,v,V...)       { _SEP_2_P(s,v); DEFER(_SELP_N_P_REF)()(TWO_ARGS(V),V); }
223
+#define SERIAL_ECHOLNPAIR_P(V...) do{ EVAL(_SELP_N_P(TWO_ARGS(V),V)); }while(0)
318
 
224
 
319
 #ifdef AllowDifferentTypeInList
225
 #ifdef AllowDifferentTypeInList
320
 
226
 

+ 2
- 2
Marlin/src/module/settings.cpp Переглянути файл

3880
         say_M603(forReplay);
3880
         say_M603(forReplay);
3881
         SERIAL_ECHOLNPAIR("L", LINEAR_UNIT(fc_settings[0].load_length), " U", LINEAR_UNIT(fc_settings[0].unload_length));
3881
         SERIAL_ECHOLNPAIR("L", LINEAR_UNIT(fc_settings[0].load_length), " U", LINEAR_UNIT(fc_settings[0].unload_length));
3882
       #else
3882
       #else
3883
-        #define _ECHO_603(N) do{ say_M603(forReplay); SERIAL_ECHOLNPAIR("T" STRINGIFY(N) " L", LINEAR_UNIT(fc_settings[N].load_length), " U", LINEAR_UNIT(fc_settings[N].unload_length)); }while(0);
3884
-        REPEAT(EXTRUDERS, _ECHO_603)
3883
+        auto echo_603 = [](const bool f, const uint8_t n) { say_M603(f); SERIAL_ECHOLNPAIR("T", n, " L", LINEAR_UNIT(fc_settings[n].load_length), " U", LINEAR_UNIT(fc_settings[n].unload_length)); };
3884
+        LOOP_L_N(i, EXTRUDERS) echo_603(forReplay, i);
3885
       #endif
3885
       #endif
3886
     #endif
3886
     #endif
3887
 
3887
 

Завантаження…
Відмінити
Зберегти