@ -219,26 +219,34 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
// Initialize or re-initialize the LCD
// Initialize or re-initialize the LCD
void MarlinUI : : init_lcd ( ) {
void MarlinUI : : init_lcd ( ) {
# if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
# if PIN_EXISTS(LCD_BACKLIGHT)
OUT_WRITE ( LCD_BACKLIGHT_PIN , HIGH ) ;
OUT_WRITE ( LCD_BACKLIGHT_PIN , (
# if ENABLED(DELAYED_BACKLIGHT_INIT)
LOW // Illuminate after reset
# else
HIGH // Illuminate right away
# endif
) ) ;
# endif
# endif
# if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306)
# if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306)
SET_OUTPUT ( LCD_PINS_DC ) ;
SET_OUTPUT ( LCD_PINS_DC ) ;
# if !defined(LCD_RESET_PIN)
# if ndef LCD_RESET_PIN
# define LCD_RESET_PIN LCD_PINS_RS
# define LCD_RESET_PIN LCD_PINS_RS
# endif
# endif
# endif
# endif
# if PIN_EXISTS(LCD_RESET)
# if PIN_EXISTS(LCD_RESET)
OUT_WRITE ( LCD_RESET_PIN , LOW ) ; // perform a clean hardware reset
// Perform a clean hardware reset with needed delays
OUT_WRITE ( LCD_RESET_PIN , LOW ) ;
_delay_ms ( 5 ) ;
WRITE ( LCD_RESET_PIN , HIGH ) ;
_delay_ms ( 5 ) ;
_delay_ms ( 5 ) ;
OUT_WRITE ( LCD_RESET_PIN , HIGH ) ;
u8g . begin ( ) ;
_delay_ms ( 5 ) ; // delay to allow the display to initialize
# endif
# endif
# if PIN_EXISTS(LCD_ RESE T)
# if PIN_EXISTS(LCD_ BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INI T)
u8g. begin ( ) ;
WRITE( LCD_BACKLIGHT_PIN , HIGH ) ;
# endif
# endif
# if HAS_LCD_CONTRAST
# if HAS_LCD_CONTRAST
@ -246,11 +254,11 @@ void MarlinUI::init_lcd() {
# endif
# endif
# if ENABLED(LCD_SCREEN_ROT_90)
# if ENABLED(LCD_SCREEN_ROT_90)
u8g . setRot90 ( ) ; // Rotate screen by 90°
u8g . setRot90 ( ) ;
# elif ENABLED(LCD_SCREEN_ROT_180)
# elif ENABLED(LCD_SCREEN_ROT_180)
u8g . setRot180 ( ) ; // Rotate screen by 180°
u8g . setRot180 ( ) ;
# elif ENABLED(LCD_SCREEN_ROT_270)
# elif ENABLED(LCD_SCREEN_ROT_270)
u8g . setRot270 ( ) ; // Rotate screen by 270°
u8g . setRot270 ( ) ;
# endif
# endif
uxg_SetUtf8Fonts ( g_fontinfo , COUNT ( g_fontinfo ) ) ;
uxg_SetUtf8Fonts ( g_fontinfo , COUNT ( g_fontinfo ) ) ;