Browse Source

Enable contrast via LCD_CONTRAST_INIT (#15006)

pull/1/head
Tanguy Pruvot 5 years ago
committed by Scott Lahteine
parent
commit
e604f76703
  1. 55
      Marlin/src/inc/Conditionals_LCD.h
  2. 16
      Marlin/src/inc/Conditionals_post.h
  3. 4
      Marlin/src/module/configuration_store.cpp
  4. 4
      Marlin/src/pins/mega/pins_WANHAO_ONEPLUS.h
  5. 4
      Marlin/src/pins/ramps/pins_TT_OSCAR.h
  6. 2
      Marlin/src/pins/stm32/pins_FYSETC_AIO_II.h
  7. 2
      Marlin/src/pins/stm32/pins_FYSETC_CHEETAH.h

55
Marlin/src/inc/Conditionals_LCD.h

@ -30,9 +30,9 @@
#define DOGLCD
#define IS_ULTIPANEL
#define DEFAULT_LCD_CONTRAST 90
#define LCD_CONTRAST_MIN 60
#define LCD_CONTRAST_MIN 60
#define LCD_CONTRAST_MAX 140
#define LCD_CONTRAST_INIT 90
#elif ENABLED(ZONESTAR_LCD)
@ -65,23 +65,23 @@
#if ENABLED(miniVIKI)
#define LCD_CONTRAST_MIN 75
#define LCD_CONTRAST_MAX 115
#define DEFAULT_LCD_CONTRAST 95
#define LCD_CONTRAST_INIT 95
#define U8GLIB_ST7565_64128N
#elif ENABLED(VIKI2)
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 140
#define LCD_CONTRAST_INIT 140
#define U8GLIB_ST7565_64128N
#elif ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define LCD_CONTRAST_MIN 90
#define LCD_CONTRAST_MAX 130
#define DEFAULT_LCD_CONTRAST 110
#define LCD_CONTRAST_INIT 110
#define U8GLIB_LM6059_AF
#define SD_DETECT_INVERTED
#elif ENABLED(AZSMZ_12864)
#define LCD_CONTRAST_MIN 120
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 190
#define LCD_CONTRAST_INIT 190
#define U8GLIB_ST7565_64128N
#endif
@ -128,17 +128,17 @@
#elif ENABLED(MKS_MINI_12864)
#define MINIPANEL
#define DEFAULT_LCD_CONTRAST 150
#define LCD_CONTRAST_MAX 255
#define LCD_CONTRAST_MAX 255
#define LCD_CONTRAST_INIT 150
#elif ANY(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#define FYSETC_MINI_12864
#define DOGLCD
#define IS_ULTIPANEL
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 220
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 255
#define LCD_CONTRAST_INIT 220
#define LED_COLORS_REDUCE_GREEN
#if HAS_POWER_SWITCH && EITHER(FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1)
#define LED_BACKLIGHT_TIMEOUT 10000
@ -166,9 +166,9 @@
#define IS_ULTIPANEL
#define U8GLIB_SSD1309
#define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 254
#define DEFAULT_LCD_CONTRAST 127
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 254
#define LCD_CONTRAST_INIT 127
#define ENCODER_PULSES_PER_STEP 2
#define ENCODER_STEPS_PER_MENU_ITEM 2
@ -190,8 +190,8 @@
#if ENABLED(MAKRPANEL)
#define U8GLIB_ST7565_64128N
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST 17
#ifndef LCD_CONTRAST_INIT
#define LCD_CONTRAST_INIT 17
#endif
#endif
@ -381,29 +381,6 @@
#define HAS_LCD_MENU (ENABLED(ULTIPANEL) && DISABLED(NO_LCD_MENUS))
#define HAS_ADC_BUTTONS ENABLED(ADC_KEYPAD)
/**
* Default LCD contrast for Graphical LCD displays
*/
#define HAS_LCD_CONTRAST ( \
ENABLED(MAKRPANEL) \
|| ENABLED(CARTESIO_UI) \
|| ENABLED(VIKI2) \
|| ENABLED(AZSMZ_12864) \
|| ENABLED(miniVIKI) \
|| ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
)
#if HAS_LCD_CONTRAST
#ifndef LCD_CONTRAST_MIN
#define LCD_CONTRAST_MIN 0
#endif
#ifndef LCD_CONTRAST_MAX
#define LCD_CONTRAST_MAX 63
#endif
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST 32
#endif
#endif
/**
* Extruders have some combination of stepper motors and hotends
* so we separate these concepts into the defines:

16
Marlin/src/inc/Conditionals_post.h

@ -246,6 +246,22 @@
#define MAX_AUTORETRACT 99
#endif
/**
* Default LCD contrast for Graphical LCD displays
*/
#define HAS_LCD_CONTRAST defined(LCD_CONTRAST_INIT)
#if HAS_LCD_CONTRAST
#ifndef DEFAULT_LCD_CONTRAST
#define DEFAULT_LCD_CONTRAST LCD_CONTRAST_INIT
#endif
#ifndef LCD_CONTRAST_MIN
#define LCD_CONTRAST_MIN 0
#endif
#ifndef LCD_CONTRAST_MAX
#define LCD_CONTRAST_MAX MAX(63, LCD_CONTRAST_INIT)
#endif
#endif
/**
* Override here because this is set in Configuration_adv.h
*/

4
Marlin/src/module/configuration_store.cpp

@ -828,8 +828,10 @@ void MarlinSettings::postprocess() {
const int16_t lcd_contrast =
#if HAS_LCD_CONTRAST
ui.contrast
#elif defined(DEFAULT_LCD_CONTRAST)
DEFAULT_LCD_CONTRAST
#else
32
127
#endif
;
EEPROM_WRITE(lcd_contrast);

4
Marlin/src/pins/mega/pins_WANHAO_ONEPLUS.h

@ -105,9 +105,7 @@
#define BTN_ENC 5
// This display has adjustable contrast
#undef HAS_LCD_CONTRAST
#define HAS_LCD_CONTRAST 1
#define LCD_CONTRAST_MIN 0
#define LCD_CONTRAST_MAX 255
#define DEFAULT_LCD_CONTRAST 255
#define LCD_CONTRAST_INIT LCD_CONTRAST_MAX
#endif

4
Marlin/src/pins/ramps/pins_TT_OSCAR.h

@ -436,7 +436,7 @@
#define DOGLCD_CS 25
// GLCD features
//#define LCD_CONTRAST 190
//#define LCD_CONTRAST_INIT 190
// Uncomment screen orientation
//#define LCD_SCREEN_ROT_90
//#define LCD_SCREEN_ROT_180
@ -463,7 +463,7 @@
#define DOGLCD_CS 66
// GLCD features
//#define LCD_CONTRAST 190
//#define LCD_CONTRAST_INIT 190
// Uncomment screen orientation
//#define LCD_SCREEN_ROT_90
//#define LCD_SCREEN_ROT_180

2
Marlin/src/pins/stm32/pins_FYSETC_AIO_II.h

@ -137,7 +137,7 @@
#define DOGLCD_CS PB7
#endif
//#define LCD_CONTRAST 190
//#define LCD_CONTRAST_INIT 190
//#define LCD_SCREEN_ROT_90
//#define LCD_SCREEN_ROT_180
//#define LCD_SCREEN_ROT_270

2
Marlin/src/pins/stm32/pins_FYSETC_CHEETAH.h

@ -140,7 +140,7 @@
#define RGB_LED_B_PIN PB6
#endif
//#define LCD_CONTRAST 190
//#define LCD_CONTRAST_INIT 190
#if ENABLED(NEWPANEL)
#define BTN_EN1 PC11

Loading…
Cancel
Save