Watchdog Refresh for LVGL Asset Load (#19724)

This commit is contained in:
Victor Oliveira 2020-10-13 20:12:34 -03:00 committed by Scott Lahteine
parent fd8d83b7c8
commit f7f1224941
2 changed files with 18 additions and 2 deletions

View File

@ -266,20 +266,25 @@ void spiFlashErase_PIC() {
W25QXX.init(SPI_QUARTER_SPEED); W25QXX.init(SPI_QUARTER_SPEED);
//erase 0x001000 -64K //erase 0x001000 -64K
for (pic_sectorcnt = 0; pic_sectorcnt < (64 - 4) / 4; pic_sectorcnt++) { for (pic_sectorcnt = 0; pic_sectorcnt < (64 - 4) / 4; pic_sectorcnt++) {
watchdog_refresh();
W25QXX.SPI_FLASH_SectorErase(PICINFOADDR + pic_sectorcnt * 4 * 1024); W25QXX.SPI_FLASH_SectorErase(PICINFOADDR + pic_sectorcnt * 4 * 1024);
} }
//erase 64K -- 6M //erase 64K -- 6M
for (pic_sectorcnt = 0; pic_sectorcnt < (PIC_SIZE_xM * 1024 / 64 - 1); pic_sectorcnt++) for (pic_sectorcnt = 0; pic_sectorcnt < (PIC_SIZE_xM * 1024 / 64 - 1); pic_sectorcnt++) {
watchdog_refresh();
W25QXX.SPI_FLASH_BlockErase((pic_sectorcnt + 1) * 64 * 1024); W25QXX.SPI_FLASH_BlockErase((pic_sectorcnt + 1) * 64 * 1024);
}
} }
#if HAS_SPI_FLASH_FONT #if HAS_SPI_FLASH_FONT
void spiFlashErase_FONT() { void spiFlashErase_FONT() {
volatile uint32_t Font_sectorcnt = 0; volatile uint32_t Font_sectorcnt = 0;
W25QXX.init(SPI_QUARTER_SPEED); W25QXX.init(SPI_QUARTER_SPEED);
for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++) for (Font_sectorcnt = 0; Font_sectorcnt < 32-1; Font_sectorcnt++) {
watchdog_refresh();
W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024); W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
} }
}
#endif #endif
uint32_t LogoWrite_Addroffset = 0; uint32_t LogoWrite_Addroffset = 0;
@ -410,6 +415,7 @@ uint8_t public_buf[512];
return; return;
} }
watchdog_refresh();
disp_assets_update_progress(fn); disp_assets_update_progress(fn);
W25QXX.init(SPI_QUARTER_SPEED); W25QXX.init(SPI_QUARTER_SPEED);
@ -422,18 +428,21 @@ uint8_t public_buf[512];
totalSizeLoaded += pfileSize; totalSizeLoaded += pfileSize;
if (assetType == ASSET_TYPE_LOGO) { if (assetType == ASSET_TYPE_LOGO) {
do { do {
watchdog_refresh();
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); Pic_Logo_Write((uint8_t *)fn, public_buf, pbr);
} while (pbr >= BMP_WRITE_BUF_LEN); } while (pbr >= BMP_WRITE_BUF_LEN);
} }
else if (assetType == ASSET_TYPE_TITLE_LOGO) { else if (assetType == ASSET_TYPE_TITLE_LOGO) {
do { do {
watchdog_refresh();
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr);
} while (pbr >= BMP_WRITE_BUF_LEN); } while (pbr >= BMP_WRITE_BUF_LEN);
} }
else if (assetType == ASSET_TYPE_G_PREVIEW) { else if (assetType == ASSET_TYPE_G_PREVIEW) {
do { do {
watchdog_refresh();
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
default_view_Write(public_buf, pbr); default_view_Write(public_buf, pbr);
} while (pbr >= BMP_WRITE_BUF_LEN); } while (pbr >= BMP_WRITE_BUF_LEN);
@ -443,6 +452,7 @@ uint8_t public_buf[512];
SPIFlash.beginWrite(Pic_Write_Addr); SPIFlash.beginWrite(Pic_Write_Addr);
#if HAS_SPI_FLASH_COMPRESSION #if HAS_SPI_FLASH_COMPRESSION
do { do {
watchdog_refresh();
pbr = file.read(public_buf, SPI_FLASH_PageSize); pbr = file.read(public_buf, SPI_FLASH_PageSize);
TERN_(MARLIN_DEV_MODE, totalSizes += pbr); TERN_(MARLIN_DEV_MODE, totalSizes += pbr);
SPIFlash.writeData(public_buf, SPI_FLASH_PageSize); SPIFlash.writeData(public_buf, SPI_FLASH_PageSize);
@ -463,6 +473,7 @@ uint8_t public_buf[512];
else if (assetType == ASSET_TYPE_FONT) { else if (assetType == ASSET_TYPE_FONT) {
Pic_Write_Addr = UNIGBK_FLASH_ADDR; Pic_Write_Addr = UNIGBK_FLASH_ADDR;
do { do {
watchdog_refresh();
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN); pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr); W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
Pic_Write_Addr += pbr; Pic_Write_Addr += pbr;
@ -482,9 +493,11 @@ uint8_t public_buf[512];
disp_assets_update(); disp_assets_update();
disp_assets_update_progress("Erasing pics..."); disp_assets_update_progress("Erasing pics...");
watchdog_refresh();
spiFlashErase_PIC(); spiFlashErase_PIC();
#if HAS_SPI_FLASH_FONT #if HAS_SPI_FLASH_FONT
disp_assets_update_progress("Erasing fonts..."); disp_assets_update_progress("Erasing fonts...");
watchdog_refresh();
spiFlashErase_FONT(); spiFlashErase_FONT();
#endif #endif

View File

@ -123,8 +123,11 @@ void tft_lvgl_init() {
//spi_flash_read_test(); //spi_flash_read_test();
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
watchdog_refresh();
UpdateAssets(); UpdateAssets();
#endif #endif
watchdog_refresh();
mks_test_get(); mks_test_get();
touch.Init(); touch.Init();