Skip to content

Commit f7f1224

Browse files
rhapsodyvthinkyhead
authored andcommitted
Watchdog Refresh for LVGL Asset Load (MarlinFirmware#19724)
1 parent fd8d83b commit f7f1224

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Marlin/src/lcd/extui/lib/mks_ui/pic_manager.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,24 @@ void spiFlashErase_PIC() {
266266
W25QXX.init(SPI_QUARTER_SPEED);
267267
//erase 0x001000 -64K
268268
for (pic_sectorcnt = 0; pic_sectorcnt < (64 - 4) / 4; pic_sectorcnt++) {
269+
watchdog_refresh();
269270
W25QXX.SPI_FLASH_SectorErase(PICINFOADDR + pic_sectorcnt * 4 * 1024);
270271
}
271272
//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();
273275
W25QXX.SPI_FLASH_BlockErase((pic_sectorcnt + 1) * 64 * 1024);
276+
}
274277
}
275278

276279
#if HAS_SPI_FLASH_FONT
277280
void spiFlashErase_FONT() {
278281
volatile uint32_t Font_sectorcnt = 0;
279282
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();
281285
W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
286+
}
282287
}
283288
#endif
284289

@@ -410,6 +415,7 @@ uint8_t public_buf[512];
410415
return;
411416
}
412417

418+
watchdog_refresh();
413419
disp_assets_update_progress(fn);
414420

415421
W25QXX.init(SPI_QUARTER_SPEED);
@@ -422,18 +428,21 @@ uint8_t public_buf[512];
422428
totalSizeLoaded += pfileSize;
423429
if (assetType == ASSET_TYPE_LOGO) {
424430
do {
431+
watchdog_refresh();
425432
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
426433
Pic_Logo_Write((uint8_t *)fn, public_buf, pbr);
427434
} while (pbr >= BMP_WRITE_BUF_LEN);
428435
}
429436
else if (assetType == ASSET_TYPE_TITLE_LOGO) {
430437
do {
438+
watchdog_refresh();
431439
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
432440
Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr);
433441
} while (pbr >= BMP_WRITE_BUF_LEN);
434442
}
435443
else if (assetType == ASSET_TYPE_G_PREVIEW) {
436444
do {
445+
watchdog_refresh();
437446
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
438447
default_view_Write(public_buf, pbr);
439448
} while (pbr >= BMP_WRITE_BUF_LEN);
@@ -443,6 +452,7 @@ uint8_t public_buf[512];
443452
SPIFlash.beginWrite(Pic_Write_Addr);
444453
#if HAS_SPI_FLASH_COMPRESSION
445454
do {
455+
watchdog_refresh();
446456
pbr = file.read(public_buf, SPI_FLASH_PageSize);
447457
TERN_(MARLIN_DEV_MODE, totalSizes += pbr);
448458
SPIFlash.writeData(public_buf, SPI_FLASH_PageSize);
@@ -463,6 +473,7 @@ uint8_t public_buf[512];
463473
else if (assetType == ASSET_TYPE_FONT) {
464474
Pic_Write_Addr = UNIGBK_FLASH_ADDR;
465475
do {
476+
watchdog_refresh();
466477
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
467478
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
468479
Pic_Write_Addr += pbr;
@@ -482,9 +493,11 @@ uint8_t public_buf[512];
482493

483494
disp_assets_update();
484495
disp_assets_update_progress("Erasing pics...");
496+
watchdog_refresh();
485497
spiFlashErase_PIC();
486498
#if HAS_SPI_FLASH_FONT
487499
disp_assets_update_progress("Erasing fonts...");
500+
watchdog_refresh();
488501
spiFlashErase_FONT();
489502
#endif
490503

Marlin/src/lcd/extui/lib/mks_ui/tft_lvgl_configuration.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ void tft_lvgl_init() {
123123

124124
//spi_flash_read_test();
125125
#if ENABLED(SDSUPPORT)
126+
watchdog_refresh();
126127
UpdateAssets();
127128
#endif
129+
130+
watchdog_refresh();
128131
mks_test_get();
129132

130133
touch.Init();

0 commit comments

Comments
 (0)