Signed-off-by: kevin <kevin@lmve.net>
This commit is contained in:
Submodule code/esp32c3_espidf/components/lvgl updated: 9be768db42...0a05078455
@@ -157,7 +157,9 @@ static lv_fs_res_t fs_close(lv_fs_drv_t *drv, void *file_p)
|
|||||||
|
|
||||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||||
|
|
||||||
int r = fclose(file_p);
|
FILE *f = (FILE *)file_p;
|
||||||
|
|
||||||
|
int r = fclose(f);
|
||||||
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
{
|
{
|
||||||
@@ -192,20 +194,25 @@ static lv_fs_res_t fs_read(lv_fs_drv_t *drv, void *file_p, void *buf, uint32_t b
|
|||||||
|
|
||||||
FILE *f = (FILE *)file_p;
|
FILE *f = (FILE *)file_p;
|
||||||
size_t bytes_read = fread(buf, 1, btr, f);
|
size_t bytes_read = fread(buf, 1, btr, f);
|
||||||
*br = (uint32_t)bytes_read;
|
uint32_t bytes_read_int32 = (uint32_t)bytes_read;
|
||||||
|
|
||||||
if (*br == btr)
|
if (br != NULL) // 逆天 居然会传入NULL
|
||||||
|
{
|
||||||
|
*br = bytes_read_int32;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytes_read_int32 == btr)
|
||||||
{
|
{
|
||||||
res = LV_FS_RES_OK;
|
res = LV_FS_RES_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ESP_LOGE(TAG, "文件读取字节数量错误需要读取%lu 已读取%lu", btr, *br);
|
ESP_LOGE(TAG, "文件读取字节数量错误需要读取%lu 已读取%lu", btr, bytes_read_int32);
|
||||||
res = LV_FS_RES_UNKNOWN;
|
res = LV_FS_RES_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
ESP_LOGI(TAG, "文件读取字节数量:读取%lu 已读取%lu", btr, *br);
|
ESP_LOGI(TAG, "文件读取字节数量:读取%lu 已读取%lu", btr, bytes_read_int32);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -228,16 +235,19 @@ static lv_fs_res_t fs_write(lv_fs_drv_t *drv, void *file_p, const void *buf, uin
|
|||||||
|
|
||||||
FILE *f = (FILE *)file_p;
|
FILE *f = (FILE *)file_p;
|
||||||
size_t bytes_written = fwrite(buf, 1, btw, f);
|
size_t bytes_written = fwrite(buf, 1, btw, f);
|
||||||
*bw = (uint32_t)bytes_written;
|
uint32_t bytes_written_int32 = (uint32_t)bytes_written;
|
||||||
|
if (bw != NULL)
|
||||||
if (*bw == btw)
|
{
|
||||||
|
*bw = bytes_written_int32;
|
||||||
|
}
|
||||||
|
if (bytes_written_int32 == btw)
|
||||||
{
|
{
|
||||||
res = LV_FS_RES_OK;
|
res = LV_FS_RES_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ESP_LOGE(TAG, "文件写入字节数量错误需要写入%lu 已写入%lu", btw, *bw);
|
ESP_LOGE(TAG, "文件写入字节数量错误需要写入%lu 已写入%lu", btw, bytes_written_int32);
|
||||||
res = LV_FS_RES_UNKNOWN;
|
res = LV_FS_RES_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -257,7 +267,7 @@ static lv_fs_res_t fs_seek(lv_fs_drv_t *drv, void *file_p, uint32_t pos, lv_fs_w
|
|||||||
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
|
||||||
|
|
||||||
/*Add your code here*/
|
/*Add your code here*/
|
||||||
ESP_LOGI(TAG, "fs_seek:pop%lu whence%d",pos,whence);
|
ESP_LOGI(TAG, "fs_seek:pop%lu whence%d", pos, whence);
|
||||||
|
|
||||||
FILE *f = (FILE *)file_p;
|
FILE *f = (FILE *)file_p;
|
||||||
int std_whence;
|
int std_whence;
|
||||||
|
|||||||
Reference in New Issue
Block a user