Преглед на файлове

Overridable Options - Part 7 (PR#2559)

Apply `ENABLED` / `DISABLED` macros to LCD-related files.
Scott Lahteine преди 9 години
родител
ревизия
0d8989fc14
променени са 4 файла, в които са добавени 152 реда и са изтрити 152 реда
  1. 27
    27
      Marlin/dogm_lcd_implementation.h
  2. 86
    86
      Marlin/ultralcd.cpp
  3. 9
    9
      Marlin/ultralcd.h
  4. 30
    30
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 27
- 27
Marlin/dogm_lcd_implementation.h Целия файл

@@ -18,7 +18,7 @@
18 18
  * Implementation of the LCD display routines for a DOGM128 graphic display. These are common LCD 128x64 pixel graphic displays.
19 19
  */
20 20
 
21
-#ifdef ULTIPANEL
21
+#if ENABLED(ULTIPANEL)
22 22
   #define BLEN_A 0
23 23
   #define BLEN_B 1
24 24
   #define BLEN_C 2
@@ -35,12 +35,12 @@
35 35
 #include "ultralcd_st7920_u8glib_rrd.h"
36 36
 #include "Configuration.h"
37 37
 
38
-#if !defined(MAPPER_C2C3) && !defined(MAPPER_NON) && defined(USE_BIG_EDIT_FONT)
38
+#if DISABLED(MAPPER_C2C3) && DISABLED(MAPPER_NON) && ENABLED(USE_BIG_EDIT_FONT)
39 39
    #undef USE_BIG_EDIT_FONT
40 40
 #endif
41 41
 
42 42
 
43
-#ifdef USE_SMALL_INFOFONT
43
+#if ENABLED(USE_SMALL_INFOFONT)
44 44
   #include "dogm_font_data_6x9_marlin.h"
45 45
   #define FONT_STATUSMENU_NAME u8g_font_6x9
46 46
 #else
@@ -50,17 +50,17 @@
50 50
 #include "dogm_font_data_Marlin_symbols.h"   // The Marlin special symbols
51 51
 #define FONT_SPECIAL_NAME Marlin_symbols
52 52
 
53
-#ifndef SIMULATE_ROMFONT
54
-  #if defined( DISPLAY_CHARSET_ISO10646_1 )
53
+#if DISABLED(SIMULATE_ROMFONT)
54
+  #if ENABLED(DISPLAY_CHARSET_ISO10646_1)
55 55
     #include "dogm_font_data_ISO10646_1.h"
56 56
     #define FONT_MENU_NAME ISO10646_1_5x7
57
-  #elif defined( DISPLAY_CHARSET_ISO10646_5 )
57
+  #elif ENABLED(DISPLAY_CHARSET_ISO10646_5)
58 58
     #include "dogm_font_data_ISO10646_5_Cyrillic.h"
59 59
     #define FONT_MENU_NAME ISO10646_5_Cyrillic_5x7
60
-  #elif defined( DISPLAY_CHARSET_ISO10646_KANA )
60
+  #elif ENABLED(DISPLAY_CHARSET_ISO10646_KANA)
61 61
     #include "dogm_font_data_ISO10646_Kana.h"
62 62
     #define FONT_MENU_NAME ISO10646_Kana_5x7
63
-  #elif defined( DISPLAY_CHARSET_ISO10646_CN )
63
+  #elif ENABLED(DISPLAY_CHARSET_ISO10646_CN)
64 64
     #include "dogm_font_data_ISO10646_CN.h"
65 65
     #define FONT_MENU_NAME ISO10646_CN
66 66
     #define TALL_FONT_CORRECTION 1
@@ -69,13 +69,13 @@
69 69
     #define FONT_MENU_NAME ISO10646_1_5x7
70 70
   #endif
71 71
 #else // SIMULATE_ROMFONT
72
-  #if defined( DISPLAY_CHARSET_HD44780_JAPAN )
72
+  #if ENABLED(DISPLAY_CHARSET_HD44780_JAPAN)
73 73
     #include "dogm_font_data_HD44780_J.h"
74 74
     #define FONT_MENU_NAME HD44780_J_5x7
75
-  #elif defined( DISPLAY_CHARSET_HD44780_WESTERN )
75
+  #elif ENABLED(DISPLAY_CHARSET_HD44780_WESTERN)
76 76
     #include "dogm_font_data_HD44780_W.h"
77 77
     #define FONT_MENU_NAME HD44780_W_5x7
78
-  #elif defined( DISPLAY_CHARSET_HD44780_CYRILLIC )
78
+  #elif ENABLED(DISPLAY_CHARSET_HD44780_CYRILLIC)
79 79
     #include "dogm_font_data_HD44780_C.h"
80 80
     #define FONT_MENU_NAME HD44780_C_5x7
81 81
   #else // fall-back
@@ -94,7 +94,7 @@
94 94
 // DOGM parameters (size in pixels)
95 95
 #define DOG_CHAR_WIDTH         6
96 96
 #define DOG_CHAR_HEIGHT        12
97
-#ifdef USE_BIG_EDIT_FONT
97
+#if ENABLED(USE_BIG_EDIT_FONT)
98 98
   #define FONT_MENU_EDIT_NAME u8g_font_9x18
99 99
   #define DOG_CHAR_WIDTH_EDIT  9
100 100
   #define DOG_CHAR_HEIGHT_EDIT 18
@@ -113,16 +113,16 @@
113 113
 #define START_ROW              0
114 114
 
115 115
 // LCD selection
116
-#ifdef U8GLIB_ST7920
116
+#if ENABLED(U8GLIB_ST7920)
117 117
   //U8GLIB_ST7920_128X64_RRD u8g(0,0,0);
118 118
   U8GLIB_ST7920_128X64_RRD u8g(0);
119
-#elif defined(MAKRPANEL)
119
+#elif ENABLED(MAKRPANEL)
120 120
   // The MaKrPanel display, ST7565 controller as well
121 121
   U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
122
-#elif defined(VIKI2) || defined(miniVIKI)
122
+#elif ENABLED(VIKI2) || ENABLED(miniVIKI)
123 123
   // Mini Viki and Viki 2.0 LCD, ST7565 controller as well
124 124
   U8GLIB_NHD_C12864 u8g(DOGLCD_CS, DOGLCD_A0);
125
-#elif defined(U8GLIB_LM6059_AF)
125
+#elif ENABLED(U8GLIB_LM6059_AF)
126 126
   // Based on the Adafruit ST7565 (http://www.adafruit.com/products/250)
127 127
   U8GLIB_LM6059 u8g(DOGLCD_CS, DOGLCD_A0);
128 128
 #elif defined U8GLIB_SSD1306
@@ -195,12 +195,12 @@ static bool show_splashscreen = true;
195 195
 /* Warning: This function is called from interrupt context */
196 196
 static void lcd_implementation_init() {
197 197
 
198
-  #ifdef LCD_PIN_BL // Enable LCD backlight
198
+  #if ENABLED(LCD_PIN_BL) // Enable LCD backlight
199 199
     pinMode(LCD_PIN_BL, OUTPUT);
200 200
 	  digitalWrite(LCD_PIN_BL, HIGH);
201 201
   #endif
202 202
 
203
-  #ifdef LCD_PIN_RESET
203
+  #if ENABLED(LCD_PIN_RESET)
204 204
     pinMode(LCD_PIN_RESET, OUTPUT);           
205 205
     digitalWrite(LCD_PIN_RESET, HIGH);
206 206
   #endif
@@ -212,17 +212,17 @@ static void lcd_implementation_init() {
212 212
   // pinMode(17, OUTPUT);	// Enable LCD backlight
213 213
   // digitalWrite(17, HIGH);
214 214
 
215
-  #ifdef LCD_SCREEN_ROT_90
215
+  #if ENABLED(LCD_SCREEN_ROT_90)
216 216
     u8g.setRot90();   // Rotate screen by 90°
217
-  #elif defined(LCD_SCREEN_ROT_180)
217
+  #elif ENABLED(LCD_SCREEN_ROT_180)
218 218
     u8g.setRot180();	// Rotate screen by 180°
219
-  #elif defined(LCD_SCREEN_ROT_270)
219
+  #elif ENABLED(LCD_SCREEN_ROT_270)
220 220
     u8g.setRot270();	// Rotate screen by 270°
221 221
   #endif
222 222
 	
223 223
   // Show splashscreen
224 224
   int offx = (u8g.getWidth() - START_BMPWIDTH) / 2;
225
-  #ifdef START_BMPHIGH
225
+  #if ENABLED(START_BMPHIGH)
226 226
     int offy = 0;
227 227
   #else
228 228
     int offy = DOG_CHAR_HEIGHT;
@@ -277,7 +277,7 @@ static void lcd_implementation_status_screen() {
277 277
   // Symbols menu graphics, animated fan
278 278
   u8g.drawBitmapP(9,1,STATUS_SCREENBYTEWIDTH,STATUS_SCREENHEIGHT, (blink % 2) && fanSpeed ? status_screen0_bmp : status_screen1_bmp);
279 279
  
280
-  #ifdef SDSUPPORT
280
+  #if ENABLED(SDSUPPORT)
281 281
     // SD Card Symbol
282 282
     u8g.drawBox(42, 42 - TALL_FONT_CORRECTION, 8, 7);
283 283
     u8g.drawBox(50, 44 - TALL_FONT_CORRECTION, 2, 5);
@@ -332,7 +332,7 @@ static void lcd_implementation_status_screen() {
332 332
   #define XYZ_BASELINE 38
333 333
   lcd_setFont(FONT_STATUSMENU);
334 334
 
335
-  #ifdef USE_SMALL_INFOFONT
335
+  #if ENABLED(USE_SMALL_INFOFONT)
336 336
     u8g.drawBox(0,30,LCD_PIXEL_WIDTH,10);
337 337
   #else
338 338
     u8g.drawBox(0,30,LCD_PIXEL_WIDTH,9);
@@ -378,12 +378,12 @@ static void lcd_implementation_status_screen() {
378 378
 
379 379
   // Status line
380 380
   lcd_setFont(FONT_STATUSMENU);
381
-  #ifdef USE_SMALL_INFOFONT
381
+  #if ENABLED(USE_SMALL_INFOFONT)
382 382
     u8g.setPrintPos(0,62);
383 383
   #else
384 384
     u8g.setPrintPos(0,63);
385 385
   #endif
386
-  #ifndef FILAMENT_LCD_DISPLAY
386
+  #if DISABLED(FILAMENT_LCD_DISPLAY)
387 387
     lcd_print(lcd_status_message);
388 388
   #else
389 389
     if (millis() < previous_lcd_status_ms + 5000) {  //Display both Status message line and Filament display on the last line
@@ -473,7 +473,7 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
473 473
   uint8_t lcd_width = LCD_WIDTH, char_width = DOG_CHAR_WIDTH;
474 474
   uint8_t vallen = lcd_strlen(value);
475 475
 
476
-  #ifdef USE_BIG_EDIT_FONT
476
+  #if ENABLED(USE_BIG_EDIT_FONT)
477 477
     if (lcd_strlen_P(pstr) <= LCD_WIDTH_EDIT - 1) {
478 478
       lcd_setFont(FONT_MENU_EDIT);
479 479
       lcd_width = LCD_WIDTH_EDIT + 1;

+ 86
- 86
Marlin/ultralcd.cpp Целия файл

@@ -1,5 +1,5 @@
1 1
 #include "ultralcd.h"
2
-#ifdef ULTRA_LCD
2
+#if ENABLED(ULTRA_LCD)
3 3
 #include "Marlin.h"
4 4
 #include "language.h"
5 5
 #include "cardreader.h"
@@ -20,7 +20,7 @@ int absPreheatHotendTemp;
20 20
 int absPreheatHPBTemp;
21 21
 int absPreheatFanSpeed;
22 22
 
23
-#ifdef FILAMENT_LCD_DISPLAY
23
+#if ENABLED(FILAMENT_LCD_DISPLAY)
24 24
   millis_t previous_lcd_status_ms = 0;
25 25
 #endif
26 26
 
@@ -30,7 +30,7 @@ typedef void (*menuFunc_t)();
30 30
 uint8_t lcd_status_message_level;
31 31
 char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with up to 3*LCD_WIDTH+1
32 32
 
33
-#ifdef DOGLCD
33
+#if ENABLED(DOGLCD)
34 34
   #include "dogm_lcd_implementation.h"
35 35
 #else
36 36
   #include "ultralcd_implementation_hitachi_HD44780.h"
@@ -39,7 +39,7 @@ char lcd_status_message[3*LCD_WIDTH+1] = WELCOME_MSG; // worst case is kana with
39 39
 // The main status screen
40 40
 static void lcd_status_screen();
41 41
 
42
-#ifdef ULTIPANEL
42
+#if ENABLED(ULTIPANEL)
43 43
 
44 44
   #if HAS_POWER_SWITCH
45 45
     extern bool powersupply;
@@ -55,19 +55,19 @@ static void lcd_status_screen();
55 55
   static void lcd_control_temperature_preheat_abs_settings_menu();
56 56
   static void lcd_control_motion_menu();
57 57
   static void lcd_control_volumetric_menu();
58
-  #ifdef HAS_LCD_CONTRAST
58
+  #if ENABLED(HAS_LCD_CONTRAST)
59 59
     static void lcd_set_contrast();
60 60
   #endif
61
-  #ifdef FWRETRACT
61
+  #if ENABLED(FWRETRACT)
62 62
     static void lcd_control_retract_menu();
63 63
   #endif
64 64
   static void lcd_sdcard_menu();
65 65
 
66
-  #ifdef DELTA_CALIBRATION_MENU
66
+  #if ENABLED(DELTA_CALIBRATION_MENU)
67 67
     static void lcd_delta_calibrate_menu();
68 68
   #endif
69 69
 
70
-  #if defined(MANUAL_BED_LEVELING)
70
+  #if ENABLED(MANUAL_BED_LEVELING)
71 71
     #include "mesh_bed_leveling.h"
72 72
     static void _lcd_level_bed();
73 73
     static void _lcd_level_bed_homing();
@@ -102,7 +102,7 @@ static void lcd_status_screen();
102 102
 
103 103
   #define ENCODER_FEEDRATE_DEADZONE 10
104 104
 
105
-  #if !defined(LCD_I2C_VIKI)
105
+  #if DISABLED(LCD_I2C_VIKI)
106 106
     #ifndef ENCODER_STEPS_PER_MENU_ITEM
107 107
       #define ENCODER_STEPS_PER_MENU_ITEM 5
108 108
     #endif
@@ -169,7 +169,7 @@ static void lcd_status_screen();
169 169
     _menuItemNr++; \
170 170
   } while(0)
171 171
 
172
-  #ifdef ENCODER_RATE_MULTIPLIER
172
+  #if ENABLED(ENCODER_RATE_MULTIPLIER)
173 173
 
174 174
     //#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
175 175
 
@@ -196,7 +196,7 @@ static void lcd_status_screen();
196 196
   #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
197 197
   #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
198 198
   #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
199
-  #ifdef ENCODER_RATE_MULTIPLIER
199
+  #if ENABLED(ENCODER_RATE_MULTIPLIER)
200 200
     #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label), ## args)
201 201
     #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label), ## args)
202 202
   #else //!ENCODER_RATE_MULTIPLIER
@@ -210,11 +210,11 @@ static void lcd_status_screen();
210 210
 
211 211
   /** Used variables to keep track of the menu */
212 212
   volatile uint8_t buttons;  //the last checked buttons in a bit array.
213
-  #ifdef REPRAPWORLD_KEYPAD
213
+  #if ENABLED(REPRAPWORLD_KEYPAD)
214 214
     volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
215 215
   #endif
216 216
     
217
-  #ifdef LCD_HAS_SLOW_BUTTONS
217
+  #if ENABLED(LCD_HAS_SLOW_BUTTONS)
218 218
     volatile uint8_t slow_buttons; // Bits of the pressed buttons.
219 219
   #endif
220 220
   uint8_t currentMenuViewOffset;              /* scroll offset in the current menu */
@@ -252,12 +252,12 @@ float raw_Ki, raw_Kd;
252 252
 static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint32_t encoder=0) {
253 253
   if (currentMenu != menu) {
254 254
     currentMenu = menu;
255
-    #ifdef NEWPANEL
255
+    #if ENABLED(NEWPANEL)
256 256
       encoderPosition = encoder;
257 257
       if (feedback) lcd_quick_feedback();
258 258
     #endif
259 259
     // For LCD_PROGRESS_BAR re-initialize the custom characters
260
-    #ifdef LCD_PROGRESS_BAR
260
+    #if ENABLED(LCD_PROGRESS_BAR)
261 261
       lcd_set_custom_characters(menu == lcd_status_screen);
262 262
     #endif
263 263
   }
@@ -273,7 +273,7 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback=false, const uint
273 273
 static void lcd_status_screen() {
274 274
 	encoderRateMultiplierEnabled = false;
275 275
 
276
-  #ifdef LCD_PROGRESS_BAR
276
+  #if ENABLED(LCD_PROGRESS_BAR)
277 277
     millis_t ms = millis();
278 278
     #ifndef PROGRESS_MSG_ONCE
279 279
       if (ms > progress_bar_ms + PROGRESS_BAR_MSG_TIME + PROGRESS_BAR_BAR_TIME) {
@@ -305,7 +305,7 @@ static void lcd_status_screen() {
305 305
 
306 306
   lcd_implementation_status_screen();
307 307
 
308
-  #ifdef ULTIPANEL
308
+  #if ENABLED(ULTIPANEL)
309 309
 
310 310
     bool current_click = LCD_CLICKED;
311 311
 
@@ -326,16 +326,16 @@ static void lcd_status_screen() {
326 326
     if (current_click) {
327 327
       lcd_goto_menu(lcd_main_menu, true);
328 328
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
329
-        #ifdef LCD_PROGRESS_BAR
329
+        #if ENABLED(LCD_PROGRESS_BAR)
330 330
           currentMenu == lcd_status_screen
331 331
         #endif
332 332
       );
333
-      #ifdef FILAMENT_LCD_DISPLAY
333
+      #if ENABLED(FILAMENT_LCD_DISPLAY)
334 334
         previous_lcd_status_ms = millis();  // get status message to show up for a while
335 335
       #endif
336 336
     }
337 337
 
338
-    #ifdef ULTIPANEL_FEEDMULTIPLY
338
+    #if ENABLED(ULTIPANEL_FEEDMULTIPLY)
339 339
       // Dead zone at 100% feedrate
340 340
       if ((feedrate_multiplier < 100 && (feedrate_multiplier + int(encoderPosition)) > 100) ||
341 341
               (feedrate_multiplier > 100 && (feedrate_multiplier + int(encoderPosition)) < 100)) {
@@ -363,7 +363,7 @@ static void lcd_status_screen() {
363 363
   #endif //ULTIPANEL
364 364
 }
365 365
 
366
-#ifdef ULTIPANEL
366
+#if ENABLED(ULTIPANEL)
367 367
 
368 368
 static void lcd_return_to_status() { lcd_goto_menu(lcd_status_screen); }
369 369
 
@@ -394,13 +394,13 @@ static void lcd_main_menu() {
394 394
   }
395 395
   else {
396 396
     MENU_ITEM(submenu, MSG_PREPARE, lcd_prepare_menu);
397
-    #ifdef DELTA_CALIBRATION_MENU
397
+    #if ENABLED(DELTA_CALIBRATION_MENU)
398 398
       MENU_ITEM(submenu, MSG_DELTA_CALIBRATE, lcd_delta_calibrate_menu);
399 399
     #endif
400 400
   }
401 401
   MENU_ITEM(submenu, MSG_CONTROL, lcd_control_menu);
402 402
 
403
-  #ifdef SDSUPPORT
403
+  #if ENABLED(SDSUPPORT)
404 404
     if (card.cardOK) {
405 405
       if (card.isFileOpen()) {
406 406
         if (card.sdprinting)
@@ -427,7 +427,7 @@ static void lcd_main_menu() {
427 427
   END_MENU();
428 428
 }
429 429
 
430
-#if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
430
+#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
431 431
   static void lcd_autostart_sd() {
432 432
     card.autostart_index = 0;
433 433
     card.setroot();
@@ -445,7 +445,7 @@ void lcd_set_home_offsets() {
445 445
 }
446 446
 
447 447
 
448
-#ifdef BABYSTEPPING
448
+#if ENABLED(BABYSTEPPING)
449 449
 
450 450
   static void _lcd_babystep(int axis, const char *msg) {
451 451
     if (encoderPosition != 0) {
@@ -500,14 +500,14 @@ static void lcd_tune_menu() {
500 500
     MENU_ITEM_EDIT(int3, MSG_FLOW MSG_N3, &extruder_multiplier[3], 10, 999);
501 501
   #endif
502 502
 
503
-  #ifdef BABYSTEPPING
504
-    #ifdef BABYSTEP_XY
503
+  #if ENABLED(BABYSTEPPING)
504
+    #if ENABLED(BABYSTEP_XY)
505 505
       MENU_ITEM(submenu, MSG_BABYSTEP_X, lcd_babystep_x);
506 506
       MENU_ITEM(submenu, MSG_BABYSTEP_Y, lcd_babystep_y);
507 507
     #endif //BABYSTEP_XY
508 508
     MENU_ITEM(submenu, MSG_BABYSTEP_Z, lcd_babystep_z);
509 509
   #endif
510
-  #ifdef FILAMENTCHANGEENABLE
510
+  #if ENABLED(FILAMENTCHANGEENABLE)
511 511
      MENU_ITEM(gcode, MSG_FILAMENTCHANGE, PSTR("M600"));
512 512
   #endif
513 513
   END_MENU();
@@ -638,10 +638,10 @@ static void lcd_prepare_menu() {
638 638
   //
639 639
   // Level Bed
640 640
   //
641
-  #ifdef ENABLE_AUTO_BED_LEVELING
641
+  #if ENABLED(ENABLE_AUTO_BED_LEVELING)
642 642
     if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS])
643 643
       MENU_ITEM(gcode, MSG_LEVEL_BED, PSTR("G29"));
644
-  #elif defined(MANUAL_BED_LEVELING)
644
+  #elif ENABLED(MANUAL_BED_LEVELING)
645 645
     MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
646 646
   #endif
647 647
 
@@ -687,14 +687,14 @@ static void lcd_prepare_menu() {
687 687
   //
688 688
   // Autostart
689 689
   //
690
-  #if defined(SDSUPPORT) && defined(MENU_ADDAUTOSTART)
690
+  #if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
691 691
     MENU_ITEM(function, MSG_AUTOSTART, lcd_autostart_sd);
692 692
   #endif
693 693
 
694 694
   END_MENU();
695 695
 }
696 696
 
697
-#ifdef DELTA_CALIBRATION_MENU
697
+#if ENABLED(DELTA_CALIBRATION_MENU)
698 698
 
699 699
   static void lcd_delta_calibrate_menu() {
700 700
     START_MENU();
@@ -710,7 +710,7 @@ static void lcd_prepare_menu() {
710 710
 #endif // DELTA_CALIBRATION_MENU
711 711
 
712 712
 inline void line_to_current(AxisEnum axis) {
713
-  #ifdef DELTA
713
+  #if ENABLED(DELTA)
714 714
     calculate_delta(current_position);
715 715
     plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
716 716
   #else
@@ -814,14 +814,14 @@ static void lcd_control_menu() {
814 814
   MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
815 815
   MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
816 816
 
817
-  #ifdef HAS_LCD_CONTRAST
817
+  #if ENABLED(HAS_LCD_CONTRAST)
818 818
     //MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63);
819 819
     MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast);
820 820
   #endif
821
-  #ifdef FWRETRACT
821
+  #if ENABLED(FWRETRACT)
822 822
     MENU_ITEM(submenu, MSG_RETRACT, lcd_control_retract_menu);
823 823
   #endif
824
-  #ifdef EEPROM_SETTINGS
824
+  #if ENABLED(EEPROM_SETTINGS)
825 825
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
826 826
     MENU_ITEM(function, MSG_LOAD_EPROM, Config_RetrieveSettings);
827 827
   #endif
@@ -835,7 +835,7 @@ static void lcd_control_menu() {
835 835
  *
836 836
  */
837 837
 
838
-#ifdef PIDTEMP
838
+#if ENABLED(PIDTEMP)
839 839
 
840 840
   // Helpers for editing PID Ki & Kd values
841 841
   // grab the PID value out of the temp variable; scale it; then update the PID driver
@@ -849,7 +849,7 @@ static void lcd_control_menu() {
849 849
   }
850 850
   void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); }
851 851
   void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); }
852
-  #ifdef PID_PARAMS_PER_EXTRUDER
852
+  #if ENABLED(PID_PARAMS_PER_EXTRUDER)
853 853
     #if EXTRUDERS > 1
854 854
       void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); }
855 855
       void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); }
@@ -916,7 +916,7 @@ static void lcd_control_temperature_menu() {
916 916
   //
917 917
   // Autotemp, Min, Max, Fact
918 918
   //
919
-  #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
919
+  #if ENABLED(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
920 920
     MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
921 921
     MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
922 922
     MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
@@ -926,7 +926,7 @@ static void lcd_control_temperature_menu() {
926 926
   //
927 927
   // PID-P, PID-I, PID-D, PID-C
928 928
   //
929
-  #ifdef PIDTEMP
929
+  #if ENABLED(PIDTEMP)
930 930
     // set up temp variables - undo the default scaling
931 931
     raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
932 932
     raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
@@ -934,10 +934,10 @@ static void lcd_control_temperature_menu() {
934 934
     // i is typically a small value so allows values below 1
935 935
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E1);
936 936
     MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_E1);
937
-    #ifdef PID_ADD_EXTRUSION_RATE
937
+    #if ENABLED(PID_ADD_EXTRUSION_RATE)
938 938
       MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
939 939
     #endif//PID_ADD_EXTRUSION_RATE
940
-    #ifdef PID_PARAMS_PER_EXTRUDER
940
+    #if ENABLED(PID_PARAMS_PER_EXTRUDER)
941 941
       #if EXTRUDERS > 1
942 942
         // set up temp variables - undo the default scaling
943 943
         raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
@@ -946,7 +946,7 @@ static void lcd_control_temperature_menu() {
946 946
         // i is typically a small value so allows values below 1
947 947
         MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E2, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2);
948 948
         MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E2, &raw_Kd, 1, 9990, copy_and_scalePID_d_E2);
949
-        #ifdef PID_ADD_EXTRUSION_RATE
949
+        #if ENABLED(PID_ADD_EXTRUSION_RATE)
950 950
           MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E2, &PID_PARAM(Kc,1), 1, 9990);
951 951
         #endif//PID_ADD_EXTRUSION_RATE
952 952
 
@@ -958,7 +958,7 @@ static void lcd_control_temperature_menu() {
958 958
           // i is typically a small value so allows values below 1
959 959
           MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E3, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3);
960 960
           MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E3, &raw_Kd, 1, 9990, copy_and_scalePID_d_E3);
961
-          #ifdef PID_ADD_EXTRUSION_RATE
961
+          #if ENABLED(PID_ADD_EXTRUSION_RATE)
962 962
             MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E3, &PID_PARAM(Kc,2), 1, 9990);
963 963
           #endif//PID_ADD_EXTRUSION_RATE
964 964
 
@@ -970,7 +970,7 @@ static void lcd_control_temperature_menu() {
970 970
             // i is typically a small value so allows values below 1
971 971
             MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I MSG_E4, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4);
972 972
             MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D MSG_E4, &raw_Kd, 1, 9990, copy_and_scalePID_d_E4);
973
-            #ifdef PID_ADD_EXTRUSION_RATE
973
+            #if ENABLED(PID_ADD_EXTRUSION_RATE)
974 974
               MENU_ITEM_EDIT(float3, MSG_PID_C MSG_E4, &PID_PARAM(Kc,3), 1, 9990);
975 975
             #endif//PID_ADD_EXTRUSION_RATE
976 976
           #endif//EXTRUDERS > 3
@@ -1006,7 +1006,7 @@ static void lcd_control_temperature_preheat_pla_settings_menu() {
1006 1006
   #if TEMP_SENSOR_BED != 0
1007 1007
     MENU_ITEM_EDIT(int3, MSG_BED, &plaPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15);
1008 1008
   #endif
1009
-  #ifdef EEPROM_SETTINGS
1009
+  #if ENABLED(EEPROM_SETTINGS)
1010 1010
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
1011 1011
   #endif
1012 1012
   END_MENU();
@@ -1027,7 +1027,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() {
1027 1027
   #if TEMP_SENSOR_BED != 0
1028 1028
     MENU_ITEM_EDIT(int3, MSG_BED, &absPreheatHPBTemp, BED_MINTEMP, BED_MAXTEMP - 15);
1029 1029
   #endif
1030
-  #ifdef EEPROM_SETTINGS
1030
+  #if ENABLED(EEPROM_SETTINGS)
1031 1031
     MENU_ITEM(function, MSG_STORE_EPROM, Config_StoreSettings);
1032 1032
   #endif
1033 1033
   END_MENU();
@@ -1041,7 +1041,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() {
1041 1041
 static void lcd_control_motion_menu() {
1042 1042
   START_MENU();
1043 1043
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
1044
-  #ifdef ENABLE_AUTO_BED_LEVELING
1044
+  #if ENABLED(ENABLE_AUTO_BED_LEVELING)
1045 1045
     MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
1046 1046
   #endif
1047 1047
   MENU_ITEM_EDIT(float5, MSG_ACC, &acceleration, 10, 99000);
@@ -1064,10 +1064,10 @@ static void lcd_control_motion_menu() {
1064 1064
   MENU_ITEM_EDIT(float52, MSG_YSTEPS, &axis_steps_per_unit[Y_AXIS], 5, 9999);
1065 1065
   MENU_ITEM_EDIT(float51, MSG_ZSTEPS, &axis_steps_per_unit[Z_AXIS], 5, 9999);
1066 1066
   MENU_ITEM_EDIT(float51, MSG_ESTEPS, &axis_steps_per_unit[E_AXIS], 5, 9999);
1067
-  #ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
1067
+  #if ENABLED(ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
1068 1068
     MENU_ITEM_EDIT(bool, MSG_ENDSTOP_ABORT, &abort_on_endstop_hit);
1069 1069
   #endif
1070
-  #ifdef SCARA
1070
+  #if ENABLED(SCARA)
1071 1071
     MENU_ITEM_EDIT(float74, MSG_XSCALE, &axis_scaling[X_AXIS],0.5,2);
1072 1072
     MENU_ITEM_EDIT(float74, MSG_YSCALE, &axis_scaling[Y_AXIS],0.5,2);
1073 1073
   #endif
@@ -1106,10 +1106,10 @@ static void lcd_control_volumetric_menu() {
1106 1106
  * "Control" > "Contrast" submenu
1107 1107
  *
1108 1108
  */
1109
-#ifdef HAS_LCD_CONTRAST
1109
+#if ENABLED(HAS_LCD_CONTRAST)
1110 1110
   static void lcd_set_contrast() {
1111 1111
     if (encoderPosition != 0) {
1112
-      #ifdef U8GLIB_LM6059_AF
1112
+      #if ENABLED(U8GLIB_LM6059_AF)
1113 1113
         lcd_contrast += encoderPosition;
1114 1114
         lcd_contrast &= 0xFF;
1115 1115
       #else
@@ -1121,7 +1121,7 @@ static void lcd_control_volumetric_menu() {
1121 1121
       u8g.setContrast(lcd_contrast);
1122 1122
     }
1123 1123
     if (lcdDrawUpdate) {
1124
-      #ifdef U8GLIB_LM6059_AF
1124
+      #if ENABLED(U8GLIB_LM6059_AF)
1125 1125
         lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr3(lcd_contrast));
1126 1126
       #else
1127 1127
         lcd_implementation_drawedit(PSTR(MSG_CONTRAST), itostr2(lcd_contrast));
@@ -1136,7 +1136,7 @@ static void lcd_control_volumetric_menu() {
1136 1136
  * "Control" > "Retract" submenu
1137 1137
  *
1138 1138
  */
1139
-#ifdef FWRETRACT
1139
+#if ENABLED(FWRETRACT)
1140 1140
   static void lcd_control_retract_menu() {
1141 1141
     START_MENU();
1142 1142
     MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
@@ -1191,7 +1191,7 @@ void lcd_sdcard_menu() {
1191 1191
   for (uint16_t i = 0; i < fileCnt; i++) {
1192 1192
     if (_menuItemNr == _lineNr) {
1193 1193
       card.getfilename(
1194
-        #ifdef SDCARD_RATHERRECENTFIRST
1194
+        #if ENABLED(SDCARD_RATHERRECENTFIRST)
1195 1195
           fileCnt-1 -
1196 1196
         #endif
1197 1197
         i
@@ -1264,7 +1264,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
1264 1264
  * Handlers for RepRap World Keypad input
1265 1265
  *
1266 1266
  */
1267
-#ifdef REPRAPWORLD_KEYPAD
1267
+#if ENABLED(REPRAPWORLD_KEYPAD)
1268 1268
   static void reprapworld_keypad_move_z_up() {
1269 1269
     encoderPosition = 1;
1270 1270
     move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP;
@@ -1307,7 +1307,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01)
1307 1307
  *
1308 1308
  */
1309 1309
 
1310
-#ifdef LCD_USE_I2C_BUZZER
1310
+#if ENABLED(LCD_USE_I2C_BUZZER)
1311 1311
   void lcd_buzz(long duration, uint16_t freq) { // called from buzz() in Marlin_main.cpp where lcd is unknown
1312 1312
     lcd.buzz(duration, freq);
1313 1313
   }
@@ -1317,7 +1317,7 @@ void lcd_quick_feedback() {
1317 1317
   lcdDrawUpdate = 2;
1318 1318
   next_button_update_ms = millis() + 500;
1319 1319
     
1320
-  #ifdef LCD_USE_I2C_BUZZER
1320
+  #if ENABLED(LCD_USE_I2C_BUZZER)
1321 1321
     #ifndef LCD_FEEDBACK_FREQUENCY_HZ
1322 1322
       #define LCD_FEEDBACK_FREQUENCY_HZ 100
1323 1323
     #endif
@@ -1375,7 +1375,7 @@ static void menu_action_setting_edit_callback_bool(const char* pstr, bool* ptr,
1375 1375
 void lcd_init() {
1376 1376
   lcd_implementation_init();
1377 1377
 
1378
-  #ifdef NEWPANEL
1378
+  #if ENABLED(NEWPANEL)
1379 1379
 
1380 1380
     SET_INPUT(BTN_EN1);
1381 1381
     SET_INPUT(BTN_EN2);
@@ -1385,7 +1385,7 @@ void lcd_init() {
1385 1385
     SET_INPUT(BTN_ENC);
1386 1386
     WRITE(BTN_ENC,HIGH);
1387 1387
   #endif
1388
-  #ifdef REPRAPWORLD_KEYPAD
1388
+  #if ENABLED(REPRAPWORLD_KEYPAD)
1389 1389
     pinMode(SHIFT_CLK,OUTPUT);
1390 1390
     pinMode(SHIFT_LD,OUTPUT);
1391 1391
     pinMode(SHIFT_OUT,INPUT);
@@ -1393,7 +1393,7 @@ void lcd_init() {
1393 1393
     WRITE(SHIFT_LD,HIGH);
1394 1394
   #endif
1395 1395
 #else  // Not NEWPANEL
1396
-  #ifdef SR_LCD_2W_NL // Non latching 2 wire shift register
1396
+  #if ENABLED(SR_LCD_2W_NL) // Non latching 2 wire shift register
1397 1397
      pinMode (SR_DATA_PIN, OUTPUT);
1398 1398
      pinMode (SR_CLK_PIN, OUTPUT);
1399 1399
   #elif defined(SHIFT_CLK)
@@ -1407,19 +1407,19 @@ void lcd_init() {
1407 1407
   #endif // SR_LCD_2W_NL
1408 1408
 #endif//!NEWPANEL
1409 1409
 
1410
-  #if defined(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
1410
+  #if ENABLED(SDSUPPORT) && defined(SDCARDDETECT) && (SDCARDDETECT > 0)
1411 1411
     pinMode(SDCARDDETECT, INPUT);
1412 1412
     WRITE(SDCARDDETECT, HIGH);
1413 1413
     lcd_oldcardstatus = IS_SD_INSERTED;
1414 1414
   #endif //(SDCARDDETECT > 0)
1415 1415
 
1416
-  #ifdef LCD_HAS_SLOW_BUTTONS
1416
+  #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1417 1417
     slow_buttons = 0;
1418 1418
   #endif
1419 1419
 
1420 1420
   lcd_buttons_update();
1421 1421
 
1422
-  #ifdef ULTIPANEL
1422
+  #if ENABLED(ULTIPANEL)
1423 1423
     encoderDiff = 0;
1424 1424
   #endif
1425 1425
 }
@@ -1456,11 +1456,11 @@ int lcd_strlen_P(const char *s) {
1456 1456
  * Warning: This function is called from interrupt context!
1457 1457
  */
1458 1458
 void lcd_update() {
1459
-  #ifdef ULTIPANEL
1459
+  #if ENABLED(ULTIPANEL)
1460 1460
     static millis_t return_to_status_ms = 0;
1461 1461
   #endif
1462 1462
 
1463
-  #ifdef LCD_HAS_SLOW_BUTTONS
1463
+  #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1464 1464
     slow_buttons = lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
1465 1465
   #endif
1466 1466
 
@@ -1471,7 +1471,7 @@ void lcd_update() {
1471 1471
       lcdDrawUpdate = 2;
1472 1472
       lcd_oldcardstatus = IS_SD_INSERTED;
1473 1473
       lcd_implementation_init( // to maybe revive the LCD if static electricity killed it.
1474
-        #ifdef LCD_PROGRESS_BAR
1474
+        #if ENABLED(LCD_PROGRESS_BAR)
1475 1475
           currentMenu == lcd_status_screen
1476 1476
         #endif
1477 1477
       );
@@ -1490,9 +1490,9 @@ void lcd_update() {
1490 1490
   millis_t ms = millis();
1491 1491
   if (ms > next_lcd_update_ms) {
1492 1492
 
1493
-    #ifdef ULTIPANEL
1493
+    #if ENABLED(ULTIPANEL)
1494 1494
 
1495
-      #ifdef REPRAPWORLD_KEYPAD
1495
+      #if ENABLED(REPRAPWORLD_KEYPAD)
1496 1496
         if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up();
1497 1497
         if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down();
1498 1498
         if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left();
@@ -1507,7 +1507,7 @@ void lcd_update() {
1507 1507
         if (encoderPastThreshold) {
1508 1508
           int32_t encoderMultiplier = 1;
1509 1509
 
1510
-          #ifdef ENCODER_RATE_MULTIPLIER
1510
+          #if ENABLED(ENCODER_RATE_MULTIPLIER)
1511 1511
 
1512 1512
             if (encoderRateMultiplierEnabled) {
1513 1513
               int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
@@ -1520,7 +1520,7 @@ void lcd_update() {
1520 1520
                 if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC)     encoderMultiplier = 100;
1521 1521
                 else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
1522 1522
 
1523
-                #ifdef ENCODER_RATE_MULTIPLIER_DEBUG
1523
+                #if ENABLED(ENCODER_RATE_MULTIPLIER_DEBUG)
1524 1524
                   SERIAL_ECHO_START;
1525 1525
                   SERIAL_ECHO("Enc Step Rate: ");
1526 1526
                   SERIAL_ECHO(encoderStepRate);
@@ -1554,7 +1554,7 @@ void lcd_update() {
1554 1554
         lcd_status_update_delay--;
1555 1555
       }
1556 1556
     }
1557
-    #ifdef DOGLCD  // Changes due to different driver architecture of the DOGM display
1557
+    #if ENABLED(DOGLCD)  // Changes due to different driver architecture of the DOGM display
1558 1558
       if (lcdDrawUpdate) {
1559 1559
         blink++;     // Variable for fan animation and alive dot
1560 1560
         u8g.firstPage();
@@ -1571,15 +1571,15 @@ void lcd_update() {
1571 1571
       (*currentMenu)();
1572 1572
     #endif
1573 1573
 
1574
-    #ifdef LCD_HAS_STATUS_INDICATORS
1574
+    #if ENABLED(LCD_HAS_STATUS_INDICATORS)
1575 1575
       lcd_implementation_update_indicators();
1576 1576
     #endif
1577 1577
 
1578
-    #ifdef ULTIPANEL
1578
+    #if ENABLED(ULTIPANEL)
1579 1579
 
1580 1580
       // Return to Status Screen after a timeout
1581 1581
       if (currentMenu != lcd_status_screen &&
1582
-        #ifdef MANUAL_BED_LEVELING
1582
+        #if ENABLED(MANUAL_BED_LEVELING)
1583 1583
           currentMenu != _lcd_level_bed &&
1584 1584
           currentMenu != _lcd_level_bed_homing &&
1585 1585
         #endif
@@ -1603,7 +1603,7 @@ void lcd_ignore_click(bool b) {
1603 1603
 }
1604 1604
 
1605 1605
 void lcd_finishstatus(bool persist=false) {
1606
-  #ifdef LCD_PROGRESS_BAR
1606
+  #if ENABLED(LCD_PROGRESS_BAR)
1607 1607
     progress_bar_ms = millis();
1608 1608
     #if PROGRESS_MSG_EXPIRE > 0
1609 1609
       expire_status_ms = persist ? 0 : progress_bar_ms + PROGRESS_MSG_EXPIRE;
@@ -1611,12 +1611,12 @@ void lcd_finishstatus(bool persist=false) {
1611 1611
   #endif
1612 1612
   lcdDrawUpdate = 2;
1613 1613
 
1614
-  #ifdef FILAMENT_LCD_DISPLAY
1614
+  #if ENABLED(FILAMENT_LCD_DISPLAY)
1615 1615
     previous_lcd_status_ms = millis();  //get status message to show up for a while
1616 1616
   #endif
1617 1617
 }
1618 1618
 
1619
-#if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
1619
+#if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
1620 1620
   void dontExpireStatus() { expire_status_ms = 0; }
1621 1621
 #endif
1622 1622
 
@@ -1650,21 +1650,21 @@ void lcd_setstatuspgm(const char* message, uint8_t level) {
1650 1650
 
1651 1651
 void lcd_setalertstatuspgm(const char* message) {
1652 1652
   lcd_setstatuspgm(message, 1);
1653
-  #ifdef ULTIPANEL
1653
+  #if ENABLED(ULTIPANEL)
1654 1654
     lcd_return_to_status();
1655 1655
   #endif
1656 1656
 }
1657 1657
 
1658 1658
 void lcd_reset_alert_level() { lcd_status_message_level = 0; }
1659 1659
 
1660
-#ifdef HAS_LCD_CONTRAST
1660
+#if ENABLED(HAS_LCD_CONTRAST)
1661 1661
   void lcd_setcontrast(uint8_t value) {
1662 1662
     lcd_contrast = value & 0x3F;
1663 1663
     u8g.setContrast(lcd_contrast);
1664 1664
   }
1665 1665
 #endif
1666 1666
 
1667
-#ifdef ULTIPANEL
1667
+#if ENABLED(ULTIPANEL)
1668 1668
 
1669 1669
   /**
1670 1670
    * Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
@@ -1683,7 +1683,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
1683 1683
    * Warning: This function is called from interrupt context!
1684 1684
    */
1685 1685
   void lcd_buttons_update() {
1686
-    #ifdef NEWPANEL
1686
+    #if ENABLED(NEWPANEL)
1687 1687
       uint8_t newbutton = 0;
1688 1688
       if (READ(BTN_EN1) == 0) newbutton |= EN_A;
1689 1689
       if (READ(BTN_EN2) == 0) newbutton |= EN_B;
@@ -1691,10 +1691,10 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
1691 1691
         if (millis() > next_button_update_ms && READ(BTN_ENC) == 0) newbutton |= EN_C;
1692 1692
       #endif
1693 1693
       buttons = newbutton;
1694
-      #ifdef LCD_HAS_SLOW_BUTTONS
1694
+      #if ENABLED(LCD_HAS_SLOW_BUTTONS)
1695 1695
         buttons |= slow_buttons;
1696 1696
       #endif
1697
-      #ifdef REPRAPWORLD_KEYPAD
1697
+      #if ENABLED(REPRAPWORLD_KEYPAD)
1698 1698
         // for the reprapworld_keypad
1699 1699
         uint8_t newbutton_reprapworld_keypad=0;
1700 1700
         WRITE(SHIFT_LD, LOW);
@@ -1749,7 +1749,7 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
1749 1749
   }
1750 1750
 
1751 1751
   bool lcd_detected(void) {
1752
-    #if (defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)) && defined(DETECT_DEVICE)
1752
+    #if (ENABLED(LCD_I2C_TYPE_MCP23017) || ENABLED(LCD_I2C_TYPE_MCP23008)) && ENABLED(DETECT_DEVICE)
1753 1753
       return lcd.LcdDetected() == 1;
1754 1754
     #else
1755 1755
       return true;
@@ -1993,7 +1993,7 @@ char *ftostr52(const float &x) {
1993 1993
   return conv;
1994 1994
 }
1995 1995
 
1996
-#ifdef MANUAL_BED_LEVELING
1996
+#if ENABLED(MANUAL_BED_LEVELING)
1997 1997
 
1998 1998
   static int _lcd_level_bed_position;
1999 1999
 

+ 9
- 9
Marlin/ultralcd.h Целия файл

@@ -4,7 +4,7 @@
4 4
 #include "Marlin.h"
5 5
 #include "buzzer.h"
6 6
 
7
-#ifdef ULTRA_LCD
7
+#if ENABLED(ULTRA_LCD)
8 8
   int lcd_strlen(char *s);
9 9
   int lcd_strlen_P(const char *s);
10 10
   void lcd_update();
@@ -16,15 +16,15 @@
16 16
   void lcd_reset_alert_level();
17 17
   bool lcd_detected(void);
18 18
 
19
-  #ifdef LCD_USE_I2C_BUZZER
19
+  #if ENABLED(LCD_USE_I2C_BUZZER)
20 20
     void lcd_buzz(long duration, uint16_t freq);
21 21
   #endif
22 22
 
23
-  #if defined(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
23
+  #if ENABLED(LCD_PROGRESS_BAR) && PROGRESS_MSG_EXPIRE > 0
24 24
     void dontExpireStatus();
25 25
   #endif
26 26
 
27
-  #ifdef DOGLCD
27
+  #if ENABLED(DOGLCD)
28 28
     extern int lcd_contrast;
29 29
     void lcd_setcontrast(uint8_t value);
30 30
   #endif
@@ -35,10 +35,10 @@
35 35
   #define LCD_UPDATE_INTERVAL 100
36 36
   #define LCD_TIMEOUT_TO_STATUS 15000
37 37
 
38
-  #ifdef ULTIPANEL
38
+  #if ENABLED(ULTIPANEL)
39 39
     void lcd_buttons_update();
40 40
     extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
41
-    #ifdef REPRAPWORLD_KEYPAD
41
+    #if ENABLED(REPRAPWORLD_KEYPAD)
42 42
       extern volatile uint8_t buttons_reprapworld_keypad; // to store the keypad shift register values
43 43
     #endif
44 44
   #else
@@ -54,7 +54,7 @@
54 54
 
55 55
   extern bool cancel_heatup;
56 56
   
57
-  #ifdef FILAMENT_LCD_DISPLAY
57
+  #if ENABLED(FILAMENT_LCD_DISPLAY)
58 58
     extern millis_t previous_lcd_status_ms;
59 59
   #endif
60 60
   void lcd_quick_feedback(); // Audible feedback for a button click - could also be visual
@@ -62,13 +62,13 @@
62 62
 
63 63
   void lcd_ignore_click(bool b=true);
64 64
 
65
-  #ifdef NEWPANEL
65
+  #if ENABLED(NEWPANEL)
66 66
     #define EN_C BIT(BLEN_C)
67 67
     #define EN_B BIT(BLEN_B)
68 68
     #define EN_A BIT(BLEN_A)
69 69
 
70 70
     #define LCD_CLICKED (buttons&EN_C)
71
-    #ifdef REPRAPWORLD_KEYPAD
71
+    #if ENABLED(REPRAPWORLD_KEYPAD)
72 72
   	  #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
73 73
   	  #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
74 74
   	  #define EN_REPRAPWORLD_KEYPAD_F1 (BIT(BLEN_REPRAPWORLD_KEYPAD_F1))

+ 30
- 30
Marlin/ultralcd_implementation_hitachi_HD44780.h Целия файл

@@ -19,7 +19,7 @@
19 19
 // macro name. The mapping is independent of whether the button is directly connected or
20 20
 // via a shift/i2c register.
21 21
 
22
-#ifdef ULTIPANEL
22
+#if ENABLED(ULTIPANEL)
23 23
 // All UltiPanels might have an encoder - so this is always be mapped onto first two bits
24 24
 #define BLEN_B 1
25 25
 #define BLEN_A 0
@@ -36,7 +36,7 @@
36 36
 //
37 37
 // Setup other button mappings of each panel
38 38
 //
39
-#if defined(LCD_I2C_VIKI)
39
+#if ENABLED(LCD_I2C_VIKI)
40 40
   #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
41 41
 
42 42
   // button and encoder bit positions within 'buttons'
@@ -57,7 +57,7 @@
57 57
   // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
58 58
   #define LCD_HAS_SLOW_BUTTONS
59 59
 
60
-#elif defined(LCD_I2C_PANELOLU2)
60
+#elif ENABLED(LCD_I2C_PANELOLU2)
61 61
   // encoder click can be read through I2C if not directly connected
62 62
   #if BTN_ENC <= 0
63 63
     #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
@@ -72,7 +72,7 @@
72 72
     #define LCD_CLICKED (buttons&EN_C)
73 73
   #endif
74 74
 
75
-#elif defined(REPRAPWORLD_KEYPAD)
75
+#elif ENABLED(REPRAPWORLD_KEYPAD)
76 76
     // define register bit values, don't change it
77 77
     #define BLEN_REPRAPWORLD_KEYPAD_F3 0
78 78
     #define BLEN_REPRAPWORLD_KEYPAD_F2 1
@@ -99,7 +99,7 @@
99 99
     //#define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons&EN_REPRAPWORLD_KEYPAD_UP)
100 100
     //#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons&EN_REPRAPWORLD_KEYPAD_MIDDLE)
101 101
 
102
-#elif defined(NEWPANEL)
102
+#elif ENABLED(NEWPANEL)
103 103
   #define LCD_CLICKED (buttons&EN_C)
104 104
 
105 105
 #else // old style ULTIPANEL
@@ -127,7 +127,7 @@
127 127
 
128 128
 ////////////////////////////////////
129 129
 // Create LCD class instance and chipset-specific information
130
-#if defined(LCD_I2C_TYPE_PCF8575)
130
+#if ENABLED(LCD_I2C_TYPE_PCF8575)
131 131
   // note: these are register mapped pins on the PCF8575 controller not Arduino pins
132 132
   #define LCD_I2C_PIN_BL  3
133 133
   #define LCD_I2C_PIN_EN  2
@@ -144,7 +144,7 @@
144 144
   #define LCD_CLASS LiquidCrystal_I2C
145 145
   LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
146 146
 
147
-#elif defined(LCD_I2C_TYPE_MCP23017)
147
+#elif ENABLED(LCD_I2C_TYPE_MCP23017)
148 148
   //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
149 149
   #define LED_A 0x04 //100
150 150
   #define LED_B 0x02 //010
@@ -155,30 +155,30 @@
155 155
   #include <Wire.h>
156 156
   #include <LiquidTWI2.h>
157 157
   #define LCD_CLASS LiquidTWI2
158
-  #if defined(DETECT_DEVICE)
158
+  #if ENABLED(DETECT_DEVICE)
159 159
     LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
160 160
   #else
161 161
     LCD_CLASS lcd(LCD_I2C_ADDRESS);
162 162
   #endif
163 163
 
164
-#elif defined(LCD_I2C_TYPE_MCP23008)
164
+#elif ENABLED(LCD_I2C_TYPE_MCP23008)
165 165
   #include <Wire.h>
166 166
   #include <LiquidTWI2.h>
167 167
   #define LCD_CLASS LiquidTWI2
168
-  #if defined(DETECT_DEVICE)
168
+  #if ENABLED(DETECT_DEVICE)
169 169
     LCD_CLASS lcd(LCD_I2C_ADDRESS, 1);
170 170
   #else
171 171
     LCD_CLASS lcd(LCD_I2C_ADDRESS);
172 172
   #endif
173 173
 
174
-#elif defined(LCD_I2C_TYPE_PCA8574)
174
+#elif ENABLED(LCD_I2C_TYPE_PCA8574)
175 175
     #include <LiquidCrystal_I2C.h>
176 176
     #define LCD_CLASS LiquidCrystal_I2C
177 177
     LCD_CLASS lcd(LCD_I2C_ADDRESS, LCD_WIDTH, LCD_HEIGHT);
178 178
 
179 179
 // 2 wire Non-latching LCD SR from:
180 180
 // https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!shiftregister-connection
181
-#elif defined(SR_LCD_2W_NL)
181
+#elif ENABLED(SR_LCD_2W_NL)
182 182
   extern "C" void __cxa_pure_virtual() { while (1); }
183 183
   #include <LCD.h>
184 184
   #include <LiquidCrystal_SR.h>
@@ -193,7 +193,7 @@
193 193
 
194 194
 #include "utf_mapper.h"
195 195
 
196
-#ifdef LCD_PROGRESS_BAR
196
+#if ENABLED(LCD_PROGRESS_BAR)
197 197
   static millis_t progress_bar_ms = 0;
198 198
   #if PROGRESS_MSG_EXPIRE > 0
199 199
     static millis_t expire_status_ms = 0;
@@ -202,7 +202,7 @@
202 202
 #endif
203 203
 
204 204
 static void lcd_set_custom_characters(
205
-  #ifdef LCD_PROGRESS_BAR
205
+  #if ENABLED(LCD_PROGRESS_BAR)
206 206
     bool progress_bar_set=true
207 207
   #endif
208 208
 ) {
@@ -287,7 +287,7 @@ static void lcd_set_custom_characters(
287 287
     B00000
288 288
   }; //thanks Sonny Mounicou
289 289
 
290
-  #ifdef LCD_PROGRESS_BAR
290
+  #if ENABLED(LCD_PROGRESS_BAR)
291 291
     static bool char_mode = false;
292 292
     byte progress[3][8] = { {
293 293
       B00000,
@@ -348,28 +348,28 @@ static void lcd_set_custom_characters(
348 348
 }
349 349
 
350 350
 static void lcd_implementation_init(
351
-  #ifdef LCD_PROGRESS_BAR
351
+  #if ENABLED(LCD_PROGRESS_BAR)
352 352
     bool progress_bar_set=true
353 353
   #endif
354 354
 ) {
355 355
 
356
-  #if defined(LCD_I2C_TYPE_PCF8575)
356
+  #if ENABLED(LCD_I2C_TYPE_PCF8575)
357 357
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
358 358
     #ifdef LCD_I2C_PIN_BL
359 359
       lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
360 360
       lcd.setBacklight(HIGH);
361 361
     #endif
362 362
 
363
-  #elif defined(LCD_I2C_TYPE_MCP23017)
363
+  #elif ENABLED(LCD_I2C_TYPE_MCP23017)
364 364
     lcd.setMCPType(LTI_TYPE_MCP23017);
365 365
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
366 366
     lcd.setBacklight(0); //set all the LEDs off to begin with
367 367
 
368
-  #elif defined(LCD_I2C_TYPE_MCP23008)
368
+  #elif ENABLED(LCD_I2C_TYPE_MCP23008)
369 369
     lcd.setMCPType(LTI_TYPE_MCP23008);
370 370
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
371 371
 
372
-  #elif defined(LCD_I2C_TYPE_PCA8574)
372
+  #elif ENABLED(LCD_I2C_TYPE_PCA8574)
373 373
     lcd.init();
374 374
     lcd.backlight();
375 375
 
@@ -378,7 +378,7 @@ static void lcd_implementation_init(
378 378
   #endif
379 379
 
380 380
   lcd_set_custom_characters(
381
-    #ifdef LCD_PROGRESS_BAR
381
+    #if ENABLED(LCD_PROGRESS_BAR)
382 382
       progress_bar_set
383 383
     #endif
384 384
   );
@@ -499,7 +499,7 @@ static void lcd_implementation_status_screen() {
499 499
 
500 500
     #if LCD_WIDTH < 20
501 501
 
502
-      #ifdef SDSUPPORT
502
+      #if ENABLED(SDSUPPORT)
503 503
         lcd.setCursor(0, 2);
504 504
         lcd_printPGM(PSTR("SD"));
505 505
         if (IS_SD_PRINTING)
@@ -558,7 +558,7 @@ static void lcd_implementation_status_screen() {
558 558
     lcd.print(itostr3(feedrate_multiplier));
559 559
     lcd.print('%');
560 560
 
561
-    #if LCD_WIDTH > 19 && defined(SDSUPPORT)
561
+    #if LCD_WIDTH > 19 && ENABLED(SDSUPPORT)
562 562
 
563 563
       lcd.setCursor(7, 2);
564 564
       lcd_printPGM(PSTR("SD"));
@@ -591,7 +591,7 @@ static void lcd_implementation_status_screen() {
591 591
 
592 592
   lcd.setCursor(0, LCD_HEIGHT - 1);
593 593
 
594
-  #ifdef LCD_PROGRESS_BAR
594
+  #if ENABLED(LCD_PROGRESS_BAR)
595 595
 
596 596
     if (card.isFileOpen()) {
597 597
       // Draw the progress bar if the message has shown long enough
@@ -613,7 +613,7 @@ static void lcd_implementation_status_screen() {
613 613
       }
614 614
     } //card.isFileOpen
615 615
 
616
-  #elif defined(FILAMENT_LCD_DISPLAY)
616
+  #elif ENABLED(FILAMENT_LCD_DISPLAY)
617 617
 
618 618
     // Show Filament Diameter and Volumetric Multiplier %
619 619
     // After allowing lcd_status_message to show for 5 seconds
@@ -730,10 +730,10 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
730 730
 #define lcd_implementation_drawmenu_gcode(sel, row, pstr, gcode) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
731 731
 #define lcd_implementation_drawmenu_function(sel, row, pstr, data) lcd_implementation_drawmenu_generic(sel, row, pstr, '>', ' ')
732 732
 
733
-#ifdef LCD_HAS_STATUS_INDICATORS
733
+#if ENABLED(LCD_HAS_STATUS_INDICATORS)
734 734
 
735 735
   static void lcd_implementation_update_indicators() {
736
-    #if defined(LCD_I2C_PANELOLU2) || defined(LCD_I2C_VIKI)
736
+    #if ENABLED(LCD_I2C_PANELOLU2) || ENABLED(LCD_I2C_VIKI)
737 737
       // Set the LEDS - referred to as backlights by the LiquidTWI2 library
738 738
       static uint8_t ledsprev = 0;
739 739
       uint8_t leds = 0;
@@ -752,17 +752,17 @@ static void lcd_implementation_drawmenu_sddirectory(bool sel, uint8_t row, const
752 752
 
753 753
 #endif // LCD_HAS_STATUS_INDICATORS
754 754
 
755
-#ifdef LCD_HAS_SLOW_BUTTONS
755
+#if ENABLED(LCD_HAS_SLOW_BUTTONS)
756 756
 
757 757
   extern millis_t next_button_update_ms;
758 758
 
759 759
   static uint8_t lcd_implementation_read_slow_buttons() {
760
-    #ifdef LCD_I2C_TYPE_MCP23017
760
+    #if ENABLED(LCD_I2C_TYPE_MCP23017)
761 761
       uint8_t slow_buttons;
762 762
       // Reading these buttons this is likely to be too slow to call inside interrupt context
763 763
       // so they are called during normal lcd_update
764 764
       slow_buttons = lcd.readButtons() << B_I2C_BTN_OFFSET; 
765
-      #ifdef LCD_I2C_VIKI
765
+      #if ENABLED(LCD_I2C_VIKI)
766 766
         if ((slow_buttons & (B_MI|B_RI)) && millis() < next_button_update_ms) // LCD clicked
767 767
           slow_buttons &= ~(B_MI|B_RI); // Disable LCD clicked buttons if screen is updated
768 768
       #endif

Loading…
Отказ
Запис