Browse Source

Watchdog Refresh for LVGL Asset Load (#19724)

Victor Oliveira 4 years ago
parent
commit
f7f1224941

+ 15
- 2
Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp View File

@@ -266,19 +266,24 @@ void spiFlashErase_PIC() {
266 266
   W25QXX.init(SPI_QUARTER_SPEED);
267 267
   //erase 0x001000 -64K
268 268
   for (pic_sectorcnt = 0; pic_sectorcnt < (64 - 4) / 4; pic_sectorcnt++) {
269
+    watchdog_refresh();
269 270
     W25QXX.SPI_FLASH_SectorErase(PICINFOADDR + pic_sectorcnt * 4 * 1024);
270 271
   }
271 272
   //erase 64K -- 6M
272
-  for (pic_sectorcnt = 0; pic_sectorcnt < (PIC_SIZE_xM * 1024 / 64 - 1); pic_sectorcnt++)
273
+  for (pic_sectorcnt = 0; pic_sectorcnt < (PIC_SIZE_xM * 1024 / 64 - 1); pic_sectorcnt++) {
274
+    watchdog_refresh();
273 275
     W25QXX.SPI_FLASH_BlockErase((pic_sectorcnt + 1) * 64 * 1024);
276
+  }
274 277
 }
275 278
 
276 279
 #if HAS_SPI_FLASH_FONT
277 280
   void spiFlashErase_FONT() {
278 281
     volatile uint32_t Font_sectorcnt = 0;
279 282
     W25QXX.init(SPI_QUARTER_SPEED);
280
-    for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++)
283
+    for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++) {
284
+      watchdog_refresh();
281 285
       W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
286
+    }
282 287
   }
283 288
 #endif
284 289
 
@@ -410,6 +415,7 @@ uint8_t public_buf[512];
410 415
       return;
411 416
     }
412 417
 
418
+    watchdog_refresh();
413 419
     disp_assets_update_progress(fn);
414 420
 
415 421
     W25QXX.init(SPI_QUARTER_SPEED);
@@ -422,18 +428,21 @@ uint8_t public_buf[512];
422 428
     totalSizeLoaded += pfileSize;
423 429
     if (assetType == ASSET_TYPE_LOGO) {
424 430
       do {
431
+        watchdog_refresh();
425 432
         pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
426 433
         Pic_Logo_Write((uint8_t *)fn, public_buf, pbr);
427 434
       } while (pbr >= BMP_WRITE_BUF_LEN);
428 435
     }
429 436
     else if (assetType == ASSET_TYPE_TITLE_LOGO) {
430 437
       do {
438
+        watchdog_refresh();
431 439
         pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
432 440
         Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr);
433 441
       } while (pbr >= BMP_WRITE_BUF_LEN);
434 442
     }
435 443
     else if (assetType == ASSET_TYPE_G_PREVIEW) {
436 444
       do {
445
+        watchdog_refresh();
437 446
         pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
438 447
         default_view_Write(public_buf, pbr);
439 448
       } while (pbr >= BMP_WRITE_BUF_LEN);
@@ -443,6 +452,7 @@ uint8_t public_buf[512];
443 452
       SPIFlash.beginWrite(Pic_Write_Addr);
444 453
       #if HAS_SPI_FLASH_COMPRESSION
445 454
         do {
455
+          watchdog_refresh();
446 456
           pbr = file.read(public_buf, SPI_FLASH_PageSize);
447 457
           TERN_(MARLIN_DEV_MODE, totalSizes += pbr);
448 458
           SPIFlash.writeData(public_buf, SPI_FLASH_PageSize);
@@ -463,6 +473,7 @@ uint8_t public_buf[512];
463 473
     else if (assetType == ASSET_TYPE_FONT) {
464 474
       Pic_Write_Addr = UNIGBK_FLASH_ADDR;
465 475
       do {
476
+        watchdog_refresh();
466 477
         pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
467 478
         W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
468 479
         Pic_Write_Addr += pbr;
@@ -482,9 +493,11 @@ uint8_t public_buf[512];
482 493
 
483 494
       disp_assets_update();
484 495
       disp_assets_update_progress("Erasing pics...");
496
+      watchdog_refresh();
485 497
       spiFlashErase_PIC();
486 498
       #if HAS_SPI_FLASH_FONT
487 499
         disp_assets_update_progress("Erasing fonts...");
500
+        watchdog_refresh();
488 501
         spiFlashErase_FONT();
489 502
       #endif
490 503
 

+ 3
- 0
Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp View File

@@ -123,8 +123,11 @@ void tft_lvgl_init() {
123 123
 
124 124
   //spi_flash_read_test();
125 125
   #if ENABLED(SDSUPPORT)
126
+    watchdog_refresh();
126 127
     UpdateAssets();
127 128
   #endif
129
+
130
+  watchdog_refresh();
128 131
   mks_test_get();
129 132
 
130 133
   touch.Init();

Loading…
Cancel
Save