forked from MarlinFirmware/Marlin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Conditionals_adv.h
1130 lines (1039 loc) · 34.6 KB
/
Conditionals_adv.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* Conditionals_adv.h
* Conditionals set before pins.h and which depend on Configuration_adv.h.
*/
#ifndef AXIS_RELATIVE_MODES
#define AXIS_RELATIVE_MODES {}
#endif
#ifdef SWITCHING_NOZZLE_E1_SERVO_NR
#define SWITCHING_NOZZLE_TWO_SERVOS 1
#endif
// Determine NUM_SERVOS if none was supplied
#ifndef NUM_SERVOS
#define NUM_SERVOS 0
#if ANY(HAS_Z_SERVO_PROBE, CHAMBER_VENT, SWITCHING_TOOLHEAD, SWITCHING_EXTRUDER, SWITCHING_NOZZLE, SPINDLE_SERVO)
#if NUM_SERVOS <= Z_PROBE_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (Z_PROBE_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= CHAMBER_VENT_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (CHAMBER_VENT_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= SWITCHING_TOOLHEAD_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_TOOLHEAD_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= SWITCHING_NOZZLE_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_NOZZLE_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= SWITCHING_NOZZLE_E1_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_NOZZLE_E1_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= SWITCHING_EXTRUDER_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_EXTRUDER_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= SWITCHING_EXTRUDER_E23_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SWITCHING_EXTRUDER_E23_SERVO_NR + 1)
#endif
#if NUM_SERVOS <= SPINDLE_SERVO_NR
#undef NUM_SERVOS
#define NUM_SERVOS (SPINDLE_SERVO_NR + 1)
#endif
#endif
#endif
// Convenience override for a BLTouch alone
#if ENABLED(BLTOUCH) && NUM_SERVOS == 1
#undef SERVO_DELAY
#define SERVO_DELAY { 50 }
#endif
#if !HAS_STOWABLE_PROBE
#undef PROBE_DEPLOY_STOW_MENU
#endif
#if !HAS_EXTRUDERS
#define NO_VOLUMETRICS
#undef TEMP_SENSOR_0
#undef TEMP_SENSOR_1
#undef TEMP_SENSOR_2
#undef TEMP_SENSOR_3
#undef TEMP_SENSOR_4
#undef TEMP_SENSOR_5
#undef TEMP_SENSOR_6
#undef TEMP_SENSOR_7
#undef FWRETRACT
#undef PIDTEMP
#undef AUTOTEMP
#undef PID_EXTRUSION_SCALING
#undef LIN_ADVANCE
#undef FILAMENT_RUNOUT_SENSOR
#undef ADVANCED_PAUSE_FEATURE
#undef FILAMENT_RUNOUT_DISTANCE_MM
#undef FILAMENT_LOAD_UNLOAD_GCODES
#undef DISABLE_INACTIVE_EXTRUDER
#undef FILAMENT_LOAD_UNLOAD_GCODES
#undef EXTRUDER_RUNOUT_PREVENT
#undef PREVENT_COLD_EXTRUSION
#undef PREVENT_LENGTHY_EXTRUDE
#undef THERMAL_PROTECTION_HOTENDS
#undef THERMAL_PROTECTION_PERIOD
#undef WATCH_TEMP_PERIOD
#undef SHOW_TEMP_ADC_VALUES
#undef LCD_SHOW_E_TOTAL
#undef MANUAL_E_MOVES_RELATIVE
#undef STEALTHCHOP_E
#endif
#if HOTENDS <= 7
#undef E7_AUTO_FAN_PIN
#if HOTENDS <= 6
#undef E6_AUTO_FAN_PIN
#if HOTENDS <= 5
#undef E5_AUTO_FAN_PIN
#if HOTENDS <= 4
#undef E4_AUTO_FAN_PIN
#if HOTENDS <= 3
#undef E3_AUTO_FAN_PIN
#if HOTENDS <= 2
#undef E2_AUTO_FAN_PIN
#if HOTENDS <= 1
#undef E1_AUTO_FAN_PIN
#if HOTENDS == 0
#undef E0_AUTO_FAN_PIN
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
/**
* Temperature Sensors; define what sensor(s) we have.
*/
// Temperature sensor IDs
#define HID_REDUNDANT -6
#define HID_BOARD -5
#define HID_COOLER -4
#define HID_PROBE -3
#define HID_CHAMBER -2
#define HID_BED -1
#define HID_E0 0
#define HID_E1 1
#define HID_E2 2
#define HID_E3 3
#define HID_E4 4
#define HID_E5 5
#define HID_E6 6
#define HID_E7 7
#define _SENSOR_IS(I,N) || (TEMP_SENSOR(N) == I)
#define _E_SENSOR_IS(I,N) _SENSOR_IS(N,I)
#define ANY_E_SENSOR_IS(N) (0 REPEAT2(HOTENDS, _E_SENSOR_IS, N))
#define ANY_THERMISTOR_IS(N) ( ANY_E_SENSOR_IS(N) \
_SENSOR_IS(N,BED) _SENSOR_IS(N,PROBE) _SENSOR_IS(N,CHAMBER) \
_SENSOR_IS(N,COOLER) _SENSOR_IS(N,BOARD) _SENSOR_IS(N,REDUNDANT) )
#if ANY_THERMISTOR_IS(1000)
#define HAS_USER_THERMISTORS 1
#endif
#if TEMP_SENSOR_REDUNDANT
#define _HEATER_ID(M) HID_##M
#define HEATER_ID(M) _HEATER_ID(M)
#define REDUNDANT_TEMP_MATCH(M,N) (HEATER_ID(TEMP_SENSOR_REDUNDANT_##M) == _HEATER_ID(N))
#else
#define REDUNDANT_TEMP_MATCH(...) 0
#endif
#if TEMP_SENSOR_IS_MAX_TC(0)
#if TEMP_SENSOR_0 == -5
#define TEMP_SENSOR_0_IS_MAX31865 1
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
#ifndef MAX31865_SENSOR_WIRES_0
#define MAX31865_SENSOR_WIRES_0 2
#endif
#ifndef MAX31865_WIRE_OHMS_0
#define MAX31865_WIRE_OHMS_0 0.0f
#endif
#elif TEMP_SENSOR_0 == -3
#define TEMP_SENSOR_0_IS_MAX31855 1
#define TEMP_SENSOR_0_MAX_TC_TMIN -270
#define TEMP_SENSOR_0_MAX_TC_TMAX 1800
#elif TEMP_SENSOR_0 == -2
#define TEMP_SENSOR_0_IS_MAX6675 1
#define TEMP_SENSOR_0_MAX_TC_TMIN 0
#define TEMP_SENSOR_0_MAX_TC_TMAX 1024
#endif
#elif TEMP_SENSOR_0 == -4
#define TEMP_SENSOR_0_IS_AD8495 1
#elif TEMP_SENSOR_0 == -1
#define TEMP_SENSOR_0_IS_AD595 1
#elif TEMP_SENSOR_0 > 0
#define TEMP_SENSOR_0_IS_THERMISTOR 1
#if TEMP_SENSOR_0 == 1000
#define TEMP_SENSOR_0_IS_CUSTOM 1
#elif TEMP_SENSOR_0 == 998 || TEMP_SENSOR_0 == 999
#define TEMP_SENSOR_0_IS_DUMMY 1
#endif
#else
#undef HEATER_0_MINTEMP
#undef HEATER_0_MAXTEMP
#endif
#if TEMP_SENSOR_IS_MAX_TC(1)
#if TEMP_SENSOR_1 == -5
#define TEMP_SENSOR_1_IS_MAX31865 1
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
#ifndef MAX31865_SENSOR_WIRES_1
#define MAX31865_SENSOR_WIRES_1 2
#endif
#ifndef MAX31865_WIRE_OHMS_1
#define MAX31865_WIRE_OHMS_1 0.0f
#endif
#elif TEMP_SENSOR_1 == -3
#define TEMP_SENSOR_1_IS_MAX31855 1
#define TEMP_SENSOR_1_MAX_TC_TMIN -270
#define TEMP_SENSOR_1_MAX_TC_TMAX 1800
#elif TEMP_SENSOR_1 == -2
#define TEMP_SENSOR_1_IS_MAX6675 1
#define TEMP_SENSOR_1_MAX_TC_TMIN 0
#define TEMP_SENSOR_1_MAX_TC_TMAX 1024
#endif
#if TEMP_SENSOR_1 != TEMP_SENSOR_0
#if TEMP_SENSOR_1 == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_1 == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_1 == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_1 then TEMP_SENSOR_0 must match."
#endif
#endif
#elif TEMP_SENSOR_1 == -4
#define TEMP_SENSOR_1_IS_AD8495 1
#elif TEMP_SENSOR_1 == -1
#define TEMP_SENSOR_1_IS_AD595 1
#elif TEMP_SENSOR_1 > 0
#define TEMP_SENSOR_1_IS_THERMISTOR 1
#if TEMP_SENSOR_1 == 1000
#define TEMP_SENSOR_1_IS_CUSTOM 1
#elif TEMP_SENSOR_1 == 998 || TEMP_SENSOR_1 == 999
#define TEMP_SENSOR_1_IS_DUMMY 1
#endif
#else
#undef HEATER_1_MINTEMP
#undef HEATER_1_MAXTEMP
#endif
#if TEMP_SENSOR_IS_MAX_TC(2)
#if TEMP_SENSOR_2 == -5
#define TEMP_SENSOR_2_IS_MAX31865 1
#define TEMP_SENSOR_2_MAX_TC_TMIN 0
#define TEMP_SENSOR_2_MAX_TC_TMAX 1024
#ifndef MAX31865_SENSOR_WIRES_2
#define MAX31865_SENSOR_WIRES_2 2
#endif
#ifndef MAX31865_WIRE_OHMS_2
#define MAX31865_WIRE_OHMS_2 0.0f
#endif
#elif TEMP_SENSOR_2 == -3
#define TEMP_SENSOR_2_IS_MAX31855 1
#define TEMP_SENSOR_2_MAX_TC_TMIN -270
#define TEMP_SENSOR_2_MAX_TC_TMAX 1800
#elif TEMP_SENSOR_2 == -2
#define TEMP_SENSOR_2_IS_MAX6675 1
#define TEMP_SENSOR_2_MAX_TC_TMIN 0
#define TEMP_SENSOR_2_MAX_TC_TMAX 1024
#endif
#if TEMP_SENSOR_2 != TEMP_SENSOR_0
#if TEMP_SENSOR_2 == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_2 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_2 == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_2 then TEMP_SENSOR_0 must match."
#elif TEMP_SENSOR_2 == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_2 then TEMP_SENSOR_0 must match."
#endif
#endif
#elif TEMP_SENSOR_2 == -4
#define TEMP_SENSOR_2_IS_AD8495 1
#elif TEMP_SENSOR_2 == -1
#define TEMP_SENSOR_2_IS_AD595 1
#elif TEMP_SENSOR_2 > 0
#define TEMP_SENSOR_2_IS_THERMISTOR 1
#if TEMP_SENSOR_2 == 1000
#define TEMP_SENSOR_2_IS_CUSTOM 1
#elif TEMP_SENSOR_2 == 998 || TEMP_SENSOR_2 == 999
#define TEMP_SENSOR_2_IS_DUMMY 1
#endif
#else
#undef HEATER_2_MINTEMP
#undef HEATER_2_MAXTEMP
#endif
#if TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
#if TEMP_SENSOR_REDUNDANT == -5
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) && !REDUNDANT_TEMP_MATCH(SOURCE, E2)
#error "MAX31865 Thermocouples (-5) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 (0/1/2)."
#endif
#define TEMP_SENSOR_REDUNDANT_IS_MAX31865 1
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
#elif TEMP_SENSOR_REDUNDANT == -3
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) && !REDUNDANT_TEMP_MATCH(SOURCE, E2)
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 (0/1/2)."
#endif
#define TEMP_SENSOR_REDUNDANT_IS_MAX31855 1
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN -270
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1800
#elif TEMP_SENSOR_REDUNDANT == -2
#if !REDUNDANT_TEMP_MATCH(SOURCE, E0) && !REDUNDANT_TEMP_MATCH(SOURCE, E1) && !REDUNDANT_TEMP_MATCH(SOURCE, E2)
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_REDUNDANT_SOURCE other than TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 (0/1/2)."
#endif
#define TEMP_SENSOR_REDUNDANT_IS_MAX6675 1
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN 0
#define TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX 1024
#endif
// mimic setting up the source TEMP_SENSOR
#if REDUNDANT_TEMP_MATCH(SOURCE, E0)
#define TEMP_SENSOR_0_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
#define TEMP_SENSOR_0_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
#ifndef MAX31865_SENSOR_WIRES_0
#define MAX31865_SENSOR_WIRES_0 2
#endif
#elif REDUNDANT_TEMP_MATCH(SOURCE, E1)
#define TEMP_SENSOR_1_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
#define TEMP_SENSOR_1_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
#ifndef MAX31865_SENSOR_WIRES_1
#define MAX31865_SENSOR_WIRES_1 2
#endif
#elif REDUNDANT_TEMP_MATCH(SOURCE, E2)
#define TEMP_SENSOR_2_MAX_TC_TMIN TEMP_SENSOR_REDUNDANT_MAX_TC_TMIN
#define TEMP_SENSOR_2_MAX_TC_TMAX TEMP_SENSOR_REDUNDANT_MAX_TC_TMAX
#ifndef MAX31865_SENSOR_WIRES_2
#define MAX31865_SENSOR_WIRES_2 2
#endif
#endif
#if (TEMP_SENSOR_IS_MAX_TC(0) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_0) || (TEMP_SENSOR_IS_MAX_TC(1) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_1) || (TEMP_SENSOR_IS_MAX_TC(2) && TEMP_SENSOR_REDUNDANT != TEMP_SENSOR_2)
#if TEMP_SENSOR_REDUNDANT == -5
#error "If MAX31865 Thermocouple (-5) is used for TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -3
#error "If MAX31855 Thermocouple (-3) is used for TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 then TEMP_SENSOR_REDUNDANT must match."
#elif TEMP_SENSOR_REDUNDANT == -2
#error "If MAX6675 Thermocouple (-2) is used for TEMP_SENSOR_0/TEMP_SENSOR_1/TEMP_SENSOR_2 then TEMP_SENSOR_REDUNDANT must match."
#endif
#endif
#elif TEMP_SENSOR_REDUNDANT == -4
#define TEMP_SENSOR_REDUNDANT_IS_AD8495 1
#elif TEMP_SENSOR_REDUNDANT == -1
#define TEMP_SENSOR_REDUNDANT_IS_AD595 1
#elif TEMP_SENSOR_REDUNDANT > 0
#define TEMP_SENSOR_REDUNDANT_IS_THERMISTOR 1
#if TEMP_SENSOR_REDUNDANT == 1000
#define TEMP_SENSOR_REDUNDANT_IS_CUSTOM 1
#elif TEMP_SENSOR_REDUNDANT == 998 || TEMP_SENSOR_REDUNDANT == 999
#error "Dummy sensors are not supported for TEMP_SENSOR_REDUNDANT."
#endif
#endif
#if TEMP_SENSOR_IS_MAX_TC(0) || TEMP_SENSOR_IS_MAX_TC(1) || TEMP_SENSOR_IS_MAX_TC(2) || TEMP_SENSOR_IS_MAX_TC(REDUNDANT)
#define HAS_MAX_TC 1
#endif
#if TEMP_SENSOR_0_IS_MAX6675 || TEMP_SENSOR_1_IS_MAX6675 || TEMP_SENSOR_2_IS_MAX6675 || TEMP_SENSOR_REDUNDANT_IS_MAX6675
#define HAS_MAX6675 1
#endif
#if TEMP_SENSOR_0_IS_MAX31855 || TEMP_SENSOR_1_IS_MAX31855 || TEMP_SENSOR_2_IS_MAX31855 || TEMP_SENSOR_REDUNDANT_IS_MAX31855
#define HAS_MAX31855 1
#endif
#if TEMP_SENSOR_0_IS_MAX31865 || TEMP_SENSOR_1_IS_MAX31865 || TEMP_SENSOR_2_IS_MAX31865 || TEMP_SENSOR_REDUNDANT_IS_MAX31865
#define HAS_MAX31865 1
#endif
#if TEMP_SENSOR_3 == -4
#define TEMP_SENSOR_3_IS_AD8495 1
#elif TEMP_SENSOR_3 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_3."
#elif TEMP_SENSOR_3 == -1
#define TEMP_SENSOR_3_IS_AD595 1
#elif TEMP_SENSOR_3 > 0
#define TEMP_SENSOR_3_IS_THERMISTOR 1
#if TEMP_SENSOR_3 == 1000
#define TEMP_SENSOR_3_IS_CUSTOM 1
#elif TEMP_SENSOR_3 == 998 || TEMP_SENSOR_3 == 999
#define TEMP_SENSOR_3_IS_DUMMY 1
#endif
#else
#undef HEATER_3_MINTEMP
#undef HEATER_3_MAXTEMP
#endif
#if TEMP_SENSOR_4 == -4
#define TEMP_SENSOR_4_IS_AD8495 1
#elif TEMP_SENSOR_4 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_4."
#elif TEMP_SENSOR_4 == -1
#define TEMP_SENSOR_4_IS_AD595 1
#elif TEMP_SENSOR_4 > 0
#define TEMP_SENSOR_4_IS_THERMISTOR 1
#if TEMP_SENSOR_4 == 1000
#define TEMP_SENSOR_4_IS_CUSTOM 1
#elif TEMP_SENSOR_4 == 998 || TEMP_SENSOR_4 == 999
#define TEMP_SENSOR_4_IS_DUMMY 1
#endif
#else
#undef HEATER_4_MINTEMP
#undef HEATER_4_MAXTEMP
#endif
#if TEMP_SENSOR_5 == -4
#define TEMP_SENSOR_5_IS_AD8495 1
#elif TEMP_SENSOR_5 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_5."
#elif TEMP_SENSOR_5 == -1
#define TEMP_SENSOR_5_IS_AD595 1
#elif TEMP_SENSOR_5 > 0
#define TEMP_SENSOR_5_IS_THERMISTOR 1
#if TEMP_SENSOR_5 == 1000
#define TEMP_SENSOR_5_IS_CUSTOM 1
#elif TEMP_SENSOR_5 == 998 || TEMP_SENSOR_5 == 999
#define TEMP_SENSOR_5_IS_DUMMY 1
#endif
#else
#undef HEATER_5_MINTEMP
#undef HEATER_5_MAXTEMP
#endif
#if TEMP_SENSOR_6 == -4
#define TEMP_SENSOR_6_IS_AD8495 1
#elif TEMP_SENSOR_6 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_6."
#elif TEMP_SENSOR_6 == -1
#define TEMP_SENSOR_6_IS_AD595 1
#elif TEMP_SENSOR_6 > 0
#define TEMP_SENSOR_6_IS_THERMISTOR 1
#if TEMP_SENSOR_6 == 1000
#define TEMP_SENSOR_6_IS_CUSTOM 1
#elif TEMP_SENSOR_6 == 998 || TEMP_SENSOR_6 == 999
#define TEMP_SENSOR_6_IS_DUMMY 1
#endif
#else
#undef HEATER_6_MINTEMP
#undef HEATER_6_MAXTEMP
#endif
#if TEMP_SENSOR_7 == -4
#define TEMP_SENSOR_7_IS_AD8495 1
#elif TEMP_SENSOR_7 == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -2
#error "MAX7775 Thermocouples (-2) not supported for TEMP_SENSOR_7."
#elif TEMP_SENSOR_7 == -1
#define TEMP_SENSOR_7_IS_AD595 1
#elif TEMP_SENSOR_7 > 0
#define TEMP_SENSOR_7_IS_THERMISTOR 1
#if TEMP_SENSOR_7 == 1000
#define TEMP_SENSOR_7_IS_CUSTOM 1
#elif TEMP_SENSOR_7 == 998 || TEMP_SENSOR_7 == 999
#define TEMP_SENSOR_7_IS_DUMMY 1
#endif
#else
#undef HEATER_7_MINTEMP
#undef HEATER_7_MAXTEMP
#endif
#if TEMP_SENSOR_BED == -4
#define TEMP_SENSOR_BED_IS_AD8495 1
#elif TEMP_SENSOR_BED == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BED."
#elif TEMP_SENSOR_BED == -1
#define TEMP_SENSOR_BED_IS_AD595 1
#elif TEMP_SENSOR_BED > 0
#define TEMP_SENSOR_BED_IS_THERMISTOR 1
#if TEMP_SENSOR_BED == 1000
#define TEMP_SENSOR_BED_IS_CUSTOM 1
#elif TEMP_SENSOR_BED == 998 || TEMP_SENSOR_BED == 999
#define TEMP_SENSOR_BED_IS_DUMMY 1
#endif
#else
#undef THERMAL_PROTECTION_BED
#undef THERMAL_PROTECTION_BED_PERIOD
#undef BED_MINTEMP
#undef BED_MAXTEMP
#endif
#if TEMP_SENSOR_CHAMBER == -4
#define TEMP_SENSOR_CHAMBER_IS_AD8495 1
#elif TEMP_SENSOR_CHAMBER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_CHAMBER."
#elif TEMP_SENSOR_CHAMBER == -1
#define TEMP_SENSOR_CHAMBER_IS_AD595 1
#elif TEMP_SENSOR_CHAMBER > 0
#define TEMP_SENSOR_CHAMBER_IS_THERMISTOR 1
#if TEMP_SENSOR_CHAMBER == 1000
#define TEMP_SENSOR_CHAMBER_IS_CUSTOM 1
#elif TEMP_SENSOR_CHAMBER == 998 || TEMP_SENSOR_CHAMBER == 999
#define TEMP_SENSOR_CHAMBER_IS_DUMMY 1
#endif
#else
#undef THERMAL_PROTECTION_CHAMBER
#undef CHAMBER_MINTEMP
#undef CHAMBER_MAXTEMP
#endif
#if TEMP_SENSOR_COOLER == -4
#define TEMP_SENSOR_COOLER_IS_AD8495 1
#elif TEMP_SENSOR_COOLER == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_COOLER."
#elif TEMP_SENSOR_COOLER == -1
#define TEMP_SENSOR_COOLER_IS_AD595 1
#elif TEMP_SENSOR_COOLER > 0
#define TEMP_SENSOR_COOLER_IS_THERMISTOR 1
#if TEMP_SENSOR_COOLER == 1000
#define TEMP_SENSOR_COOLER_IS_CUSTOM 1
#elif TEMP_SENSOR_COOLER == 998 || TEMP_SENSOR_COOLER == 999
#define TEMP_SENSOR_COOLER_IS_DUMMY 1
#endif
#else
#undef THERMAL_PROTECTION_COOLER
#undef COOLER_MINTEMP
#undef COOLER_MAXTEMP
#endif
#if TEMP_SENSOR_PROBE == -4
#define TEMP_SENSOR_PROBE_IS_AD8495 1
#elif TEMP_SENSOR_PROBE == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_PROBE."
#elif TEMP_SENSOR_PROBE == -1
#define TEMP_SENSOR_PROBE_IS_AD595 1
#elif TEMP_SENSOR_PROBE > 0
#define TEMP_SENSOR_PROBE_IS_THERMISTOR 1
#if TEMP_SENSOR_PROBE == 1000
#define TEMP_SENSOR_PROBE_IS_CUSTOM 1
#elif TEMP_SENSOR_PROBE == 998 || TEMP_SENSOR_PROBE == 999
#define TEMP_SENSOR_PROBE_IS_DUMMY 1
#endif
#endif
#if TEMP_SENSOR_BOARD == -4
#define TEMP_SENSOR_BOARD_IS_AD8495 1
#elif TEMP_SENSOR_BOARD == -3
#error "MAX31855 Thermocouples (-3) not supported for TEMP_SENSOR_BOARD."
#elif TEMP_SENSOR_BOARD == -2
#error "MAX6675 Thermocouples (-2) not supported for TEMP_SENSOR_BOARD."
#elif TEMP_SENSOR_BOARD == -1
#define TEMP_SENSOR_BOARD_IS_AD595 1
#elif TEMP_SENSOR_BOARD > 0
#define TEMP_SENSOR_BOARD_IS_THERMISTOR 1
#if TEMP_SENSOR_BOARD == 1000
#define TEMP_SENSOR_BOARD_IS_CUSTOM 1
#elif TEMP_SENSOR_BOARD == 998 || TEMP_SENSOR_BOARD == 999
#define TEMP_SENSOR_BOARD_IS_DUMMY 1
#endif
#endif
#if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS))
#define HAS_MIXER_SYNC_CHANNEL 1
#endif
#if EITHER(DUAL_X_CARRIAGE, MULTI_NOZZLE_DUPLICATION)
#define HAS_DUPLICATION_MODE 1
#endif
#if ENABLED(PRINTCOUNTER) && (SERVICE_INTERVAL_1 > 0 || SERVICE_INTERVAL_2 > 0 || SERVICE_INTERVAL_3 > 0)
#define HAS_SERVICE_INTERVALS 1
#endif
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
#define HAS_FILAMENT_SENSOR 1
#if NUM_RUNOUT_SENSORS > 1
#define MULTI_FILAMENT_SENSOR 1
#endif
#ifdef FILAMENT_RUNOUT_DISTANCE_MM
#define HAS_FILAMENT_RUNOUT_DISTANCE 1
#endif
#if ENABLED(MIXING_EXTRUDER)
#define WATCH_ALL_RUNOUT_SENSORS
#endif
#endif
#if ANY(PTC_PROBE, PTC_BED, PTC_HOTEND)
#define HAS_PTC 1
#endif
// Let SD_FINISHED_RELEASECOMMAND stand in for SD_FINISHED_STEPPERRELEASE
#if ENABLED(SD_FINISHED_STEPPERRELEASE)
#ifndef SD_FINISHED_RELEASECOMMAND
#define SD_FINISHED_RELEASECOMMAND "M84" // planner.finish_and_disable()
#endif
#else
#undef SD_FINISHED_RELEASECOMMAND
#endif
#if ENABLED(NO_SD_AUTOSTART)
#undef MENU_ADDAUTOSTART
#endif
#if EITHER(SDSUPPORT, SET_PROGRESS_MANUALLY)
#define HAS_PRINT_PROGRESS 1
#endif
#if DISABLED(SET_PROGRESS_MANUALLY)
#undef SET_REMAINING_TIME
#undef SET_INTERACTION_TIME
#undef M73_REPORT
#endif
#if ANY(HAS_MARLINUI_MENU, ULTIPANEL_FEEDMULTIPLY, SOFT_RESET_ON_KILL)
#define HAS_ENCODER_ACTION 1
#endif
#if STATUS_MESSAGE_TIMEOUT_SEC > 0
#define HAS_STATUS_MESSAGE_TIMEOUT 1
#endif
#if ENABLED(SDSUPPORT) && SD_PROCEDURE_DEPTH
#define HAS_MEDIA_SUBCALLS 1
#endif
#if HAS_PRINT_PROGRESS && EITHER(PRINT_PROGRESS_SHOW_DECIMALS, SHOW_REMAINING_TIME)
#define HAS_PRINT_PROGRESS_PERMYRIAD 1
#endif
#if ANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE)
#define HAS_GAMES 1
#if MANY(MARLIN_BRICKOUT, MARLIN_INVADERS, MARLIN_SNAKE, MARLIN_MAZE)
#define HAS_GAME_MENU 1
#endif
#endif
#if ANY(FWRETRACT, HAS_LEVELING, SKEW_CORRECTION)
#define HAS_POSITION_MODIFIERS 1
#endif
#if ANY(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS, Z_MULTI_ENDSTOPS)
#define HAS_EXTRA_ENDSTOPS 1
#endif
#if EITHER(MIN_SOFTWARE_ENDSTOPS, MAX_SOFTWARE_ENDSTOPS)
#define HAS_SOFTWARE_ENDSTOPS 1
#endif
#if ANY(EXTENSIBLE_UI, IS_NEWPANEL, EMERGENCY_PARSER, HAS_ADC_BUTTONS, HAS_DWIN_E3V2)
#define HAS_RESUME_CONTINUE 1
#endif
#if ANY(BLINKM, RGB_LED, RGBW_LED, PCA9632, PCA9533, NEOPIXEL_LED)
#define HAS_COLOR_LEDS 1
#else
#undef LED_POWEROFF_TIMEOUT
#endif
#if ALL(HAS_RESUME_CONTINUE, PRINTER_EVENT_LEDS, SDSUPPORT)
#define HAS_LEDS_OFF_FLAG 1
#endif
#if DISPLAY_SLEEP_MINUTES || TOUCH_IDLE_SLEEP_MINS
#define HAS_DISPLAY_SLEEP 1
#endif
#if HAS_DISPLAY_SLEEP || LCD_BACKLIGHT_TIMEOUT_MINS
#define HAS_GCODE_M255 1
#endif
#if EITHER(DIGIPOT_MCP4018, DIGIPOT_MCP4451)
#define HAS_MOTOR_CURRENT_I2C 1
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#ifdef Z_STEPPER_ALIGN_STEPPER_XY
#define HAS_Z_STEPPER_ALIGN_STEPPER_XY 1
#undef Z_STEPPER_ALIGN_AMP
#endif
#ifndef Z_STEPPER_ALIGN_AMP
#define Z_STEPPER_ALIGN_AMP 1.0
#endif
#endif
// Multiple Z steppers
#if NUM_Z_STEPPERS < 4
#undef INVERT_Z4_VS_Z_DIR
#if NUM_Z_STEPPERS < 3
#undef INVERT_Z3_VS_Z_DIR
#if NUM_Z_STEPPERS < 2
#undef INVERT_Z2_VS_Z_DIR
#endif
#endif
#endif
#if defined(X2_DRIVER_TYPE) && DISABLED(DUAL_X_CARRIAGE)
#define HAS_DUAL_X_STEPPERS 1
#endif
//
// Spindle/Laser power display types
// Defined here so sanity checks can use them
//
#if EITHER(SPINDLE_FEATURE, LASER_FEATURE)
#define HAS_CUTTER 1
#define _CUTTER_POWER_PWM255 1
#define _CUTTER_POWER_PERCENT 2
#define _CUTTER_POWER_RPM 3
#define _CUTTER_POWER(V) _CAT(_CUTTER_POWER_, V)
#define CUTTER_UNIT_IS(V) (_CUTTER_POWER(CUTTER_POWER_UNIT) == _CUTTER_POWER(V))
#endif
#if !defined(__AVR__) || !defined(USBCON)
// Define constants and variables for buffering serial data.
// Use only 0 or powers of 2 greater than 1
// : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
#ifndef RX_BUFFER_SIZE
#define RX_BUFFER_SIZE 128
#endif
// 256 is the max TX buffer limit due to uint8_t head and tail
// : [0, 4, 8, 16, 32, 64, 128, 256]
#ifndef TX_BUFFER_SIZE
#define TX_BUFFER_SIZE 32
#endif
#else
// SERIAL_XON_XOFF not supported on USB-native devices
#undef SERIAL_XON_XOFF
#endif
#if ENABLED(HOST_PROMPT_SUPPORT) && DISABLED(EMERGENCY_PARSER)
#define HAS_GCODE_M876 1
#endif
#if ENABLED(HOST_ACTION_COMMANDS)
#ifndef ACTION_ON_PAUSE
#define ACTION_ON_PAUSE "pause"
#endif
#ifndef ACTION_ON_PAUSED
#define ACTION_ON_PAUSED "paused"
#endif
#ifndef ACTION_ON_RESUME
#define ACTION_ON_RESUME "resume"
#endif
#ifndef ACTION_ON_RESUMED
#define ACTION_ON_RESUMED "resumed"
#endif
#ifndef ACTION_ON_CANCEL
#define ACTION_ON_CANCEL "cancel"
#endif
#ifndef ACTION_ON_START
#define ACTION_ON_START "start"
#endif
#ifndef ACTION_ON_KILL
#define ACTION_ON_KILL "poweroff"
#endif
#ifndef SHUTDOWN_ACTION
#define SHUTDOWN_ACTION "shutdown"
#endif
#if HAS_FILAMENT_SENSOR
#ifndef ACTION_ON_FILAMENT_RUNOUT
#define ACTION_ON_FILAMENT_RUNOUT "filament_runout"
#endif
#ifndef ACTION_REASON_ON_FILAMENT_RUNOUT
#define ACTION_REASON_ON_FILAMENT_RUNOUT "filament_runout"
#endif
#endif
#if ENABLED(G29_RETRY_AND_RECOVER)
#ifndef ACTION_ON_G29_RECOVER
#define ACTION_ON_G29_RECOVER "probe_rewipe"
#endif
#ifndef ACTION_ON_G29_FAILURE
#define ACTION_ON_G29_FAILURE "probe_failed"
#endif
#endif
#endif
#if EITHER(FYSETC_MINI_12864_2_1, FYSETC_242_OLED_12864)
#ifndef LED_USER_PRESET_GREEN
#define LED_USER_PRESET_GREEN 128
#endif
#ifndef LED_USER_PRESET_BLUE
#define LED_USER_PRESET_BLUE 0
#endif
#ifndef LED_USER_PRESET_BRIGHTNESS
#define LED_USER_PRESET_BRIGHTNESS 255
#endif
#endif
// Set defaults for unspecified LED user colors
#if ENABLED(LED_CONTROL_MENU)
#ifndef LED_USER_PRESET_RED
#define LED_USER_PRESET_RED 255
#endif
#ifndef LED_USER_PRESET_GREEN
#define LED_USER_PRESET_GREEN 255
#endif
#ifndef LED_USER_PRESET_BLUE
#define LED_USER_PRESET_BLUE 255
#endif
#ifndef LED_USER_PRESET_WHITE
#define LED_USER_PRESET_WHITE 0
#endif
#ifndef LED_USER_PRESET_BRIGHTNESS
#ifdef NEOPIXEL_BRIGHTNESS
#define LED_USER_PRESET_BRIGHTNESS NEOPIXEL_BRIGHTNESS
#else
#define LED_USER_PRESET_BRIGHTNESS 255
#endif
#endif
#endif
#if BOTH(LED_CONTROL_MENU, NEOPIXEL2_SEPARATE)
#ifndef LED2_USER_PRESET_RED
#define LED2_USER_PRESET_RED 255
#endif
#ifndef LED2_USER_PRESET_GREEN
#define LED2_USER_PRESET_GREEN 255
#endif
#ifndef LED2_USER_PRESET_BLUE
#define LED2_USER_PRESET_BLUE 255
#endif
#ifndef LED2_USER_PRESET_WHITE
#define LED2_USER_PRESET_WHITE 0
#endif
#ifndef LED2_USER_PRESET_BRIGHTNESS
#ifdef NEOPIXEL2_BRIGHTNESS
#define LED2_USER_PRESET_BRIGHTNESS NEOPIXEL2_BRIGHTNESS
#else
#define LED2_USER_PRESET_BRIGHTNESS 255
#endif
#endif
#endif
// Full Touch Screen needs 'tft/xpt2046'
#if EITHER(TFT_TOUCH_DEVICE_XPT2046, HAS_TFT_LVGL_UI)
#define HAS_TFT_XPT2046 1
#endif
// Touch Screen or "Touch Buttons" need XPT2046 pins
// but they use different components
#if HAS_TFT_XPT2046 || HAS_RES_TOUCH_BUTTONS
#define NEED_TOUCH_PINS 1
#endif
// Extensible UI pin mapping for RepRapDiscount
#if ENABLED(TOUCH_UI_FTDI_EVE) && ANY(AO_EXP1_PINMAP, AO_EXP2_PINMAP, CR10_TFT_PINMAP)
#define TOUCH_UI_ULTIPANEL 1
#endif
// Poll-based jogging for joystick and other devices
#if ENABLED(JOYSTICK)
#define POLL_JOG
#endif
#if X2_HOME_DIR > 0
#define X2_HOME_TO_MAX 1
#elif X2_HOME_DIR < 0
#define X2_HOME_TO_MIN 1
#endif
#ifndef HOMING_BUMP_MM
#define HOMING_BUMP_MM { 0, 0, 0 }
#endif
#if ENABLED(USB_FLASH_DRIVE_SUPPORT) && NONE(USE_OTG_USB_HOST, USE_UHS3_USB)
#define USE_UHS2_USB
#endif
/**
* Driver Timings (in nanoseconds)
* NOTE: Driver timing order is longest-to-shortest duration.
* Preserve this ordering when adding new drivers.
*/
#ifndef MINIMUM_STEPPER_POST_DIR_DELAY
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_POST_DIR_DELAY 15000
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_POST_DIR_DELAY 1500
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_POST_DIR_DELAY 650
#elif HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_POST_DIR_DELAY 500
#elif HAS_DRIVER(A5984)
#define MINIMUM_STEPPER_POST_DIR_DELAY 400
#elif HAS_DRIVER(A4988)
#define MINIMUM_STEPPER_POST_DIR_DELAY 200
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MINIMUM_STEPPER_POST_DIR_DELAY 60
#else
#define MINIMUM_STEPPER_POST_DIR_DELAY 0 // Expect at least 10µS since one Stepper ISR must transpire
#endif
#endif
#ifndef MINIMUM_STEPPER_PRE_DIR_DELAY
#define MINIMUM_STEPPER_PRE_DIR_DELAY MINIMUM_STEPPER_POST_DIR_DELAY
#endif
#ifndef MINIMUM_STEPPER_PULSE
#if HAS_DRIVER(TB6560)
#define MINIMUM_STEPPER_PULSE 30
#elif HAS_DRIVER(TB6600)
#define MINIMUM_STEPPER_PULSE 3
#elif HAS_DRIVER(DRV8825)
#define MINIMUM_STEPPER_PULSE 2
#elif HAS_DRIVER(A4988) || HAS_DRIVER(A5984)
#define MINIMUM_STEPPER_PULSE 1
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MINIMUM_STEPPER_PULSE 0
#elif HAS_DRIVER(LV8729)
#define MINIMUM_STEPPER_PULSE 0
#else
#define MINIMUM_STEPPER_PULSE 2
#endif
#endif
#ifndef MAXIMUM_STEPPER_RATE
#if HAS_DRIVER(TB6560)
#define MAXIMUM_STEPPER_RATE 15000
#elif HAS_DRIVER(TB6600)
#define MAXIMUM_STEPPER_RATE 150000
#elif HAS_DRIVER(DRV8825)
#define MAXIMUM_STEPPER_RATE 250000
#elif HAS_DRIVER(A4988)
#define MAXIMUM_STEPPER_RATE 500000
#elif HAS_DRIVER(LV8729)
#define MAXIMUM_STEPPER_RATE 1000000
#elif HAS_TRINAMIC_CONFIG || HAS_TRINAMIC_STANDALONE
#define MAXIMUM_STEPPER_RATE 5000000
#else
#define MAXIMUM_STEPPER_RATE 250000
#endif
#endif
#if ENABLED(DIRECT_STEPPING)
#ifndef STEPPER_PAGES
#define STEPPER_PAGES 16
#endif
#ifndef STEPPER_PAGE_FORMAT
#define STEPPER_PAGE_FORMAT SP_4x2_256
#endif
#ifndef PAGE_MANAGER
#define PAGE_MANAGER SerialPageManager
#endif
#endif
// Remove unused STEALTHCHOP flags
#if NUM_AXES < 9
#undef STEALTHCHOP_W
#undef CALIBRATION_MEASURE_WMIN
#undef CALIBRATION_MEASURE_WMAX
#if NUM_AXES < 8
#undef STEALTHCHOP_V
#undef CALIBRATION_MEASURE_VMIN
#undef CALIBRATION_MEASURE_VMAX
#if NUM_AXES < 7
#undef STEALTHCHOP_U
#undef CALIBRATION_MEASURE_UMIN
#undef CALIBRATION_MEASURE_UMAX
#if NUM_AXES < 6
#undef STEALTHCHOP_K
#undef CALIBRATION_MEASURE_KMIN
#undef CALIBRATION_MEASURE_KMAX
#if NUM_AXES < 5
#undef STEALTHCHOP_J
#undef CALIBRATION_MEASURE_JMIN
#undef CALIBRATION_MEASURE_JMAX
#if NUM_AXES < 4
#undef STEALTHCHOP_I
#undef CALIBRATION_MEASURE_IMIN
#undef CALIBRATION_MEASURE_IMAX
#if NUM_AXES < 3
#undef STEALTHCHOP_Z
#undef Z_IDLE_HEIGHT
#undef Z_PROBE_SLED
#undef Z_SAFE_HOMING