From 03760fd79ea7f020f8739647f7a420bf4ec286b7 Mon Sep 17 00:00:00 2001 From: Christophe Huriaux Date: Wed, 6 Jul 2022 22:43:38 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20ST7565=20LCD=20contrast=20?= =?UTF-8?q?init=20(#24457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/Configuration.h | 6 ++++++ Marlin/src/inc/Conditionals_LCD.h | 5 ++++- Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp | 8 +++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 15106a20a3..ce2b8fcd6f 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2631,6 +2631,12 @@ // //#define SILVER_GATE_GLCD_CONTROLLER +// +// eMotion Tech LCD with SD +// https://www.reprap-france.com/produit/1234568748-ecran-graphique-128-x-64-points-2-1 +// +//#define EMOTION_TECH_LCD + //============================================================================= //============================== OLED Displays ============================== //============================================================================= diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index e41bc0d489..8d29b177dd 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -99,7 +99,7 @@ #define IS_ULTIPANEL 1 #define STD_ENCODER_PULSES_PER_STEP 2 -#elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864) +#elif ANY(miniVIKI, VIKI2, WYH_L12864, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864, EMOTION_TECH_LCD) #define DOGLCD #define IS_DOGM_12864 1 @@ -116,6 +116,9 @@ #define IS_U8GLIB_LM6059_AF 1 #elif ENABLED(AZSMZ_12864) #define IS_U8GLIB_ST7565_64128N 1 + #elif ENABLED(EMOTION_TECH_LCD) + #define IS_U8GLIB_ST7565_64128N 1 + #define ST7565_VOLTAGE_DIVIDER_VALUE 0x07 #endif #elif ENABLED(OLED_PANEL_TINYBOY2) diff --git a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp index bfd44d08df..63e7b2e2b8 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_st7565_64128n_HAL.cpp @@ -74,7 +74,6 @@ #define ST7565_ON(N) ((N) ? 0xAF : 0xAE) #define ST7565_OUT_MODE(N) ((N) ? 0xC8 : 0xC0) #define ST7565_POWER_CONTROL(N) (0x28 | (N)) -#define ST7565_V0_RATIO(N) (0x10 | ((N) & 0x7)) #define ST7565_V5_RATIO(N) (0x20 | ((N) & 0x7)) #define ST7565_CONTRAST(N) (0x81), (N) @@ -106,11 +105,14 @@ static const uint8_t u8g_dev_st7565_64128n_HAL_init_seq[] PROGMEM = { ST7565_POWER_CONTROL(0x7), // power control: turn on voltage follower U8G_ESC_DLY(50), // delay 50 ms - ST7565_V0_RATIO(0), // Set V0 voltage resistor ratio. Setting for controlling brightness of Displaytech 64128N + #ifdef ST7565_VOLTAGE_DIVIDER_VALUE + // Set V5 voltage resistor ratio. Affects brightness of Displaytech 64128N + ST7565_V5_RATIO(ST7565_VOLTAGE_DIVIDER_VALUE), + #endif ST7565_INVERTED(0), // display normal, bit val 0: LCD pixel off. - ST7565_CONTRAST(0x1E), // Contrast value. Setting for controlling brightness of Displaytech 64128N + ST7565_CONTRAST(0x1E), // Contrast value for Displaytech 64128N ST7565_ON(1), // display on