From bd97bbc52aaca10bb9e3e6a04a683a9b57cec098 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 31 May 2016 11:47:02 -0700 Subject: [PATCH] Make HAS_LCD_CONTRAST a boolean flag --- Marlin/Conditionals.h | 10 ++-------- Marlin/Marlin_main.cpp | 4 ++-- Marlin/configuration_store.cpp | 8 ++++---- Marlin/ultralcd.cpp | 8 ++++---- 4 files changed, 12 insertions(+), 18 deletions(-) diff --git a/Marlin/Conditionals.h b/Marlin/Conditionals.h index 705036c1f..0f6eb6da0 100644 --- a/Marlin/Conditionals.h +++ b/Marlin/Conditionals.h @@ -245,16 +245,10 @@ * Default LCD contrast for dogm-like LCD displays */ #if ENABLED(DOGLCD) - #if !defined(DEFAULT_LCD_CONTRAST) + #define HAS_LCD_CONTRAST (DISABLED(U8GLIB_ST7920) && DISABLED(U8GLIB_SSD1306) && DISABLED(U8GLIB_SH1106)) + #if HAS_LCD_CONTRAST && !defined(DEFAULT_LCD_CONTRAST) #define DEFAULT_LCD_CONTRAST 32 #endif - #define HAS_LCD_CONTRAST - #if ENABLED(U8GLIB_ST7920) - #undef HAS_LCD_CONTRAST - #endif - #if ENABLED(U8GLIB_SSD1306) - #undef HAS_LCD_CONTRAST - #endif #endif #else // CONFIGURATION_LCD diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b3c302d49..6c4846416 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5624,7 +5624,7 @@ inline void gcode_M226() { #endif // CHDK || PHOTOGRAPH_PIN -#if ENABLED(HAS_LCD_CONTRAST) +#if HAS_LCD_CONTRAST /** * M250: Read and optionally set the LCD contrast @@ -6975,7 +6975,7 @@ void process_next_command() { break; #endif // CHDK || PHOTOGRAPH_PIN - #if ENABLED(HAS_LCD_CONTRAST) + #if HAS_LCD_CONTRAST case 250: // M250 Set LCD contrast value: C (value 0..63) gcode_M250(); break; diff --git a/Marlin/configuration_store.cpp b/Marlin/configuration_store.cpp index 05a24acfe..001955f6e 100644 --- a/Marlin/configuration_store.cpp +++ b/Marlin/configuration_store.cpp @@ -282,7 +282,7 @@ void Config_StoreSettings() { EEPROM_WRITE_VAR(i, thermalManager.bedKd); #endif - #if DISABLED(HAS_LCD_CONTRAST) + #if !HAS_LCD_CONTRAST const int lcd_contrast = 32; #endif EEPROM_WRITE_VAR(i, lcd_contrast); @@ -462,7 +462,7 @@ void Config_RetrieveSettings() { for (uint8_t q=3; q--;) EEPROM_READ_VAR(i, dummy); // bedKp, bedKi, bedKd #endif - #if DISABLED(HAS_LCD_CONTRAST) + #if !HAS_LCD_CONTRAST int lcd_contrast; #endif EEPROM_READ_VAR(i, lcd_contrast); @@ -579,7 +579,7 @@ void Config_ResetDefault() { absPreheatFanSpeed = ABS_PREHEAT_FAN_SPEED; #endif - #if ENABLED(HAS_LCD_CONTRAST) + #if HAS_LCD_CONTRAST lcd_contrast = DEFAULT_LCD_CONTRAST; #endif @@ -842,7 +842,7 @@ void Config_PrintSettings(bool forReplay) { #endif // PIDTEMP || PIDTEMPBED - #if ENABLED(HAS_LCD_CONTRAST) + #if HAS_LCD_CONTRAST CONFIG_ECHO_START; if (!forReplay) { SERIAL_ECHOLNPGM("LCD Contrast:"); diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 0f7746d29..98b5fa665 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -97,7 +97,7 @@ static void lcd_status_screen(); static void lcd_control_motion_menu(); static void lcd_control_volumetric_menu(); - #if ENABLED(HAS_LCD_CONTRAST) + #if HAS_LCD_CONTRAST static void lcd_set_contrast(); #endif @@ -1352,7 +1352,7 @@ static void lcd_control_menu() { MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu); MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu); - #if ENABLED(HAS_LCD_CONTRAST) + #if HAS_LCD_CONTRAST //MENU_ITEM_EDIT(int3, MSG_CONTRAST, &lcd_contrast, 0, 63); MENU_ITEM(submenu, MSG_CONTRAST, lcd_set_contrast); #endif @@ -1712,7 +1712,7 @@ static void lcd_control_volumetric_menu() { * "Control" > "Contrast" submenu * */ -#if ENABLED(HAS_LCD_CONTRAST) +#if HAS_LCD_CONTRAST static void lcd_set_contrast() { ENCODER_DIRECTION_NORMAL(); if (encoderPosition) { @@ -2383,7 +2383,7 @@ void lcd_setalertstatuspgm(const char* message) { void lcd_reset_alert_level() { lcd_status_message_level = 0; } -#if ENABLED(HAS_LCD_CONTRAST) +#if HAS_LCD_CONTRAST void lcd_setcontrast(uint8_t value) { lcd_contrast = value & 0x3F; u8g.setContrast(lcd_contrast);