Browse Source

More IntelliSense-friendly declarations

Scott Lahteine 3 years ago
parent
commit
2d2291d00e

+ 3
- 1
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -303,7 +303,9 @@ void unified_bed_leveling::G29() {
303 303
 
304 304
   const int8_t p_val = parser.intval('P', -1);
305 305
   const bool may_move = p_val == 1 || p_val == 2 || p_val == 4 || parser.seen('J');
306
-  TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder);
306
+  #if ENABLED(HAS_MULTI_HOTEND)
307
+    const uint8_t old_tool_index = active_extruder;
308
+  #endif
307 309
 
308 310
   // Check for commands that require the printer to be homed
309 311
   if (may_move) {

+ 7
- 3
Marlin/src/feature/caselight.h View File

@@ -34,7 +34,9 @@
34 34
 class CaseLight {
35 35
 public:
36 36
   static bool on;
37
-  TERN_(CASELIGHT_USES_BRIGHTNESS, static uint8_t brightness);
37
+  #if ENABLED(CASELIGHT_USES_BRIGHTNESS)
38
+    static uint8_t brightness;
39
+  #endif
38 40
 
39 41
   static bool pin_is_pwm() { return TERN0(NEED_CASE_LIGHT_PIN, PWM_PIN(CASE_LIGHT_PIN)); }
40 42
   static bool has_brightness() { return TERN0(CASELIGHT_USES_BRIGHTNESS, TERN(CASE_LIGHT_USE_NEOPIXEL, true, pin_is_pwm())); }
@@ -50,8 +52,10 @@ public:
50 52
   static inline void update_brightness() { update(false); }
51 53
   static inline void update_enabled()    { update(true);  }
52 54
 
53
-private:
54
-  TERN_(CASE_LIGHT_IS_COLOR_LED, static LEDColor color);
55
+  #if ENABLED(CASE_LIGHT_IS_COLOR_LED)
56
+    private:
57
+      static LEDColor color;
58
+  #endif
55 59
 };
56 60
 
57 61
 extern CaseLight caselight;

+ 12
- 4
Marlin/src/feature/joystick.h View File

@@ -32,11 +32,19 @@
32 32
 class Joystick {
33 33
   friend class Temperature;
34 34
   private:
35
-    TERN_(HAS_JOY_ADC_X, static temp_info_t x);
36
-    TERN_(HAS_JOY_ADC_Y, static temp_info_t y);
37
-    TERN_(HAS_JOY_ADC_Z, static temp_info_t z);
35
+    #if ENABLED(HAS_JOY_ADC_X)
36
+      static temp_info_t x;
37
+    #endif
38
+    #if ENABLED(HAS_JOY_ADC_Y)
39
+      static temp_info_t y;
40
+    #endif
41
+    #if ENABLED(HAS_JOY_ADC_Z)
42
+      static temp_info_t z;
43
+    #endif
38 44
   public:
39
-    TERN_(JOYSTICK_DEBUG, static void report());
45
+    #if ENABLED(JOYSTICK_DEBUG)
46
+      static void report();
47
+    #endif
40 48
     static void calculate(xyz_float_t &norm_jog);
41 49
     static void inject_jog_moves();
42 50
 };

+ 3
- 1
Marlin/src/feature/meatpack.cpp View File

@@ -57,7 +57,9 @@ uint8_t meatPackLookupTable[16] = {
57 57
   '\0' // Unused. 0b1111 indicates a literal character
58 58
 };
59 59
 
60
-TERN_(MP_DEBUG, uint8_t chars_decoded = 0); // Log the first 64 bytes after each reset
60
+#if ENABLED(MP_DEBUG)
61
+  uint8_t chars_decoded = 0;  // Log the first 64 bytes after each reset
62
+#endif
61 63
 
62 64
 void MeatPack::reset_state() {
63 65
   state = 0;

+ 4
- 5
Marlin/src/feature/mixing.h View File

@@ -61,9 +61,6 @@ enum MixTool {
61 61
 #define MAX_VTOOLS TERN(HAS_MIXER_SYNC_CHANNEL, 254, 255)
62 62
 static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must be <= " STRINGIFY(MAX_VTOOLS) "!");
63 63
 
64
-#define MIXER_BLOCK_FIELD       mixer_comp_t b_color[MIXING_STEPPERS]
65
-#define MIXER_POPULATE_BLOCK()  mixer.populate_block(block->b_color)
66
-#define MIXER_STEPPER_SETUP()   mixer.stepper_setup(current_block->b_color)
67 64
 #define MIXER_STEPPER_LOOP(VAR) for (uint_fast8_t VAR = 0; VAR < MIXING_STEPPERS; VAR++)
68 65
 
69 66
 #if ENABLED(GRADIENT_MIX)
@@ -73,9 +70,11 @@ static_assert(NR_MIXING_VIRTUAL_TOOLS <= MAX_VTOOLS, "MIXING_VIRTUAL_TOOLS must
73 70
     mixer_comp_t color[MIXING_STEPPERS];  // The current gradient color
74 71
     float start_z, end_z;                 // Region for gradient
75 72
     int8_t start_vtool, end_vtool;        // Start and end virtual tools
76
-    mixer_perc_t start_mix[MIXING_STEPPERS],   // Start and end mixes from those tools
73
+    mixer_perc_t start_mix[MIXING_STEPPERS],  // Start and end mixes from those tools
77 74
                  end_mix[MIXING_STEPPERS];
78
-    TERN_(GRADIENT_VTOOL, int8_t vtool_index); // Use this virtual tool number as index
75
+    #if ENABLED(GRADIENT_VTOOL)
76
+      int8_t vtool_index;                 // Use this virtual tool number as index
77
+    #endif
79 78
   } gradient_t;
80 79
 
81 80
 #endif

+ 30
- 10
Marlin/src/feature/powerloss.h View File

@@ -55,22 +55,38 @@ typedef struct {
55 55
   float zraise;
56 56
 
57 57
   // Repeat information
58
-  TERN_(GCODE_REPEAT_MARKERS, Repeat stored_repeat);
58
+  #if ENABLED(GCODE_REPEAT_MARKERS)
59
+    Repeat stored_repeat;
60
+  #endif
59 61
 
60
-  TERN_(HAS_HOME_OFFSET,    xyz_pos_t home_offset);
61
-  TERN_(HAS_POSITION_SHIFT, xyz_pos_t position_shift);
62
-  TERN_(HAS_MULTI_EXTRUDER, uint8_t active_extruder);
62
+  #if ENABLED(HAS_HOME_OFFSET)
63
+    xyz_pos_t home_offset;
64
+  #endif
65
+  #if ENABLED(HAS_POSITION_SHIFT)
66
+    xyz_pos_t position_shift;
67
+  #endif
68
+  #if ENABLED(HAS_MULTI_EXTRUDER)
69
+    uint8_t active_extruder;
70
+  #endif
63 71
 
64 72
   #if DISABLED(NO_VOLUMETRICS)
65 73
     bool volumetric_enabled;
66 74
     float filament_size[EXTRUDERS];
67 75
   #endif
68 76
 
69
-  TERN_(HAS_HOTEND,     celsius_t target_temperature[HOTENDS]);
70
-  TERN_(HAS_HEATED_BED, celsius_t target_temperature_bed);
71
-  TERN_(HAS_FAN,        uint8_t fan_speed[FAN_COUNT]);
77
+  #if ENABLED(HAS_HOTEND)
78
+    celsius_t target_temperature[HOTENDS];
79
+  #endif
80
+  #if ENABLED(HAS_HEATED_BED)
81
+    celsius_t target_temperature_bed;
82
+  #endif
83
+  #if ENABLED(HAS_FAN)
84
+    uint8_t fan_speed[FAN_COUNT];
85
+  #endif
72 86
 
73
-  TERN_(HAS_LEVELING, float fade);
87
+  #if ENABLED(HAS_LEVELING)
88
+    float fade;
89
+  #endif
74 90
 
75 91
   #if ENABLED(FWRETRACT)
76 92
     float retract[EXTRUDERS], retract_hop;
@@ -80,7 +96,9 @@ typedef struct {
80 96
   #if ENABLED(MIXING_EXTRUDER)
81 97
     //uint_fast8_t selected_vtool;
82 98
     //mixer_comp_t color[NR_MIXING_VIRTUAL_TOOLS][MIXING_STEPPERS];
83
-    TERN_(GRADIENT_MIX, gradient_t gradient);
99
+    #if ENABLED(GRADIENT_MIX)
100
+      gradient_t gradient;
101
+    #endif
84 102
   #endif
85 103
 
86 104
   // SD Filename and position
@@ -97,7 +115,9 @@ typedef struct {
97 115
   struct {
98 116
     bool dryrun:1;                // M111 S8
99 117
     bool allow_cold_extrusion:1;  // M302 P1
100
-    TERN_(HAS_LEVELING, bool leveling:1);
118
+    #if ENABLED(HAS_LEVELING)
119
+      bool leveling:1;
120
+    #endif
101 121
   } flag;
102 122
 
103 123
   uint8_t valid_foot;

+ 12
- 4
Marlin/src/feature/tmc_util.h View File

@@ -70,9 +70,15 @@ class TMCStorage {
70 70
     }
71 71
 
72 72
     struct {
73
-      TERN_(HAS_STEALTHCHOP, bool stealthChop_enabled = false);
74
-      TERN_(HYBRID_THRESHOLD, uint8_t hybrid_thrs = 0);
75
-      TERN_(USE_SENSORLESS, int16_t homing_thrs = 0);
73
+      #if ENABLED(HAS_STEALTHCHOP)
74
+        bool stealthChop_enabled = false;
75
+      #endif
76
+      #if ENABLED(HYBRID_THRESHOLD)
77
+        uint8_t hybrid_thrs = 0;
78
+      #endif
79
+      #if ENABLED(USE_SENSORLESS)
80
+        int16_t homing_thrs = 0;
81
+      #endif
76 82
     } stored;
77 83
 };
78 84
 
@@ -363,7 +369,9 @@ void test_tmc_connection(const bool test_x, const bool test_y, const bool test_z
363 369
 
364 370
     struct slow_homing_t {
365 371
       xy_ulong_t acceleration;
366
-      TERN_(HAS_CLASSIC_JERK, xy_float_t jerk_xy);
372
+      #if ENABLED(HAS_CLASSIC_JERK)
373
+        xy_float_t jerk_xy;
374
+      #endif
367 375
     };
368 376
   #endif
369 377
 

+ 3
- 1
Marlin/src/gcode/bedlevel/G35.cpp View File

@@ -72,7 +72,9 @@ void GcodeSuite::G35() {
72 72
 
73 73
   // Disable the leveling matrix before auto-aligning
74 74
   #if HAS_LEVELING
75
-    TERN_(RESTORE_LEVELING_AFTER_G35, const bool leveling_was_active = planner.leveling_active);
75
+    #if ENABLED(RESTORE_LEVELING_AFTER_G35)
76
+      const bool leveling_was_active = planner.leveling_active;
77
+    #endif
76 78
     set_bed_leveling_enabled(false);
77 79
   #endif
78 80
 

+ 3
- 1
Marlin/src/gcode/calibrate/G33.cpp View File

@@ -63,7 +63,9 @@ enum CalEnum : char {                        // the 7 main calibration points -
63 63
 #define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
64 64
 #define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
65 65
 
66
-TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index = active_extruder);
66
+#if ENABLED(HAS_MULTI_HOTEND)
67
+  const uint8_t old_tool_index = active_extruder;
68
+#endif
67 69
 
68 70
 float lcd_probe_pt(const xy_pos_t &xy);
69 71
 

+ 3
- 1
Marlin/src/gcode/calibrate/G34_M422.cpp View File

@@ -130,7 +130,9 @@ void GcodeSuite::G34() {
130 130
 
131 131
       // Disable the leveling matrix before auto-aligning
132 132
       #if HAS_LEVELING
133
-        TERN_(RESTORE_LEVELING_AFTER_G34, const bool leveling_was_active = planner.leveling_active);
133
+        #if ENABLED(RESTORE_LEVELING_AFTER_G34)
134
+          const bool leveling_was_active = planner.leveling_active;
135
+        #endif
134 136
         set_bed_leveling_enabled(false);
135 137
       #endif
136 138
 

+ 252
- 84
Marlin/src/gcode/gcode.h View File

@@ -418,24 +418,34 @@ public:
418 418
 
419 419
 private:
420 420
 
421
-  TERN_(MARLIN_DEV_MODE, static void D(const int16_t dcode));
421
+  #if ENABLED(MARLIN_DEV_MODE)
422
+    static void D(const int16_t dcode);
423
+  #endif
422 424
 
423 425
   static void G0_G1(TERN_(HAS_FAST_MOVES, const bool fast_move=false));
424 426
 
425
-  TERN_(ARC_SUPPORT, static void G2_G3(const bool clockwise));
427
+  #if ENABLED(ARC_SUPPORT)
428
+    static void G2_G3(const bool clockwise);
429
+  #endif
426 430
 
427 431
   static void G4();
428 432
 
429
-  TERN_(BEZIER_CURVE_SUPPORT, static void G5());
433
+  #if ENABLED(BEZIER_CURVE_SUPPORT)
434
+    static void G5();
435
+  #endif
430 436
 
431
-  TERN_(DIRECT_STEPPING, static void G6());
437
+  #if ENABLED(DIRECT_STEPPING)
438
+    static void G6();
439
+  #endif
432 440
 
433 441
   #if ENABLED(FWRETRACT)
434 442
     static void G10();
435 443
     static void G11();
436 444
   #endif
437 445
 
438
-  TERN_(NOZZLE_CLEAN_FEATURE, static void G12());
446
+  #if ENABLED(NOZZLE_CLEAN_FEATURE)
447
+    static void G12();
448
+  #endif
439 449
 
440 450
   #if ENABLED(CNC_WORKSPACE_PLANES)
441 451
     static void G17();
@@ -448,9 +458,13 @@ private:
448 458
     static void G21();
449 459
   #endif
450 460
 
451
-  TERN_(G26_MESH_VALIDATION, static void G26());
461
+  #if ENABLED(G26_MESH_VALIDATION)
462
+    static void G26();
463
+  #endif
452 464
 
453
-  TERN_(NOZZLE_PARK_FEATURE, static void G27());
465
+  #if ENABLED(NOZZLE_PARK_FEATURE)
466
+    static void G27();
467
+  #endif
454 468
 
455 469
   static void G28();
456 470
 
@@ -474,19 +488,29 @@ private:
474 488
     #endif
475 489
   #endif
476 490
 
477
-  TERN_(DELTA_AUTO_CALIBRATION, static void G33());
491
+  #if ENABLED(DELTA_AUTO_CALIBRATION)
492
+    static void G33();
493
+  #endif
478 494
 
479 495
   #if ANY(Z_MULTI_ENDSTOPS, Z_STEPPER_AUTO_ALIGN, MECHANICAL_GANTRY_CALIBRATION)
480 496
     static void G34();
481 497
   #endif
482 498
 
483
-  TERN_(Z_STEPPER_AUTO_ALIGN, static void M422());
499
+  #if ENABLED(Z_STEPPER_AUTO_ALIGN)
500
+    static void M422();
501
+  #endif
484 502
 
485
-  TERN_(ASSISTED_TRAMMING, static void G35());
503
+  #if ENABLED(ASSISTED_TRAMMING)
504
+    static void G35();
505
+  #endif
486 506
 
487
-  TERN_(G38_PROBE_TARGET, static void G38(const int8_t subcode));
507
+  #if ENABLED(G38_PROBE_TARGET)
508
+    static void G38(const int8_t subcode);
509
+  #endif
488 510
 
489
-  TERN_(HAS_MESH, static void G42());
511
+  #if ENABLED(HAS_MESH)
512
+    static void G42();
513
+  #endif
490 514
 
491 515
   #if ENABLED(CNC_COORDINATE_SYSTEMS)
492 516
     static void G53();
@@ -498,20 +522,28 @@ private:
498 522
     static void G59();
499 523
   #endif
500 524
 
501
-  TERN_(PROBE_TEMP_COMPENSATION, static void G76());
525
+  #if ENABLED(PROBE_TEMP_COMPENSATION)
526
+    static void G76();
527
+  #endif
502 528
 
503 529
   #if SAVED_POSITIONS
504 530
     static void G60();
505 531
     static void G61();
506 532
   #endif
507 533
 
508
-  TERN_(GCODE_MOTION_MODES, static void G80());
534
+  #if ENABLED(GCODE_MOTION_MODES)
535
+    static void G80();
536
+  #endif
509 537
 
510 538
   static void G92();
511 539
 
512
-  TERN_(CALIBRATION_GCODE, static void G425());
540
+  #if ENABLED(CALIBRATION_GCODE)
541
+    static void G425();
542
+  #endif
513 543
 
514
-  TERN_(HAS_RESUME_CONTINUE, static void M0_M1());
544
+  #if ENABLED(HAS_RESUME_CONTINUE)
545
+    static void M0_M1();
546
+  #endif
515 547
 
516 548
   #if HAS_CUTTER
517 549
     static void M3_M4(const bool is_M4);
@@ -519,14 +551,22 @@ private:
519 551
   #endif
520 552
 
521 553
   #if ENABLED(COOLANT_CONTROL)
522
-    TERN_(COOLANT_MIST, static void M7());
523
-    TERN_(COOLANT_FLOOD, static void M8());
554
+    #if ENABLED(COOLANT_MIST)
555
+      static void M7();
556
+    #endif
557
+    #if ENABLED(COOLANT_FLOOD)
558
+      static void M8();
559
+    #endif
524 560
     static void M9();
525 561
   #endif
526 562
 
527
-  TERN_(EXTERNAL_CLOSED_LOOP_CONTROLLER, static void M12());
563
+  #if ENABLED(EXTERNAL_CLOSED_LOOP_CONTROLLER)
564
+    static void M12();
565
+  #endif
528 566
 
529
-  TERN_(EXPECTED_PRINTER_CHECK, static void M16());
567
+  #if ENABLED(EXPECTED_PRINTER_CHECK)
568
+    static void M16();
569
+  #endif
530 570
 
531 571
   static void M17();
532 572
 
@@ -549,27 +589,43 @@ private:
549 589
   static void M31();
550 590
 
551 591
   #if ENABLED(SDSUPPORT)
552
-    TERN_(HAS_MEDIA_SUBCALLS, static void M32());
553
-    TERN_(LONG_FILENAME_HOST_SUPPORT, static void M33());
592
+    #if ENABLED(HAS_MEDIA_SUBCALLS)
593
+      static void M32();
594
+    #endif
595
+    #if ENABLED(LONG_FILENAME_HOST_SUPPORT)
596
+      static void M33();
597
+    #endif
554 598
     #if BOTH(SDCARD_SORT_ALPHA, SDSORT_GCODE)
555 599
       static void M34();
556 600
     #endif
557 601
   #endif
558 602
 
559
-  TERN_(DIRECT_PIN_CONTROL, static void M42());
560
-  TERN_(PINS_DEBUGGING, static void M43());
603
+  #if ENABLED(DIRECT_PIN_CONTROL)
604
+    static void M42();
605
+  #endif
606
+  #if ENABLED(PINS_DEBUGGING)
607
+    static void M43();
608
+  #endif
561 609
 
562
-  TERN_(Z_MIN_PROBE_REPEATABILITY_TEST, static void M48());
610
+  #if ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST)
611
+    static void M48();
612
+  #endif
563 613
 
564
-  TERN_(LCD_SET_PROGRESS_MANUALLY, static void M73());
614
+  #if ENABLED(LCD_SET_PROGRESS_MANUALLY)
615
+    static void M73();
616
+  #endif
565 617
 
566 618
   static void M75();
567 619
   static void M76();
568 620
   static void M77();
569 621
 
570
-  TERN_(PRINTCOUNTER, static void M78());
622
+  #if ENABLED(PRINTCOUNTER)
623
+    static void M78();
624
+  #endif
571 625
 
572
-  TERN_(PSU_CONTROL, static void M80());
626
+  #if ENABLED(PSU_CONTROL)
627
+    static void M80();
628
+  #endif
573 629
 
574 630
   static void M81();
575 631
   static void M82();
@@ -577,7 +633,9 @@ private:
577 633
   static void M85();
578 634
   static void M92();
579 635
 
580
-  TERN_(M100_FREE_MEMORY_WATCHER, static void M100());
636
+  #if ENABLED(M100_FREE_MEMORY_WATCHER)
637
+    static void M100();
638
+  #endif
581 639
 
582 640
   #if EXTRUDERS
583 641
     static void M104();
@@ -595,13 +653,17 @@ private:
595 653
     static void M108();
596 654
     static void M112();
597 655
     static void M410();
598
-    TERN_(HOST_PROMPT_SUPPORT, static void M876());
656
+    #if ENABLED(HOST_PROMPT_SUPPORT)
657
+      static void M876();
658
+    #endif
599 659
   #endif
600 660
 
601 661
   static void M110();
602 662
   static void M111();
603 663
 
604
-  TERN_(HOST_KEEPALIVE_FEATURE, static void M113());
664
+  #if ENABLED(HOST_KEEPALIVE_FEATURE)
665
+    static void M113();
666
+  #endif
605 667
 
606 668
   static void M114();
607 669
   static void M115();
@@ -611,7 +673,9 @@ private:
611 673
   static void M120();
612 674
   static void M121();
613 675
 
614
-  TERN_(PARK_HEAD_ON_PAUSE, static void M125());
676
+  #if ENABLED(PARK_HEAD_ON_PAUSE)
677
+    static void M125();
678
+  #endif
615 679
 
616 680
   #if ENABLED(BARICUDA)
617 681
     #if HAS_HEATER_1
@@ -643,9 +707,13 @@ private:
643 707
     static void M145();
644 708
   #endif
645 709
 
646
-  TERN_(TEMPERATURE_UNITS_SUPPORT, static void M149());
710
+  #if ENABLED(TEMPERATURE_UNITS_SUPPORT)
711
+    static void M149();
712
+  #endif
647 713
 
648
-  TERN_(HAS_COLOR_LEDS, static void M150());
714
+  #if ENABLED(HAS_COLOR_LEDS)
715
+    static void M150();
716
+  #endif
649 717
 
650 718
   #if BOTH(AUTO_REPORT_TEMPERATURES, HAS_TEMP_SENSOR)
651 719
     static void M155();
@@ -654,8 +722,12 @@ private:
654 722
   #if ENABLED(MIXING_EXTRUDER)
655 723
     static void M163();
656 724
     static void M164();
657
-    TERN_(DIRECT_MIXING_IN_G1, static void M165());
658
-    TERN_(GRADIENT_MIX, static void M166());
725
+    #if ENABLED(DIRECT_MIXING_IN_G1)
726
+      static void M165();
727
+    #endif
728
+    #if ENABLED(GRADIENT_MIX)
729
+      static void M166();
730
+    #endif
659 731
   #endif
660 732
 
661 733
   static void M200();
@@ -669,19 +741,27 @@ private:
669 741
   static void M204();
670 742
   static void M205();
671 743
 
672
-  TERN_(HAS_M206_COMMAND, static void M206());
744
+  #if ENABLED(HAS_M206_COMMAND)
745
+    static void M206();
746
+  #endif
673 747
 
674 748
   #if ENABLED(FWRETRACT)
675 749
     static void M207();
676 750
     static void M208();
677
-    TERN_(FWRETRACT_AUTORETRACT, static void M209());
751
+    #if ENABLED(FWRETRACT_AUTORETRACT)
752
+      static void M209();
753
+    #endif
678 754
   #endif
679 755
 
680 756
   static void M211();
681 757
 
682
-  TERN_(HAS_MULTI_EXTRUDER, static void M217());
758
+  #if ENABLED(HAS_MULTI_EXTRUDER)
759
+    static void M217();
760
+  #endif
683 761
 
684
-  TERN_(HAS_HOTEND_OFFSET, static void M218());
762
+  #if ENABLED(HAS_HOTEND_OFFSET)
763
+    static void M218();
764
+  #endif
685 765
 
686 766
   static void M220();
687 767
 
@@ -689,11 +769,17 @@ private:
689 769
     static void M221();
690 770
   #endif
691 771
 
692
-  TERN_(DIRECT_PIN_CONTROL, static void M226());
772
+  #if ENABLED(DIRECT_PIN_CONTROL)
773
+    static void M226();
774
+  #endif
693 775
 
694
-  TERN_(PHOTO_GCODE, static void M240());
776
+  #if ENABLED(PHOTO_GCODE)
777
+    static void M240();
778
+  #endif
695 779
 
696
-  TERN_(HAS_LCD_CONTRAST, static void M250());
780
+  #if ENABLED(HAS_LCD_CONTRAST)
781
+    static void M250();
782
+  #endif
697 783
 
698 784
   #if ENABLED(EXPERIMENTAL_I2CBUS)
699 785
     static void M260();
@@ -702,33 +788,55 @@ private:
702 788
 
703 789
   #if HAS_SERVOS
704 790
     static void M280();
705
-    TERN_(EDITABLE_SERVO_ANGLES, static void M281());
791
+    #if ENABLED(EDITABLE_SERVO_ANGLES)
792
+      static void M281();
793
+    #endif
706 794
   #endif
707 795
 
708
-  TERN_(BABYSTEPPING, static void M290());
796
+  #if ENABLED(BABYSTEPPING)
797
+    static void M290();
798
+  #endif
709 799
 
710
-  TERN_(HAS_BUZZER, static void M300());
800
+  #if ENABLED(HAS_BUZZER)
801
+    static void M300();
802
+  #endif
711 803
 
712
-  TERN_(PIDTEMP, static void M301());
804
+  #if ENABLED(PIDTEMP)
805
+    static void M301();
806
+  #endif
713 807
 
714
-  TERN_(PREVENT_COLD_EXTRUSION, static void M302());
808
+  #if ENABLED(PREVENT_COLD_EXTRUSION)
809
+    static void M302();
810
+  #endif
715 811
 
716
-  TERN_(HAS_PID_HEATING, static void M303());
812
+  #if ENABLED(HAS_PID_HEATING)
813
+    static void M303();
814
+  #endif
717 815
 
718
-  TERN_(PIDTEMPBED, static void M304());
816
+  #if ENABLED(PIDTEMPBED)
817
+    static void M304();
818
+  #endif
719 819
 
720
-  TERN_(HAS_USER_THERMISTORS, static void M305());
820
+  #if ENABLED(HAS_USER_THERMISTORS)
821
+    static void M305();
822
+  #endif
721 823
 
722
-  TERN_(PIDTEMPCHAMBER, static void M309());
824
+  #if ENABLED(PIDTEMPCHAMBER)
825
+    static void M309();
826
+  #endif
723 827
 
724 828
   #if HAS_MICROSTEPS
725 829
     static void M350();
726 830
     static void M351();
727 831
   #endif
728 832
 
729
-  TERN_(CASE_LIGHT_ENABLE, static void M355());
833
+  #if ENABLED(CASE_LIGHT_ENABLE)
834
+    static void M355();
835
+  #endif
730 836
 
731
-  TERN_(REPETIER_GCODE_M360, static void M360());
837
+  #if ENABLED(REPETIER_GCODE_M360)
838
+    static void M360();
839
+  #endif
732 840
 
733 841
   #if ENABLED(MORGAN_SCARA)
734 842
     static bool M360();
@@ -750,7 +858,9 @@ private:
750 858
     static void M402();
751 859
   #endif
752 860
 
753
-  TERN_(HAS_PRUSA_MMU2, static void M403());
861
+  #if ENABLED(HAS_PRUSA_MMU2)
862
+    static void M403();
863
+  #endif
754 864
 
755 865
   #if ENABLED(FILAMENT_WIDTH_SENSOR)
756 866
     static void M404();
@@ -759,22 +869,34 @@ private:
759 869
     static void M407();
760 870
   #endif
761 871
 
762
-  TERN_(HAS_FILAMENT_SENSOR, static void M412());
872
+  #if ENABLED(HAS_FILAMENT_SENSOR)
873
+    static void M412();
874
+  #endif
763 875
 
764
-  TERN_(HAS_MULTI_LANGUAGE, static void M414());
876
+  #if ENABLED(HAS_MULTI_LANGUAGE)
877
+    static void M414();
878
+  #endif
765 879
 
766 880
   #if HAS_LEVELING
767 881
     static void M420();
768 882
     static void M421();
769 883
   #endif
770 884
 
771
-  TERN_(BACKLASH_GCODE, static void M425());
885
+  #if ENABLED(BACKLASH_GCODE)
886
+    static void M425();
887
+  #endif
772 888
 
773
-  TERN_(HAS_M206_COMMAND, static void M428());
889
+  #if ENABLED(HAS_M206_COMMAND)
890
+    static void M428();
891
+  #endif
774 892
 
775
-  TERN_(HAS_POWER_MONITOR, static void M430());
893
+  #if ENABLED(HAS_POWER_MONITOR)
894
+    static void M430();
895
+  #endif
776 896
 
777
-  TERN_(CANCEL_OBJECTS, static void M486());
897
+  #if ENABLED(CANCEL_OBJECTS)
898
+    static void M486();
899
+  #endif
778 900
 
779 901
   static void M500();
780 902
   static void M501();
@@ -782,17 +904,27 @@ private:
782 904
   #if DISABLED(DISABLE_M503)
783 905
     static void M503();
784 906
   #endif
785
-  TERN_(EEPROM_SETTINGS, static void M504());
907
+  #if ENABLED(EEPROM_SETTINGS)
908
+    static void M504();
909
+  #endif
786 910
 
787 911
   #if ENABLED(PASSWORD_FEATURE)
788 912
     static void M510();
789
-    TERN_(PASSWORD_UNLOCK_GCODE, static void M511());
790
-    TERN_(PASSWORD_CHANGE_GCODE, static void M512());
913
+    #if ENABLED(PASSWORD_UNLOCK_GCODE)
914
+      static void M511();
915
+    #endif
916
+    #if ENABLED(PASSWORD_CHANGE_GCODE)
917
+      static void M512();
918
+    #endif
791 919
   #endif
792 920
 
793
-  TERN_(SDSUPPORT, static void M524());
921
+  #if ENABLED(SDSUPPORT)
922
+    static void M524();
923
+  #endif
794 924
 
795
-  TERN_(SD_ABORT_ON_ENDSTOP_HIT, static void M540());
925
+  #if ENABLED(SD_ABORT_ON_ENDSTOP_HIT)
926
+    static void M540();
927
+  #endif
796 928
 
797 929
   #if HAS_ETHERNET
798 930
     static void M552();
@@ -800,16 +932,22 @@ private:
800 932
     static void M554();
801 933
   #endif
802 934
 
803
-  TERN_(BAUD_RATE_GCODE, static void M575());
935
+  #if ENABLED(BAUD_RATE_GCODE)
936
+    static void M575();
937
+  #endif
804 938
 
805 939
   #if ENABLED(ADVANCED_PAUSE_FEATURE)
806 940
     static void M600();
807 941
     static void M603();
808 942
   #endif
809 943
 
810
-  TERN_(HAS_DUPLICATION_MODE, static void M605());
944
+  #if ENABLED(HAS_DUPLICATION_MODE)
945
+    static void M605();
946
+  #endif
811 947
 
812
-  TERN_(IS_KINEMATIC, static void M665());
948
+  #if ENABLED(IS_KINEMATIC)
949
+    static void M665();
950
+  #endif
813 951
 
814 952
   #if ENABLED(DELTA) || HAS_EXTRA_ENDSTOPS
815 953
     static void M666();
@@ -824,13 +962,21 @@ private:
824 962
     static void M702();
825 963
   #endif
826 964
 
827
-  TERN_(GCODE_REPEAT_MARKERS, static void M808());
965
+  #if ENABLED(GCODE_REPEAT_MARKERS)
966
+    static void M808();
967
+  #endif
828 968
 
829
-  TERN_(GCODE_MACROS, static void M810_819());
969
+  #if ENABLED(GCODE_MACROS)
970
+    static void M810_819();
971
+  #endif
830 972
 
831
-  TERN_(HAS_BED_PROBE, static void M851());
973
+  #if ENABLED(HAS_BED_PROBE)
974
+    static void M851();
975
+  #endif
832 976
 
833
-  TERN_(SKEW_CORRECTION_GCODE, static void M852());
977
+  #if ENABLED(SKEW_CORRECTION_GCODE)
978
+    static void M852();
979
+  #endif
834 980
 
835 981
   #if ENABLED(I2C_POSITION_ENCODERS)
836 982
     FORCE_INLINE static void M860() { I2CPEM.M860(); }
@@ -850,18 +996,26 @@ private:
850 996
     static void M871();
851 997
   #endif
852 998
 
853
-  TERN_(LIN_ADVANCE, static void M900());
999
+  #if ENABLED(LIN_ADVANCE)
1000
+    static void M900();
1001
+  #endif
854 1002
 
855 1003
   #if HAS_TRINAMIC_CONFIG
856 1004
     static void M122();
857 1005
     static void M906();
858
-    TERN_(HAS_STEALTHCHOP, static void M569());
1006
+    #if ENABLED(HAS_STEALTHCHOP)
1007
+      static void M569();
1008
+    #endif
859 1009
     #if ENABLED(MONITOR_DRIVER_STATUS)
860 1010
       static void M911();
861 1011
       static void M912();
862 1012
     #endif
863
-    TERN_(HYBRID_THRESHOLD, static void M913());
864
-    TERN_(USE_SENSORLESS, static void M914());
1013
+    #if ENABLED(HYBRID_THRESHOLD)
1014
+      static void M913();
1015
+    #endif
1016
+    #if ENABLED(USE_SENSORLESS)
1017
+      static void M914();
1018
+    #endif
865 1019
   #endif
866 1020
 
867 1021
   #if HAS_L64XX
@@ -883,18 +1037,26 @@ private:
883 1037
     #endif
884 1038
   #endif
885 1039
 
886
-  TERN_(SDSUPPORT, static void M928());
1040
+  #if ENABLED(SDSUPPORT)
1041
+    static void M928();
1042
+  #endif
887 1043
 
888
-  TERN_(MAGNETIC_PARKING_EXTRUDER, static void M951());
1044
+  #if ENABLED(MAGNETIC_PARKING_EXTRUDER)
1045
+    static void M951();
1046
+  #endif
889 1047
 
890
-  TERN_(TOUCH_SCREEN_CALIBRATION, static void M995());
1048
+  #if ENABLED(TOUCH_SCREEN_CALIBRATION)
1049
+    static void M995();
1050
+  #endif
891 1051
 
892 1052
   #if BOTH(HAS_SPI_FLASH, SDSUPPORT)
893 1053
     static void M993();
894 1054
     static void M994();
895 1055
   #endif
896 1056
 
897
-  TERN_(PLATFORM_M997_SUPPORT, static void M997());
1057
+  #if ENABLED(PLATFORM_M997_SUPPORT)
1058
+    static void M997();
1059
+  #endif
898 1060
 
899 1061
   static void M999();
900 1062
 
@@ -903,11 +1065,17 @@ private:
903 1065
     static void M1000();
904 1066
   #endif
905 1067
 
906
-  TERN_(SDSUPPORT, static void M1001());
1068
+  #if ENABLED(SDSUPPORT)
1069
+    static void M1001();
1070
+  #endif
907 1071
 
908
-  TERN_(MAX7219_GCODE, static void M7219());
1072
+  #if ENABLED(MAX7219_GCODE)
1073
+    static void M7219();
1074
+  #endif
909 1075
 
910
-  TERN_(CONTROLLER_FAN_EDITABLE, static void M710());
1076
+  #if ENABLED(CONTROLLER_FAN_EDITABLE)
1077
+    static void M710();
1078
+  #endif
911 1079
 
912 1080
   static void T(const int8_t tool_index);
913 1081
 

+ 8
- 6
Marlin/src/gcode/queue.h View File

@@ -40,9 +40,9 @@ public:
40 40
      * M110 N<int> sets the current line number.
41 41
      */
42 42
     long last_N;
43
-    int count;                        //!< Number of characters read in the current line of serial input
44
-    char line_buffer[MAX_CMD_SIZE];   //!< The current line accumulator
45
-    uint8_t input_state;              //!< The input state
43
+    int count;                      //!< Number of characters read in the current line of serial input
44
+    char line_buffer[MAX_CMD_SIZE]; //!< The current line accumulator
45
+    uint8_t input_state;            //!< The input state
46 46
   };
47 47
 
48 48
   static SerialState serial_state[NUM_SERIAL]; //!< Serial states for each serial port
@@ -57,9 +57,11 @@ public:
57 57
    * command and hands off execution to individual handler functions.
58 58
    */
59 59
   struct CommandLine {
60
-    char buffer[MAX_CMD_SIZE];                    //!< The command buffer
61
-    bool skip_ok;                                 //!< Skip sending ok when command is processed?
62
-    TERN_(HAS_MULTI_SERIAL, serial_index_t port); //!< Serial port the command was received on
60
+    char buffer[MAX_CMD_SIZE];      //!< The command buffer
61
+    bool skip_ok;                   //!< Skip sending ok when command is processed?
62
+    #if ENABLED(HAS_MULTI_SERIAL)
63
+      serial_index_t port;          //!< Serial port the command was received on
64
+    #endif
63 65
   };
64 66
 
65 67
   /**

+ 3
- 1
Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp View File

@@ -536,7 +536,9 @@ void ST7920_Lite_Status_Screen::draw_heat_icon(const bool whichIcon, const bool
536 536
 static struct {
537 537
   bool E1_show_target  : 1;
538 538
   bool E2_show_target  : 1;
539
-  TERN_(HAS_HEATED_BED, bool bed_show_target : 1);
539
+  #if ENABLED(HAS_HEATED_BED)
540
+    bool bed_show_target : 1;
541
+  #endif
540 542
 } display_state = {
541 543
   true, true, TERN_(HAS_HEATED_BED, true)
542 544
 };

+ 6
- 2
Marlin/src/lcd/dwin/e3v2/dwin.cpp View File

@@ -180,8 +180,12 @@ static uint8_t _card_percent = 0;
180 180
 static uint16_t _remain_time = 0;
181 181
 
182 182
 #if ENABLED(PAUSE_HEAT)
183
-  TERN_(HAS_HOTEND, uint16_t resume_hotend_temp = 0);
184
-  TERN_(HAS_HEATED_BED, uint16_t resume_bed_temp = 0);
183
+  #if ENABLED(HAS_HOTEND)
184
+    uint16_t resume_hotend_temp = 0;
185
+  #endif
186
+  #if ENABLED(HAS_HEATED_BED)
187
+    uint16_t resume_bed_temp = 0;
188
+  #endif
185 189
 #endif
186 190
 
187 191
 #if HAS_ZOFFSET_ITEM

+ 18
- 6
Marlin/src/lcd/dwin/e3v2/dwin.h View File

@@ -234,9 +234,15 @@ extern char print_filename[16];
234 234
 extern millis_t dwin_heat_time;
235 235
 
236 236
 typedef struct {
237
-  TERN_(HAS_HOTEND,     celsius_t E_Temp    = 0);
238
-  TERN_(HAS_HEATED_BED, celsius_t Bed_Temp  = 0);
239
-  TERN_(HAS_FAN,        int16_t Fan_speed = 0);
237
+  #if ENABLED(HAS_HOTEND)
238
+    celsius_t E_Temp = 0;
239
+  #endif
240
+  #if ENABLED(HAS_HEATED_BED)
241
+    celsius_t Bed_Temp = 0;
242
+  #endif
243
+  #if ENABLED(HAS_FAN)
244
+    int16_t Fan_speed = 0;
245
+  #endif
240 246
   int16_t print_speed     = 100;
241 247
   float Max_Feedspeed     = 0;
242 248
   float Max_Acceleration  = 0;
@@ -312,9 +318,15 @@ void HMI_Move_E();
312 318
 
313 319
 void HMI_Zoffset();
314 320
 
315
-TERN_(HAS_HOTEND,     void HMI_ETemp());
316
-TERN_(HAS_HEATED_BED, void HMI_BedTemp());
317
-TERN_(HAS_FAN,        void HMI_FanSpeed());
321
+#if ENABLED(HAS_HOTEND)
322
+  void HMI_ETemp();
323
+#endif
324
+#if ENABLED(HAS_HEATED_BED)
325
+  void HMI_BedTemp();
326
+#endif
327
+#if ENABLED(HAS_FAN)
328
+  void HMI_FanSpeed();
329
+#endif
318 330
 
319 331
 void HMI_PrintSpeed();
320 332
 

+ 3
- 1
Marlin/src/lcd/extui/lib/dgus/DGUSScreenHandler.cpp View File

@@ -624,7 +624,9 @@ void DGUSScreenHandler::HandleHeaterControl(DGUS_VP_Variable &var, void *val_ptr
624 624
     DEBUG_ECHOLNPGM("HandlePreheat");
625 625
 
626 626
     uint8_t e_temp = 0;
627
-    TERN_(HAS_HEATED_BED, uint8_t bed_temp = 0);
627
+    #if ENABLED(HAS_HEATED_BED)
628
+      uint8_t bed_temp = 0;
629
+    #endif
628 630
     const uint16_t preheat_option = swap16(*(uint16_t*)val_ptr);
629 631
     switch (preheat_option) {
630 632
       default:

+ 3
- 1
Marlin/src/lcd/extui/lib/mks_ui/draw_printing.cpp View File

@@ -49,7 +49,9 @@ static lv_obj_t *labelPause, *labelStop, *labelOperat;
49 49
 static lv_obj_t *bar1, *bar1ValueText;
50 50
 static lv_obj_t *buttonPause, *buttonOperat, *buttonStop;
51 51
 
52
-TERN_(HAS_MULTI_EXTRUDER, static lv_obj_t *labelExt2);
52
+#if ENABLED(HAS_MULTI_EXTRUDER)
53
+  static lv_obj_t *labelExt2;
54
+#endif
53 55
 
54 56
 #if HAS_HEATED_BED
55 57
   static lv_obj_t* labelBed;

+ 56
- 20
Marlin/src/lcd/extui/ui_api.cpp View File

@@ -103,8 +103,12 @@
103 103
 namespace ExtUI {
104 104
   static struct {
105 105
     uint8_t printer_killed : 1;
106
-    TERN_(JOYSTICK, uint8_t jogging : 1);
107
-    TERN_(SDSUPPORT, uint8_t was_sd_printing : 1);
106
+    #if ENABLED(JOYSTICK)
107
+      uint8_t jogging : 1;
108
+    #endif
109
+    #if ENABLED(SDSUPPORT)
110
+      uint8_t was_sd_printing : 1;
111
+    #endif
108 112
   } flags;
109 113
 
110 114
   #ifdef __SAM3X8E__
@@ -175,8 +179,12 @@ namespace ExtUI {
175 179
         #if HAS_HEATED_BED
176 180
           case BED: thermalManager.reset_bed_idle_timer(); return;
177 181
         #endif
178
-        TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return); // Chamber has no idle timer
179
-        TERN_(HAS_COOLER, case COOLER: return); // Cooler has no idle timer
182
+        #if ENABLED(HAS_HEATED_CHAMBER)
183
+          case CHAMBER: return; // Chamber has no idle timer
184
+        #endif
185
+        #if ENABLED(HAS_COOLER)
186
+          case COOLER: return;  // Cooler has no idle timer
187
+        #endif
180 188
         default:
181 189
           TERN_(HAS_HOTEND, thermalManager.reset_hotend_idle_timer(heater - H0));
182 190
           break;
@@ -234,8 +242,12 @@ namespace ExtUI {
234 242
   bool isHeaterIdle(const heater_t heater) {
235 243
     #if HEATER_IDLE_HANDLER
236 244
       switch (heater) {
237
-        TERN_(HAS_HEATED_BED, case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out);
238
-        TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return false); // Chamber has no idle timer
245
+        #if ENABLED(HAS_HEATED_BED)
246
+          case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out;
247
+        #endif
248
+        #if ENABLED(HAS_HEATED_CHAMBER)
249
+          case CHAMBER: return false; // Chamber has no idle timer
250
+        #endif
239 251
         default:
240 252
           return TERN0(HAS_HOTEND, thermalManager.heater_idle[heater - H0].timed_out);
241 253
       }
@@ -253,8 +265,12 @@ namespace ExtUI {
253 265
 
254 266
   float getActualTemp_celsius(const heater_t heater) {
255 267
     switch (heater) {
256
-      TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed()));
257
-      TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber()));
268
+      #if ENABLED(HAS_HEATED_BED)
269
+        case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degBed());
270
+      #endif
271
+      #if ENABLED(HAS_HEATED_CHAMBER)
272
+        case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degChamber());
273
+      #endif
258 274
       default: return GET_TEMP_ADJUSTMENT(thermalManager.degHotend(heater - H0));
259 275
     }
260 276
   }
@@ -265,8 +281,12 @@ namespace ExtUI {
265 281
 
266 282
   float getTargetTemp_celsius(const heater_t heater) {
267 283
     switch (heater) {
268
-      TERN_(HAS_HEATED_BED, case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed()));
269
-      TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber()));
284
+      #if ENABLED(HAS_HEATED_BED)
285
+        case BED: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetBed());
286
+      #endif
287
+      #if ENABLED(HAS_HEATED_CHAMBER)
288
+        case CHAMBER: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetChamber());
289
+      #endif
270 290
       default: return GET_TEMP_ADJUSTMENT(thermalManager.degTargetHotend(heater - H0));
271 291
     }
272 292
   }
@@ -294,13 +314,13 @@ namespace ExtUI {
294 314
   }
295 315
 
296 316
   float getAxisPosition_mm(const axis_t axis) {
297
-    return TERN_(JOYSTICK, flags.jogging ? destination[axis] :) current_position[axis];
317
+    return TERN0(JOYSTICK, flags.jogging) ? destination[axis] : current_position[axis];
298 318
   }
299 319
 
300 320
   float getAxisPosition_mm(const extruder_t extruder) {
301 321
     const extruder_t old_tool = getActiveTool();
302 322
     setActiveTool(extruder, true);
303
-    const float epos = TERN_(JOYSTICK, flags.jogging ? destination.e :) current_position.e;
323
+    const float epos = TERN0(JOYSTICK, flags.jogging) ? destination.e : current_position.e;
304 324
     setActiveTool(old_tool, true);
305 325
     return epos;
306 326
   }
@@ -491,14 +511,30 @@ namespace ExtUI {
491 511
 
492 512
     int getTMCBumpSensitivity(const axis_t axis) {
493 513
       switch (axis) {
494
-        TERN_(X_SENSORLESS,  case X:  return stepperX.homing_threshold());
495
-        TERN_(X2_SENSORLESS, case X2: return stepperX2.homing_threshold());
496
-        TERN_(Y_SENSORLESS,  case Y:  return stepperY.homing_threshold());
497
-        TERN_(Y2_SENSORLESS, case Y2: return stepperY2.homing_threshold());
498
-        TERN_(Z_SENSORLESS,  case Z:  return stepperZ.homing_threshold());
499
-        TERN_(Z2_SENSORLESS, case Z2: return stepperZ2.homing_threshold());
500
-        TERN_(Z3_SENSORLESS, case Z3: return stepperZ3.homing_threshold());
501
-        TERN_(Z4_SENSORLESS, case Z4: return stepperZ4.homing_threshold());
514
+        #if ENABLED(X_SENSORLESS)
515
+          case X:  return stepperX.homing_threshold();
516
+        #endif
517
+        #if ENABLED(X2_SENSORLESS)
518
+          case X2: return stepperX2.homing_threshold();
519
+        #endif
520
+        #if ENABLED(Y_SENSORLESS)
521
+          case Y:  return stepperY.homing_threshold();
522
+        #endif
523
+        #if ENABLED(Y2_SENSORLESS)
524
+          case Y2: return stepperY2.homing_threshold();
525
+        #endif
526
+        #if ENABLED(Z_SENSORLESS)
527
+          case Z:  return stepperZ.homing_threshold();
528
+        #endif
529
+        #if ENABLED(Z2_SENSORLESS)
530
+          case Z2: return stepperZ2.homing_threshold();
531
+        #endif
532
+        #if ENABLED(Z3_SENSORLESS)
533
+          case Z3: return stepperZ3.homing_threshold();
534
+        #endif
535
+        #if ENABLED(Z4_SENSORLESS)
536
+          case Z4: return stepperZ4.homing_threshold();
537
+        #endif
502 538
         default: return 0;
503 539
       }
504 540
     }

+ 3
- 1
Marlin/src/lcd/marlinui.cpp View File

@@ -688,7 +688,9 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
688 688
     xyze_pos_t ManualMove::all_axes_destination = { 0 };
689 689
     bool ManualMove::processing = false;
690 690
   #endif
691
-  TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
691
+  #if ENABLED(MULTI_MANUAL)
692
+    int8_t ManualMove::e_index = 0;
693
+  #endif
692 694
   AxisEnum ManualMove::axis = NO_AXIS;
693 695
 
694 696
   /**

+ 15
- 5
Marlin/src/lcd/marlinui.h View File

@@ -105,9 +105,15 @@
105 105
 
106 106
 #if PREHEAT_COUNT
107 107
   typedef struct {
108
-    TERN_(HAS_HOTEND,     celsius_t hotend_temp);
109
-    TERN_(HAS_HEATED_BED, celsius_t bed_temp   );
110
-    TERN_(HAS_FAN,        uint16_t  fan_speed  );
108
+    #if ENABLED(HAS_HOTEND)
109
+      celsius_t hotend_temp;
110
+    #endif
111
+    #if ENABLED(HAS_HEATED_BED)
112
+      celsius_t bed_temp;
113
+    #endif
114
+    #if ENABLED(HAS_FAN)
115
+      uint16_t fan_speed;
116
+    #endif
111 117
   } preheat_t;
112 118
 #endif
113 119
 
@@ -123,10 +129,14 @@
123 129
       static int8_t constexpr e_index = 0;
124 130
     #endif
125 131
     static millis_t start_time;
126
-    TERN_(IS_KINEMATIC, static xyze_pos_t all_axes_destination);
132
+    #if ENABLED(IS_KINEMATIC)
133
+      static xyze_pos_t all_axes_destination;
134
+    #endif
127 135
   public:
128 136
     static float menu_scale;
129
-    TERN_(IS_KINEMATIC, static float offset);
137
+    #if ENABLED(IS_KINEMATIC)
138
+      static float offset;
139
+    #endif
130 140
     template <typename T>
131 141
     void set_destination(const T& dest) {
132 142
       #if IS_KINEMATIC

+ 12
- 4
Marlin/src/lcd/menu/game/game.h View File

@@ -53,10 +53,18 @@
53 53
 
54 54
 // Pool game data to save SRAM
55 55
 union MarlinGameData {
56
-  TERN_(MARLIN_BRICKOUT, brickout_data_t brickout);
57
-  TERN_(MARLIN_INVADERS, invaders_data_t invaders);
58
-  TERN_(MARLIN_SNAKE, snake_data_t snake);
59
-  TERN_(MARLIN_MAZE, maze_data_t maze);
56
+  #if ENABLED(MARLIN_BRICKOUT)
57
+    brickout_data_t brickout;
58
+  #endif
59
+  #if ENABLED(MARLIN_INVADERS)
60
+    invaders_data_t invaders;
61
+  #endif
62
+  #if ENABLED(MARLIN_SNAKE)
63
+    snake_data_t snake;
64
+  #endif
65
+  #if ENABLED(MARLIN_MAZE)
66
+    maze_data_t maze;
67
+  #endif
60 68
 };
61 69
 
62 70
 extern MarlinGameData marlin_game_data;

+ 3
- 1
Marlin/src/lcd/menu/menu_delta_calibrate.cpp View File

@@ -119,7 +119,9 @@ void lcd_delta_settings() {
119 119
 }
120 120
 
121 121
 void menu_delta_calibrate() {
122
-  TERN_(DELTA_CALIBRATION_MENU, const bool all_homed = all_axes_homed()); // Acquire ahead of loop
122
+  #if ENABLED(DELTA_CALIBRATION_MENU)
123
+    const bool all_homed = all_axes_homed();  // Acquire ahead of loop
124
+  #endif
123 125
 
124 126
   START_MENU();
125 127
   BACK_ITEM(MSG_MAIN);

+ 3
- 1
Marlin/src/lcd/menu/menu_probe_offset.cpp View File

@@ -42,7 +42,9 @@
42 42
 // Global storage
43 43
 float z_offset_backup, calculated_z_offset, z_offset_ref;
44 44
 
45
-TERN_(HAS_LEVELING, bool leveling_was_active);
45
+#if ENABLED(HAS_LEVELING)
46
+  bool leveling_was_active;
47
+#endif
46 48
 
47 49
 inline void z_clearance_move() {
48 50
   do_z_clearance(

+ 9
- 3
Marlin/src/libs/nozzle.cpp View File

@@ -46,7 +46,9 @@ Nozzle nozzle;
46 46
    * @param strokes number of strokes to execute
47 47
    */
48 48
   void Nozzle::stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) {
49
-    TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t oldpos = current_position);
49
+    #if ENABLED(NOZZLE_CLEAN_GOBACK)
50
+      const xyz_pos_t oldpos = current_position;
51
+    #endif
50 52
 
51 53
     // Move to the starting point
52 54
     #if ENABLED(NOZZLE_CLEAN_NO_Z)
@@ -86,7 +88,9 @@ Nozzle nozzle;
86 88
     const xy_pos_t diff = end - start;
87 89
     if (!diff.x || !diff.y) return;
88 90
 
89
-    TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
91
+    #if ENABLED(NOZZLE_CLEAN_GOBACK)
92
+      const xyz_pos_t back = current_position;
93
+    #endif
90 94
 
91 95
     #if ENABLED(NOZZLE_CLEAN_NO_Z)
92 96
       do_blocking_move_to_xy(start);
@@ -129,7 +133,9 @@ Nozzle nozzle;
129 133
   void Nozzle::circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const float &radius) {
130 134
     if (strokes == 0) return;
131 135
 
132
-    TERN_(NOZZLE_CLEAN_GOBACK, const xyz_pos_t back = current_position);
136
+    #if ENABLED(NOZZLE_CLEAN_GOBACK)
137
+      const xyz_pos_t back = current_position;
138
+    #endif
133 139
     TERN(NOZZLE_CLEAN_NO_Z, do_blocking_move_to_xy, do_blocking_move_to)(start);
134 140
 
135 141
     LOOP_L_N(s, strokes)

+ 9
- 3
Marlin/src/module/endstops.h View File

@@ -46,9 +46,15 @@ class Endstops {
46 46
   public:
47 47
     #if HAS_EXTRA_ENDSTOPS
48 48
       typedef uint16_t esbits_t;
49
-      TERN_(X_DUAL_ENDSTOPS, static float x2_endstop_adj);
50
-      TERN_(Y_DUAL_ENDSTOPS, static float y2_endstop_adj);
51
-      TERN_(Z_MULTI_ENDSTOPS, static float z2_endstop_adj);
49
+      #if ENABLED(X_DUAL_ENDSTOPS)
50
+        static float x2_endstop_adj;
51
+      #endif
52
+      #if ENABLED(Y_DUAL_ENDSTOPS)
53
+        static float y2_endstop_adj;
54
+      #endif
55
+      #if ENABLED(Z_MULTI_ENDSTOPS)
56
+        static float z2_endstop_adj;
57
+      #endif
52 58
       #if ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 3
53 59
         static float z3_endstop_adj;
54 60
       #endif

+ 1
- 3
Marlin/src/module/planner.cpp View File

@@ -2019,9 +2019,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move,
2019 2019
   // Bail if this is a zero-length block
2020 2020
   if (block->step_event_count < MIN_STEPS_PER_SEGMENT) return false;
2021 2021
 
2022
-  #if ENABLED(MIXING_EXTRUDER)
2023
-    MIXER_POPULATE_BLOCK();
2024
-  #endif
2022
+  TERN_(MIXING_EXTRUDER, mixer.populate_block(block->b_color))
2025 2023
 
2026 2024
   TERN_(HAS_CUTTER, block->cutter_power = cutter.power);
2027 2025
 

+ 3
- 1
Marlin/src/module/planner.h View File

@@ -170,7 +170,9 @@ typedef struct block_t {
170 170
     static constexpr uint8_t extruder = 0;
171 171
   #endif
172 172
 
173
-  TERN_(MIXING_EXTRUDER, MIXER_BLOCK_FIELD); // Normalized color for the mixing steppers
173
+  #if ENABLED(MIXING_EXTRUDER)
174
+    mixer_comp_t b_color[MIXING_STEPPERS];  // Normalized color for the mixing steppers
175
+  #endif
174 176
 
175 177
   // Settings for the trapezoid generator
176 178
   uint32_t accelerate_until,                // The index of the step event on which to stop acceleration

+ 3
- 1
Marlin/src/module/servo.cpp View File

@@ -32,7 +32,9 @@
32 32
 
33 33
 HAL_SERVO_LIB servo[NUM_SERVOS];
34 34
 
35
-TERN_(EDITABLE_SERVO_ANGLES, uint16_t servo_angles[NUM_SERVOS][2]);
35
+#if ENABLED(EDITABLE_SERVO_ANGLES)
36
+  uint16_t servo_angles[NUM_SERVOS][2];
37
+#endif
36 38
 
37 39
 void servo_init() {
38 40
   #if NUM_SERVOS >= 1 && HAS_SERVO_0

+ 1
- 3
Marlin/src/module/stepper.cpp View File

@@ -2130,9 +2130,7 @@ uint32_t Stepper::block_phase_isr() {
2130 2130
       accelerate_until = current_block->accelerate_until << oversampling;
2131 2131
       decelerate_after = current_block->decelerate_after << oversampling;
2132 2132
 
2133
-      #if ENABLED(MIXING_EXTRUDER)
2134
-        MIXER_STEPPER_SETUP();
2135
-      #endif
2133
+      TERN_(MIXING_EXTRUDER, mixer.stepper_setup(current_block->b_color))
2136 2134
 
2137 2135
       TERN_(HAS_MULTI_EXTRUDER, stepper_extruder = current_block->extruder);
2138 2136
 

+ 63
- 21
Marlin/src/module/temperature.h View File

@@ -326,14 +326,28 @@ class Temperature {
326 326
       static const celsius_t hotend_maxtemp[HOTENDS];
327 327
       FORCE_INLINE static celsius_t hotend_max_target(const uint8_t e) { return hotend_maxtemp[e] - (HOTEND_OVERSHOOT); }
328 328
     #endif
329
-    TERN_(HAS_HEATED_BED, static bed_info_t temp_bed);
330
-    TERN_(HAS_TEMP_PROBE, static probe_info_t temp_probe);
331
-    TERN_(HAS_TEMP_CHAMBER, static chamber_info_t temp_chamber);
332
-    TERN_(HAS_TEMP_COOLER, static cooler_info_t temp_cooler);
329
+    #if ENABLED(HAS_HEATED_BED)
330
+      static bed_info_t temp_bed;
331
+    #endif
332
+    #if ENABLED(HAS_TEMP_PROBE)
333
+      static probe_info_t temp_probe;
334
+    #endif
335
+    #if ENABLED(HAS_TEMP_CHAMBER)
336
+      static chamber_info_t temp_chamber;
337
+    #endif
338
+    #if ENABLED(HAS_TEMP_COOLER)
339
+      static cooler_info_t temp_cooler;
340
+    #endif
333 341
 
334
-    TERN_(AUTO_POWER_E_FANS, static uint8_t autofan_speed[HOTENDS]);
335
-    TERN_(AUTO_POWER_CHAMBER_FAN, static uint8_t chamberfan_speed);
336
-    TERN_(AUTO_POWER_COOLER_FAN, static uint8_t coolerfan_speed);
342
+    #if ENABLED(AUTO_POWER_E_FANS)
343
+      static uint8_t autofan_speed[HOTENDS];
344
+    #endif
345
+    #if ENABLED(AUTO_POWER_CHAMBER_FAN)
346
+      static uint8_t chamberfan_speed;
347
+    #endif
348
+    #if ENABLED(AUTO_POWER_COOLER_FAN)
349
+      static uint8_t coolerfan_speed;
350
+    #endif
337 351
 
338 352
     #if ENABLED(FAN_SOFT_PWM)
339 353
       static uint8_t soft_pwm_amount_fan[FAN_COUNT],
@@ -403,11 +417,15 @@ class Temperature {
403 417
 
404 418
   private:
405 419
 
406
-    TERN_(EARLY_WATCHDOG, static bool inited);   // If temperature controller is running
420
+    #if ENABLED(EARLY_WATCHDOG)
421
+      static bool inited;   // If temperature controller is running
422
+    #endif
407 423
 
408 424
     static volatile bool raw_temps_ready;
409 425
 
410
-    TERN_(WATCH_HOTENDS, static hotend_watch_t watch_hotend[HOTENDS]);
426
+    #if ENABLED(WATCH_HOTENDS)
427
+      static hotend_watch_t watch_hotend[HOTENDS];
428
+    #endif
411 429
 
412 430
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
413 431
       static uint16_t redundant_temperature_raw;
@@ -419,22 +437,30 @@ class Temperature {
419 437
       static lpq_ptr_t lpq_ptr;
420 438
     #endif
421 439
 
422
-    TERN_(HAS_HOTEND, static temp_range_t temp_range[HOTENDS]);
440
+    #if ENABLED(HAS_HOTEND)
441
+      static temp_range_t temp_range[HOTENDS];
442
+    #endif
423 443
 
424 444
     #if HAS_HEATED_BED
425
-      TERN_(WATCH_BED, static bed_watch_t watch_bed);
445
+      #if ENABLED(WATCH_BED)
446
+        static bed_watch_t watch_bed;
447
+      #endif
426 448
       IF_DISABLED(PIDTEMPBED, static millis_t next_bed_check_ms);
427 449
       static int16_t mintemp_raw_BED, maxtemp_raw_BED;
428 450
     #endif
429 451
 
430 452
     #if HAS_HEATED_CHAMBER
431
-      TERN_(WATCH_CHAMBER, static chamber_watch_t watch_chamber);
453
+      #if ENABLED(WATCH_CHAMBER)
454
+        static chamber_watch_t watch_chamber;
455
+      #endif
432 456
       TERN(PIDTEMPCHAMBER,,static millis_t next_chamber_check_ms);
433 457
       static int16_t mintemp_raw_CHAMBER, maxtemp_raw_CHAMBER;
434 458
     #endif
435 459
 
436 460
     #if HAS_COOLER
437
-      TERN_(WATCH_COOLER, static cooler_watch_t watch_cooler);
461
+      #if ENABLED(WATCH_COOLER)
462
+        static cooler_watch_t watch_cooler;
463
+      #endif
438 464
       static millis_t next_cooler_check_ms, cooler_fan_flush_ms;
439 465
       static int16_t mintemp_raw_COOLER, maxtemp_raw_COOLER;
440 466
     #endif
@@ -447,9 +473,13 @@ class Temperature {
447 473
       static millis_t preheat_end_time[HOTENDS];
448 474
     #endif
449 475
 
450
-    TERN_(HAS_AUTO_FAN, static millis_t next_auto_fan_check_ms);
476
+    #if ENABLED(HAS_AUTO_FAN)
477
+      static millis_t next_auto_fan_check_ms;
478
+    #endif
451 479
 
452
-    TERN_(PROBING_HEATERS_OFF, static bool paused);
480
+    #if ENABLED(PROBING_HEATERS_OFF)
481
+      static bool paused;
482
+    #endif
453 483
 
454 484
   public:
455 485
     #if HAS_ADC_BUTTONS
@@ -457,7 +487,9 @@ class Temperature {
457 487
       static uint16_t ADCKey_count;
458 488
     #endif
459 489
 
460
-    TERN_(PID_EXTRUSION_SCALING, static int16_t lpq_len);
490
+    #if ENABLED(PID_EXTRUSION_SCALING)
491
+      static int16_t lpq_len;
492
+    #endif
461 493
 
462 494
     /**
463 495
      * Instance Methods
@@ -534,7 +566,9 @@ class Temperature {
534 566
 
535 567
       static constexpr inline uint8_t fanPercent(const uint8_t speed) { return ui8_to_percent(speed); }
536 568
 
537
-      TERN_(ADAPTIVE_FAN_SLOWING, static uint8_t fan_speed_scaler[FAN_COUNT]);
569
+      #if ENABLED(ADAPTIVE_FAN_SLOWING)
570
+        static uint8_t fan_speed_scaler[FAN_COUNT];
571
+      #endif
538 572
 
539 573
       static inline uint8_t scaledFanSpeed(const uint8_t target, const uint8_t fs) {
540 574
         UNUSED(target); // Potentially unused!
@@ -843,7 +877,9 @@ class Temperature {
843 877
       #endif
844 878
     #endif
845 879
 
846
-    TERN_(HAS_DISPLAY, static void set_heating_message(const uint8_t e));
880
+    #if ENABLED(HAS_DISPLAY)
881
+      static void set_heating_message(const uint8_t e);
882
+    #endif
847 883
 
848 884
     #if HAS_LCD_MENU && HAS_TEMPERATURE
849 885
       static void lcd_preheat(const uint8_t e, const int8_t indh, const int8_t indb);
@@ -866,9 +902,15 @@ class Temperature {
866 902
 
867 903
     static void checkExtruderAutoFans();
868 904
 
869
-    TERN_(HAS_HOTEND,     static float get_pid_output_hotend(const uint8_t e));
870
-    TERN_(PIDTEMPBED,     static float get_pid_output_bed());
871
-    TERN_(PIDTEMPCHAMBER, static float get_pid_output_chamber());
905
+    #if ENABLED(HAS_HOTEND)
906
+      static float get_pid_output_hotend(const uint8_t e);
907
+    #endif
908
+    #if ENABLED(PIDTEMPBED)
909
+      static float get_pid_output_bed();
910
+    #endif
911
+    #if ENABLED(PIDTEMPCHAMBER)
912
+      static float get_pid_output_chamber();
913
+    #endif
872 914
 
873 915
     static void _temp_error(const heater_id_t e, PGM_P const serial_msg, PGM_P const lcd_msg);
874 916
     static void min_temp_error(const heater_id_t e);

+ 5
- 3
Marlin/src/module/tool_change.h View File

@@ -109,9 +109,11 @@
109 109
 
110 110
 #endif
111 111
 
112
-TERN_(ELECTROMAGNETIC_SWITCHING_TOOLHEAD, void est_init());
113
-
114
-TERN_(SWITCHING_TOOLHEAD, void swt_init());
112
+#if ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD)
113
+  void est_init();
114
+#elif ENABLED(SWITCHING_TOOLHEAD)
115
+  void swt_init();
116
+#endif
115 117
 
116 118
 /**
117 119
  * Perform a tool-change, which may result in moving the

+ 3
- 1
Marlin/src/sd/cardreader.cpp View File

@@ -1084,7 +1084,9 @@ void CardReader::cdroot() {
1084 1084
           #if DISABLED(SDSORT_USES_RAM)
1085 1085
             selectFileByIndex(o1);              // Pre-fetch the first entry and save it
1086 1086
             strcpy(name1, longest_filename());  // so the loop only needs one fetch
1087
-            TERN_(HAS_FOLDER_SORTING, bool dir1 = flag.filenameIsDir);
1087
+            #if ENABLED(HAS_FOLDER_SORTING)
1088
+              bool dir1 = flag.filenameIsDir;
1089
+            #endif
1088 1090
           #endif
1089 1091
 
1090 1092
           for (uint16_t j = 0; j < i; ++j) {

Loading…
Cancel
Save