From c60696dbae3696006cb24bfe1d51254977f4f65b Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Tue, 27 Oct 2020 17:16:35 -0300 Subject: [PATCH] Keep watchdog refreshed in LVGL init (#19900) --- Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp | 1 + .../extui/lib/mks_ui/tft_lvgl_configuration.cpp | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp index 70c48f5c8e..5ba7722f55 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp @@ -488,6 +488,7 @@ uint8_t public_buf[512]; } void UpdateAssets() { + if (!card.isMounted()) return; SdFile dir, root = card.getroot(); if (dir.open(&root, assetsPath, O_RDONLY)) { diff --git a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp index 26f6301763..21e3040c2e 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp @@ -116,17 +116,20 @@ void tft_lvgl_init() { ui_cfg_init(); disp_language_init(); - //init tft first! + watchdog_refresh(); // LVGL init takes time + + // Init TFT first! SPI_TFT.spi_init(SPI_FULL_SPEED); SPI_TFT.LCD_init(); + watchdog_refresh(); // LVGL init takes time + //spi_flash_read_test(); #if ENABLED(SDSUPPORT) - watchdog_refresh(); UpdateAssets(); + watchdog_refresh(); // LVGL init takes time #endif - watchdog_refresh(); mks_test_get(); touch.Init(); @@ -189,9 +192,11 @@ void tft_lvgl_init() { lv_encoder_pin_init(); + bool ready = true; #if ENABLED(POWER_LOSS_RECOVERY) recovery.load(); if (recovery.valid()) { + ready = false; if (gCfgItems.from_flash_pic) flash_preview_begin = true; else @@ -201,14 +206,12 @@ void tft_lvgl_init() { strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m)); card.printLongPath(public_buf_m); - strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id])); - lv_draw_printing(); } - else #endif - lv_draw_ready_print(); + + if (ready) lv_draw_ready_print(); if (mks_test_flag == 0x1E) mks_gpio_test();