Keep watchdog refreshed in LVGL init (#19900)

This commit is contained in:
Victor Oliveira 2020-10-27 17:16:35 -03:00 committed by Scott Lahteine
parent 5a74114e23
commit 3b42e0263a
2 changed files with 11 additions and 7 deletions

View file

@ -488,6 +488,7 @@ uint8_t public_buf[512];
} }
void UpdateAssets() { void UpdateAssets() {
if (!card.isMounted()) return;
SdFile dir, root = card.getroot(); SdFile dir, root = card.getroot();
if (dir.open(&root, assetsPath, O_RDONLY)) { if (dir.open(&root, assetsPath, O_RDONLY)) {

View file

@ -116,17 +116,20 @@ void tft_lvgl_init() {
ui_cfg_init(); ui_cfg_init();
disp_language_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.spi_init(SPI_FULL_SPEED);
SPI_TFT.LCD_init(); SPI_TFT.LCD_init();
watchdog_refresh(); // LVGL init takes time
//spi_flash_read_test(); //spi_flash_read_test();
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
watchdog_refresh();
UpdateAssets(); UpdateAssets();
watchdog_refresh(); // LVGL init takes time
#endif #endif
watchdog_refresh();
mks_test_get(); mks_test_get();
touch.Init(); touch.Init();
@ -189,9 +192,11 @@ void tft_lvgl_init() {
lv_encoder_pin_init(); lv_encoder_pin_init();
bool ready = true;
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
recovery.load(); recovery.load();
if (recovery.valid()) { if (recovery.valid()) {
ready = false;
if (gCfgItems.from_flash_pic) if (gCfgItems.from_flash_pic)
flash_preview_begin = true; flash_preview_begin = true;
else else
@ -201,14 +206,12 @@ void tft_lvgl_init() {
strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m)); strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
card.printLongPath(public_buf_m); card.printLongPath(public_buf_m);
strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id])); strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id]));
lv_draw_printing(); lv_draw_printing();
} }
else
#endif #endif
lv_draw_ready_print();
if (ready) lv_draw_ready_print();
if (mks_test_flag == 0x1E) if (mks_test_flag == 0x1E)
mks_gpio_test(); mks_gpio_test();