Browse Source

Overridable Options - Part 7 (PR#2559)

Apply `ENABLED` / `DISABLED` macros to LCD-related files.
Scott Lahteine 9 years ago
parent
commit
0d8989fc14

+ 27
- 27
Marlin/dogm_lcd_implementation.h View File

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

+ 86
- 86
Marlin/ultralcd.cpp View File

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

+ 9
- 9
Marlin/ultralcd.h View File

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

+ 30
- 30
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

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

Loading…
Cancel
Save