Browse Source

Watchdog Refresh for LVGL Asset Load (#19724)

Victor Oliveira 4 years ago
parent
commit
bf33b2f862
No account linked to committer's email address

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

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

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

123
 
123
 
124
   //spi_flash_read_test();
124
   //spi_flash_read_test();
125
   #if ENABLED(SDSUPPORT)
125
   #if ENABLED(SDSUPPORT)
126
+    watchdog_refresh();
126
     UpdateAssets();
127
     UpdateAssets();
127
   #endif
128
   #endif
129
+
130
+  watchdog_refresh();
128
   mks_test_get();
131
   mks_test_get();
129
 
132
 
130
   touch.Init();
133
   touch.Init();

Loading…
Cancel
Save