From 46453905d63638e6082dcc32a48714a5c258002a Mon Sep 17 00:00:00 2001
From: Scott Lahteine <sourcetree@thinkyhead.com>
Date: Mon, 3 Aug 2015 12:30:37 -0700
Subject: [PATCH] Apply remaining ENABLED/DISABLED conditionals

---
 Marlin/Conditionals.h                         |  2 +-
 Marlin/M100_Free_Mem_Chk.cpp                  |  6 ++--
 Marlin/Marlin_main.cpp                        | 14 +++++-----
 Marlin/buzzer.cpp                             |  2 +-
 Marlin/dogm_lcd_implementation.h              |  6 ++--
 .../Felix/Configuration.h                     |  2 +-
 .../Felix/Configuration_DUAL.h                |  4 +--
 .../Hephestos/Configuration.h                 |  2 +-
 .../K8200/Configuration.h                     |  2 +-
 .../RepRapWorld/Megatronics/Configuration.h   |  2 +-
 .../SCARA/Configuration.h                     |  2 +-
 .../WITBOX/Configuration.h                    |  2 +-
 .../adafruit/ST7565/Configuration.h           |  2 +-
 .../delta/biv2.5/Configuration.h              |  2 +-
 .../delta/generic/Configuration.h             |  2 +-
 .../delta/kossel_mini/Configuration.h         |  2 +-
 .../delta/kossel_pro/Configuration.h          |  2 +-
 .../makibox/Configuration.h                   |  2 +-
 .../tvrrug/Round2/Configuration.h             |  2 +-
 Marlin/pins_MEGACONTROLLER.h                  |  2 +-
 Marlin/pins_MEGATRONICS.h                     |  2 +-
 Marlin/pins_PRINTRBOARD.h                     |  2 +-
 Marlin/pins_RAMPS_13.h                        |  2 +-
 Marlin/pins_RIGIDBOARD.h                      |  8 +++---
 Marlin/planner.cpp                            | 12 ++++----
 Marlin/servo.cpp                              |  2 +-
 Marlin/stepper.cpp                            | 28 +++++++++----------
 Marlin/ultralcd.cpp                           |  2 +-
 .../ultralcd_implementation_hitachi_HD44780.h |  2 +-
 29 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h
index f3896d1f6c..8ea88b6e07 100644
--- a/Marlin/Conditionals.h
+++ b/Marlin/Conditionals.h
@@ -75,7 +75,7 @@
     #define NEWPANEL
   #endif
 
-  #ifdef MINIPANEL
+  #if ENABLED(MINIPANEL)
    #define DOGLCD
    #define SDSUPPORT
    #define ULTIPANEL
diff --git a/Marlin/M100_Free_Mem_Chk.cpp b/Marlin/M100_Free_Mem_Chk.cpp
index 4ce8717d37..21f2b43caf 100644
--- a/Marlin/M100_Free_Mem_Chk.cpp
+++ b/Marlin/M100_Free_Mem_Chk.cpp
@@ -23,7 +23,7 @@
 
 #include "Marlin.h"
 
-#ifdef M100_FREE_MEMORY_WATCHER
+#if ENABLED(M100_FREE_MEMORY_WATCHER)
 extern void *__brkval;
 extern size_t  __heap_start, __heap_end, __flp;
 
@@ -73,7 +73,7 @@ int i, j, n;
 // the right hand column to help spotting them.
 //
 
-#ifdef M100_FREE_MEMORY_DUMPER			// Comment out to remove Dump sub-command
+#if ENABLED(M100_FREE_MEMORY_DUMPER) // Disable to remove Dump sub-command
 	if ( code_seen('D') ) {
  		ptr = (unsigned char *) __brkval;
 
@@ -163,7 +163,7 @@ int i, j, n;
 // M100 C x  Corrupts x locations in the free memory pool and reports the locations of the corruption.
 // This is useful to check the correctness of the M100 D and the M100 F commands.
 //
-#ifdef M100_FREE_MEMORY_CORRUPTOR
+#if ENABLED(M100_FREE_MEMORY_CORRUPTOR)
 	if ( code_seen('C') ) {
 		int x;			// x gets the # of locations to corrupt within the memory pool
 		x = code_value();
diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index e702b84bad..8f1239eb48 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -4900,7 +4900,7 @@ inline void gcode_M503() {
     LCD_ALERTMESSAGEPGM(MSG_FILAMENTCHANGE);
     millis_t next_tick = 0;
     while (!lcd_clicked()) {
-      #ifndef AUTO_FILAMENT_CHANGE
+      #if DISABLED(AUTO_FILAMENT_CHANGE)
         millis_t ms = millis();
         if (ms >= next_tick) {
           lcd_quick_feedback();
@@ -4918,7 +4918,7 @@ inline void gcode_M503() {
     } // while(!lcd_clicked)
     lcd_quick_feedback(); // click sound feedback
 
-    #ifdef AUTO_FILAMENT_CHANGE
+    #if ENABLED(AUTO_FILAMENT_CHANGE)
       current_position[E_AXIS] = 0;
       st_synchronize();
     #endif
@@ -5377,7 +5377,7 @@ void process_next_command() {
           break;
       #endif // ENABLE_AUTO_BED_LEVELING && Z_PROBE_REPEATABILITY_TEST
 
-      #ifdef M100_FREE_MEMORY_WATCHER
+      #if ENABLED(M100_FREE_MEMORY_WATCHER)
         case 100:
           gcode_M100();
           break;
@@ -6228,9 +6228,9 @@ void plan_arc(
 
     clamp_to_software_endstops(arc_target);
 
-    #if defined(DELTA) || defined(SCARA)
+    #if ENABLED(DELTA) || ENABLED(SCARA)
       calculate_delta(arc_target);
-      #ifdef ENABLE_AUTO_BED_LEVELING
+      #if ENABLED(ENABLE_AUTO_BED_LEVELING)
         adjust_delta(arc_target);
       #endif
       plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], arc_target[E_AXIS], feed_rate, active_extruder);
@@ -6240,9 +6240,9 @@ void plan_arc(
   }
 
   // Ensure last segment arrives at target location.
-  #if defined(DELTA) || defined(SCARA)
+  #if ENABLED(DELTA) || ENABLED(SCARA)
     calculate_delta(target);
-    #ifdef ENABLE_AUTO_BED_LEVELING
+    #if ENABLED(ENABLE_AUTO_BED_LEVELING)
       adjust_delta(target);
     #endif
     plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], target[E_AXIS], feed_rate, active_extruder);
diff --git a/Marlin/buzzer.cpp b/Marlin/buzzer.cpp
index a419cffbb7..fb914c5b04 100644
--- a/Marlin/buzzer.cpp
+++ b/Marlin/buzzer.cpp
@@ -9,7 +9,7 @@
         lcd_buzz(duration, freq);
       #elif PIN_EXISTS(BEEPER) // on-board buzzers have no further condition
         SET_OUTPUT(BEEPER_PIN);
-        #ifdef SPEAKER // a speaker needs a AC ore a pulsed DC
+        #if ENABLED(SPEAKER) // a speaker needs a AC ore a pulsed DC
           //tone(BEEPER_PIN, freq, duration); // needs a PWMable pin
           unsigned int delay = 1000000 / freq / 2;
           int i = duration * freq / 1000;
diff --git a/Marlin/dogm_lcd_implementation.h b/Marlin/dogm_lcd_implementation.h
index daf2c0d689..5e0b270d9c 100644
--- a/Marlin/dogm_lcd_implementation.h
+++ b/Marlin/dogm_lcd_implementation.h
@@ -125,10 +125,10 @@
 #elif ENABLED(U8GLIB_LM6059_AF)
   // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
   U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);
-#elif defined U8GLIB_SSD1306
+#elif ENABLED(U8GLIB_SSD1306)
   // Generic support for SSD1306 OLED I2C LCDs
   U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
-#elif defined(MINIPANEL)
+#elif ENABLED(MINIPANEL)
   // The MINIPanel display
   U8GLIB_MINI12864 u8g(DOGLCD_CS, DOGLCD_A0);
 #else
@@ -206,7 +206,7 @@ static void lcd_implementation_init() {
     pinMode(LCD_PIN_RESET, OUTPUT);           
     digitalWrite(LCD_PIN_RESET, HIGH);
   #endif
-  #ifndef MINIPANEL//setContrast not working for Mini Panel
+  #if DISABLED(MINIPANEL) // setContrast not working for Mini Panel
     u8g.setContrast(lcd_contrast);	
   #endif
   // FIXME: remove this workaround
diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h
index eed4b979cc..0ffcc9c1a9 100644
--- a/Marlin/example_configurations/Felix/Configuration.h
+++ b/Marlin/example_configurations/Felix/Configuration.h
@@ -301,7 +301,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h
index 3a6ae8d721..1f59243194 100644
--- a/Marlin/example_configurations/Felix/Configuration_DUAL.h
+++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h
@@ -286,7 +286,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
@@ -727,7 +727,7 @@ const bool Z_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the logic
 // With this option servos are powered only during movement, then turned off to prevent jitter.
 //#define DEACTIVATE_SERVOS_AFTER_MOVE
 
-#ifdef DEACTIVATE_SERVOS_AFTER_MOVE
+#if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
   // Delay (in microseconds) before turning the servo off. This depends on the servo speed.
   // 300ms is a good value but you can try less delay.
   // If the servo can't reach the requested position, increase it.
diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h
index b6fc265656..d053b1b0be 100644
--- a/Marlin/example_configurations/Hephestos/Configuration.h
+++ b/Marlin/example_configurations/Hephestos/Configuration.h
@@ -311,7 +311,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h
index f0a766f27c..2a3a062cfa 100644
--- a/Marlin/example_configurations/K8200/Configuration.h
+++ b/Marlin/example_configurations/K8200/Configuration.h
@@ -307,7 +307,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
index 6c80e9fb21..45b73393a1 100644
--- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
+++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
@@ -319,7 +319,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h
index ce57bd9877..458e24cc8f 100644
--- a/Marlin/example_configurations/SCARA/Configuration.h
+++ b/Marlin/example_configurations/SCARA/Configuration.h
@@ -327,7 +327,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 //#define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h
index 718c1518d1..b191e0eca7 100644
--- a/Marlin/example_configurations/WITBOX/Configuration.h
+++ b/Marlin/example_configurations/WITBOX/Configuration.h
@@ -311,7 +311,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h
index 31b8ec589d..bc8d66f4a1 100644
--- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h
+++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h
@@ -319,7 +319,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h
index 8a9d9395b9..124b3a56ce 100644
--- a/Marlin/example_configurations/delta/biv2.5/Configuration.h
+++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h
@@ -354,7 +354,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h
index 6564673aa1..01739f5e15 100644
--- a/Marlin/example_configurations/delta/generic/Configuration.h
+++ b/Marlin/example_configurations/delta/generic/Configuration.h
@@ -354,7 +354,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h
index 04a1e46840..90d9c18e8c 100644
--- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h
+++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h
@@ -354,7 +354,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h
index d4fbcb326d..2b6f429603 100644
--- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h
+++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h
@@ -341,7 +341,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h
index 2fd0783673..411f344be3 100644
--- a/Marlin/example_configurations/makibox/Configuration.h
+++ b/Marlin/example_configurations/makibox/Configuration.h
@@ -322,7 +322,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h
index 2067a215ab..eba86a7a50 100644
--- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h
+++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h
@@ -309,7 +309,7 @@ Here are some standard links for getting your machine calibrated:
 // coarse Endstop Settings
 #define ENDSTOPPULLUPS // Comment this out (using // at the start of the line) to disable the endstop pullup resistors
 
-#ifndef ENDSTOPPULLUPS
+#if DISABLED(ENDSTOPPULLUPS)
   // fine endstop settings: Individual pullups. will be ignored if ENDSTOPPULLUPS is defined
   // #define ENDSTOPPULLUP_XMAX
   // #define ENDSTOPPULLUP_YMAX
diff --git a/Marlin/pins_MEGACONTROLLER.h b/Marlin/pins_MEGACONTROLLER.h
index d12fcb218e..c472a9d384 100644
--- a/Marlin/pins_MEGACONTROLLER.h
+++ b/Marlin/pins_MEGACONTROLLER.h
@@ -80,7 +80,7 @@
   #define TEMP_BED_PIN 1 // ANALOG NUMBERING
 #endif
 
-#ifdef MINIPANEL
+#if ENABLED(MINIPANEL)
     #define BEEPER_PIN 46
     // Pins for DOGM SPI LCD Support
     #define DOGLCD_A0  47
diff --git a/Marlin/pins_MEGATRONICS.h b/Marlin/pins_MEGATRONICS.h
index 31812a773a..134c888834 100644
--- a/Marlin/pins_MEGATRONICS.h
+++ b/Marlin/pins_MEGATRONICS.h
@@ -60,7 +60,7 @@
 
 #define BEEPER_PIN         33   // AUX-4
 
-#if defined(ULTRA_LCD) && defined(NEWPANEL)
+#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
 
   #define LCD_PINS_RS     16
   #define LCD_PINS_ENABLE 17
diff --git a/Marlin/pins_PRINTRBOARD.h b/Marlin/pins_PRINTRBOARD.h
index f6eff9c9b5..4dbb104a71 100644
--- a/Marlin/pins_PRINTRBOARD.h
+++ b/Marlin/pins_PRINTRBOARD.h
@@ -45,7 +45,7 @@
 #endif
 
 #define X_STOP_PIN         35
-#ifdef SDSUPPORT
+#if ENABLED(SDSUPPORT)
   #define Y_STOP_PIN       37 // Move Ystop to Estop socket
 #else
   #define Y_STOP_PIN        8 // Ystop in Ystop socket
diff --git a/Marlin/pins_RAMPS_13.h b/Marlin/pins_RAMPS_13.h
index 625341c268..f0cbe29c39 100644
--- a/Marlin/pins_RAMPS_13.h
+++ b/Marlin/pins_RAMPS_13.h
@@ -182,7 +182,7 @@
       #define DOGLCD_CS 29
       #define DOGLCD_A0 27
       #define LCD_PIN_BL 33
-    #elif defined(MINIPANEL)
+    #elif ENABLED(MINIPANEL)
        #define BEEPER_PIN 42
        // Pins for DOGM SPI LCD Support
        #define DOGLCD_A0  44
diff --git a/Marlin/pins_RIGIDBOARD.h b/Marlin/pins_RIGIDBOARD.h
index 881b0ad37b..e1b3a32d8f 100644
--- a/Marlin/pins_RIGIDBOARD.h
+++ b/Marlin/pins_RIGIDBOARD.h
@@ -46,7 +46,7 @@
   #undef  SD_DETECT_PIN
   #define SD_DETECT_PIN 22
 
-#elif defined(REPRAP_DISCOUNT_SMART_CONTROLLER)
+#elif ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
 
   #undef BEEPER_PIN
   #define BEEPER_PIN -1
@@ -61,10 +61,10 @@
 
 // SPI for Max6675 Thermocouple
 #undef MAX6675_SS
-#ifndef SDSUPPORT
-  #define MAX6675_SS       53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card
-#else
+#if ENABLED(SDSUPPORT)
   #define MAX6675_SS       49 // Don't use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present
+#else
+  #define MAX6675_SS       53 // Don't use pin 53 if there is even the remote possibility of using Display/SD card
 #endif
 
 // RigidBot swaps E0 / E1 plugs vs RAMPS 1.3
diff --git a/Marlin/planner.cpp b/Marlin/planner.cpp
index b1c7a46e25..caa9228ed6 100644
--- a/Marlin/planner.cpp
+++ b/Marlin/planner.cpp
@@ -542,7 +542,7 @@ float junction_deviation = 0.1;
     block->steps[A_AXIS] = labs(dx + dy);
     block->steps[B_AXIS] = labs(dx - dy);
     block->steps[Z_AXIS] = labs(dz);
-  #elif defined(COREXZ)
+  #elif ENABLED(COREXZ)
     // corexz planning
     block->steps[A_AXIS] = labs(dx + dz);
     block->steps[Y_AXIS] = labs(dy);
@@ -577,7 +577,7 @@ float junction_deviation = 0.1;
     if (dz < 0) db |= BIT(Z_AXIS);
     if (dx + dy < 0) db |= BIT(A_AXIS); // Motor A direction
     if (dx - dy < 0) db |= BIT(B_AXIS); // Motor B direction
-  #elif defined(COREXZ)
+  #elif ENABLED(COREXZ)
     if (dx < 0) db |= BIT(X_HEAD); // Save the real Extruder (head) direction in X Axis
     if (dy < 0) db |= BIT(Y_AXIS);
     if (dz < 0) db |= BIT(Z_HEAD); // ...and Z
@@ -599,10 +599,10 @@ float junction_deviation = 0.1;
       enable_x();
       enable_y();
     }
-    #ifndef Z_LATE_ENABLE
+    #if DISABLED(Z_LATE_ENABLE)
       if (block->steps[Z_AXIS]) enable_z();
     #endif
-  #elif defined(COREXZ)
+  #elif ENABLED(COREXZ)
     if (block->steps[A_AXIS] || block->steps[C_AXIS]) {
       enable_x();
       enable_z();
@@ -611,7 +611,7 @@ float junction_deviation = 0.1;
   #else
     if (block->steps[X_AXIS]) enable_x();
     if (block->steps[Y_AXIS]) enable_y();
-    #ifndef Z_LATE_ENABLE
+    #if DISABLED(Z_LATE_ENABLE)
       if (block->steps[Z_AXIS]) enable_z();
     #endif
   #endif
@@ -700,7 +700,7 @@ float junction_deviation = 0.1;
     delta_mm[Z_AXIS] = dz / axis_steps_per_unit[Z_AXIS];
     delta_mm[A_AXIS] = (dx + dy) / axis_steps_per_unit[A_AXIS];
     delta_mm[B_AXIS] = (dx - dy) / axis_steps_per_unit[B_AXIS];
-  #elif defined(COREXZ)
+  #elif ENABLED(COREXZ)
     float delta_mm[6];
     delta_mm[X_HEAD] = dx / axis_steps_per_unit[A_AXIS];
     delta_mm[Y_AXIS] = dy / axis_steps_per_unit[Y_AXIS];
diff --git a/Marlin/servo.cpp b/Marlin/servo.cpp
index f259891d2d..ff2e46f759 100644
--- a/Marlin/servo.cpp
+++ b/Marlin/servo.cpp
@@ -307,7 +307,7 @@ bool Servo::attached() { return servo_info[this->servoIndex].Pin.isActive; }
 void Servo::move(int value) {
   if (this->attach(0) >= 0) {
     this->write(value);
-    #ifdef DEACTIVATE_SERVOS_AFTER_MOVE
+    #if ENABLED(DEACTIVATE_SERVOS_AFTER_MOVE)
       delay(SERVO_DEACTIVATION_DELAY);
       this->detach();
     #endif
diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp
index 80f1bb272f..3bf61315d8 100644
--- a/Marlin/stepper.cpp
+++ b/Marlin/stepper.cpp
@@ -289,7 +289,7 @@ void enable_endstops(bool check) { check_endstops = check; }
 // Check endstops
 inline void update_endstops() {
   
-  #ifdef Z_DUAL_ENDSTOPS
+  #if ENABLED(Z_DUAL_ENDSTOPS)
     uint16_t
   #else
     byte
@@ -317,12 +317,12 @@ inline void update_endstops() {
       step_events_completed = current_block->step_event_count; \
     }
   
-  #ifdef COREXY
+  #if ENABLED(COREXY)
     // Head direction in -X axis for CoreXY bots.
     // If DeltaX == -DeltaY, the movement is only in Y axis
     if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, B_AXIS))) {
       if (TEST(out_bits, X_HEAD))
-  #elif defined(COREXZ)
+  #elif ENABLED(COREXZ)
     // Head direction in -X axis for CoreXZ bots.
     // If DeltaX == -DeltaZ, the movement is only in Z axis
     if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) == TEST(out_bits, C_AXIS))) {
@@ -331,7 +331,7 @@ inline void update_endstops() {
       if (TEST(out_bits, X_AXIS))   // stepping along -X axis (regular Cartesian bot)
   #endif
       { // -direction
-        #ifdef DUAL_X_CARRIAGE
+        #if ENABLED(DUAL_X_CARRIAGE)
           // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
           if ((current_block->active_extruder == 0 && X_HOME_DIR == -1) || (current_block->active_extruder != 0 && X2_HOME_DIR == -1))
         #endif
@@ -342,7 +342,7 @@ inline void update_endstops() {
           }
       }
       else { // +direction
-        #ifdef DUAL_X_CARRIAGE
+        #if ENABLED(DUAL_X_CARRIAGE)
           // with 2 x-carriages, endstops are only checked in the homing direction for the active extruder
           if ((current_block->active_extruder == 0 && X_HOME_DIR == 1) || (current_block->active_extruder != 0 && X2_HOME_DIR == 1))
         #endif
@@ -352,11 +352,11 @@ inline void update_endstops() {
             #endif
           }
       }
-  #if defined(COREXY) || defined(COREXZ)
+  #if ENABLED(COREXY) || ENABLED(COREXZ)
     }
   #endif
 
-  #ifdef COREXY
+  #if ENABLED(COREXY)
     // Head direction in -Y axis for CoreXY bots.
     // If DeltaX == DeltaY, the movement is only in X axis
     if ((current_block->steps[A_AXIS] != current_block->steps[B_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, B_AXIS))) {
@@ -374,11 +374,11 @@ inline void update_endstops() {
           UPDATE_ENDSTOP(Y, MAX);
         #endif
       }
-  #if defined(COREXY)
+  #if ENABLED(COREXY)
     }
   #endif
 
-  #ifdef COREXZ
+  #if ENABLED(COREXZ)
     // Head direction in -Z axis for CoreXZ bots.
     // If DeltaX == DeltaZ, the movement is only in X axis
     if ((current_block->steps[A_AXIS] != current_block->steps[C_AXIS]) || (TEST(out_bits, A_AXIS) != TEST(out_bits, C_AXIS))) {
@@ -389,7 +389,7 @@ inline void update_endstops() {
       { // z -direction
         #if HAS_Z_MIN
 
-          #ifdef Z_DUAL_ENDSTOPS
+          #if ENABLED(Z_DUAL_ENDSTOPS)
             SET_ENDSTOP_BIT(Z, MIN);
               #if HAS_Z2_MIN
                 SET_ENDSTOP_BIT(Z2, MIN);
@@ -411,7 +411,7 @@ inline void update_endstops() {
           #endif // !Z_DUAL_ENDSTOPS
         #endif // Z_MIN_PIN
 
-        #ifdef Z_PROBE_ENDSTOP
+        #if ENABLED(Z_PROBE_ENDSTOP)
           UPDATE_ENDSTOP(Z, PROBE);
 
           if (TEST_ENDSTOP(Z_PROBE))
@@ -424,7 +424,7 @@ inline void update_endstops() {
       else { // z +direction
         #if HAS_Z_MAX
 
-          #ifdef Z_DUAL_ENDSTOPS
+          #if ENABLED(Z_DUAL_ENDSTOPS)
 
             SET_ENDSTOP_BIT(Z, MAX);
               #if HAS_Z2_MAX
@@ -449,7 +449,7 @@ inline void update_endstops() {
           #endif // !Z_DUAL_ENDSTOPS
         #endif // Z_MAX_PIN
         
-        #ifdef Z_PROBE_ENDSTOP
+        #if ENABLED(Z_PROBE_ENDSTOP)
           UPDATE_ENDSTOP(Z, PROBE);
           
           if (TEST_ENDSTOP(Z_PROBE))
@@ -459,7 +459,7 @@ inline void update_endstops() {
           }
         #endif
       }
-  #if defined(COREXZ)
+  #if ENABLED(COREXZ)
     }
   #endif  
   old_endstop_bits = current_endstop_bits;
diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp
index e4c10ccfd8..12910085a4 100644
--- a/Marlin/ultralcd.cpp
+++ b/Marlin/ultralcd.cpp
@@ -275,7 +275,7 @@ static void lcd_status_screen() {
 
   #if ENABLED(LCD_PROGRESS_BAR)
     millis_t ms = millis();
-    #ifndef PROGRESS_MSG_ONCE
+    #if DISABLED(PROGRESS_MSG_ONCE)
       if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
         progress_bar_ms = ms;
       }
diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h
index eab93b4ce0..5b3f4307cf 100644
--- a/Marlin/ultralcd_implementation_hitachi_HD44780.h
+++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h
@@ -6,7 +6,7 @@
 * When selecting the Russian language, a slightly different LCD implementation is used to handle UTF8 characters.
 **/
 
-//#ifndef REPRAPWORLD_KEYPAD
+//#if DISABLED(REPRAPWORLD_KEYPAD)
 //  extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
 //#else
   extern volatile uint8_t buttons;  //an extended version of the last checked buttons in a bit array.
-- 
GitLab