Ver código fonte

DOGM: Avoid white flash on TFT (re)init (#14631)

- Avoid white flash on TFT (re)init. Unlike Graphical LCD, the TFT init color may be full white if the backlight is on during init.

- Add a conditional for delayed backlight init which can be applied to any backlit display.
Tanguy Pruvot 5 anos atrás
pai
commit
bae8d0a4bd

+ 1
- 0
Marlin/src/inc/Conditionals_LCD.h Ver arquivo

@@ -233,6 +233,7 @@
233 233
  #if ENABLED(MKS_ROBIN_TFT)
234 234
    #define DOGLCD
235 235
    #define IS_ULTIPANEL
236
+   #define DELAYED_BACKLIGHT_INIT
236 237
  #endif
237 238
 
238 239
 /**

+ 19
- 11
Marlin/src/lcd/dogm/ultralcd_DOGM.cpp Ver arquivo

@@ -219,26 +219,34 @@ void MarlinUI::set_font(const MarlinFont font_nr) {
219 219
 // Initialize or re-initialize the LCD
220 220
 void MarlinUI::init_lcd() {
221 221
 
222
-  #if PIN_EXISTS(LCD_BACKLIGHT) // Enable LCD backlight
223
-    OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
222
+  #if PIN_EXISTS(LCD_BACKLIGHT)
223
+    OUT_WRITE(LCD_BACKLIGHT_PIN, (
224
+      #if ENABLED(DELAYED_BACKLIGHT_INIT)
225
+        LOW  // Illuminate after reset
226
+      #else
227
+        HIGH // Illuminate right away
228
+      #endif
229
+    ));
224 230
   #endif
225 231
 
226 232
   #if EITHER(MKS_12864OLED, MKS_12864OLED_SSD1306)
227 233
     SET_OUTPUT(LCD_PINS_DC);
228
-    #if !defined(LCD_RESET_PIN)
234
+    #ifndef LCD_RESET_PIN
229 235
       #define LCD_RESET_PIN LCD_PINS_RS
230 236
     #endif
231 237
   #endif
232 238
 
233 239
   #if PIN_EXISTS(LCD_RESET)
234
-    OUT_WRITE(LCD_RESET_PIN, LOW); // perform a clean hardware reset
240
+    // Perform a clean hardware reset with needed delays
241
+    OUT_WRITE(LCD_RESET_PIN, LOW);
242
+    _delay_ms(5);
243
+    WRITE(LCD_RESET_PIN, HIGH);
235 244
     _delay_ms(5);
236
-    OUT_WRITE(LCD_RESET_PIN, HIGH);
237
-    _delay_ms(5); // delay to allow the display to initialize
245
+    u8g.begin();
238 246
   #endif
239 247
 
240
-  #if PIN_EXISTS(LCD_RESET)
241
-    u8g.begin();
248
+  #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT)
249
+    WRITE(LCD_BACKLIGHT_PIN, HIGH);
242 250
   #endif
243 251
 
244 252
   #if HAS_LCD_CONTRAST
@@ -246,11 +254,11 @@ void MarlinUI::init_lcd() {
246 254
   #endif
247 255
 
248 256
   #if ENABLED(LCD_SCREEN_ROT_90)
249
-    u8g.setRot90();   // Rotate screen by 90°
257
+    u8g.setRot90();
250 258
   #elif ENABLED(LCD_SCREEN_ROT_180)
251
-    u8g.setRot180();  // Rotate screen by 180°
259
+    u8g.setRot180();
252 260
   #elif ENABLED(LCD_SCREEN_ROT_270)
253
-    u8g.setRot270();  // Rotate screen by 270°
261
+    u8g.setRot270();
254 262
   #endif
255 263
 
256 264
   uxg_SetUtf8Fonts(g_fontinfo, COUNT(g_fontinfo));

Carregando…
Cancelar
Salvar