Descriptions
I’m use .bin files to save images, when i load large image it too slow
What MCU/Processor/Board and compiler are you using?
ESP32-S3
What LVGL version are you using?
V8.3
What do you want to achieve?
I wanna load lager image .bin file quickly
What have you tried so far?
increase drv->cache_size it not work still slow
Code to reproduce
Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.
The code block(s) should be formatted like:
static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
void * f = NULL;
if(mode == LV_FS_MODE_WR) {
/*Open a file for write*/
f = "wb"; /*Add your code here*/
}
else if(mode == LV_FS_MODE_RD) {
/*Open a file for read*/
f = "rb"; /*Add your code here*/
}
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) {
/*Open a file for read and write*/
f = "rb+"; /*Add your code here*/
}
char filepath[256]={0};
sprintf(filepath, LV_FS_PATH "%s", path);
ESP_LOGI(TAG, "filepath: %s", filepath);
FILE* pf = fopen(filepath, f);
uint16_t size;
fseek(pf, 0, SEEK_END);
size = ftell(pf);
drv->cache_size = size;
rewind(pf);
ESP_LOGI(TAG, "file total size: %d", size);
if (pf == NULL)
{
ESP_LOGE(TAG, "open file failed ");
}
return pf;//fopen(filepath, f);
}
static lv_fs_res_t fs_read(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/*Add your code here*/
ESP_LOGE(TAG, "real read file size: %ld ", btr);
*br = fread(buf, 1, btr, file_p);
return (int32_t)(*br) < 0 ? LV_FS_RES_UNKNOWN : LV_FS_RES_OK;
}
Screenshot and/or video
If possible, add screenshots and/or videos about the current state.