Dear Friends,
I’m desperately trying to get the internal filesystem of an ESP32 working inside the LVGL framework. I am using LVGL 9.1.0. The first issue was that it couldn’t compile because of an “unknown type name ‘DIR’; did you mean ‘DDR’” error. After a lot of searching, I finally found following fix: FIX, which for whatever reason hasn’t been implemented in version 9.1. This solved the error preventing a successful compilation. However, I could find nowhere a good, working example code of the Usage of FatFS in LVGL. Before the question arises: the filesystem works great, when I utilize the traditional “FFat.h” to access it.
lv_conf.h has been modified as follows:
#define LV_USE_FS_FATFS 1
#if LV_USE_FS_FATFS
#define LV_FS_FATFS_LETTER 'A' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
#define LV_FS_FATFS_CACHE_SIZE 460800 /*>0 to cache this number of bytes in lv_fs_read()*/
#endif
The small sample code is as follows:
#include <lvgl.h>
void setup() {
Serial.begin(115200);
Serial.println("Small FatFS Test!");
lv_init();
//_lv_fs_init();
char buf;
Serial.println(lv_fs_is_ready('A'));
lv_fs_get_letters(&buf);
Serial.println(buf);
lv_fs_file_t f;
lv_fs_res_t res;
res = lv_fs_open(&f, "A:picture.png", LV_FS_MODE_RD);
Serial.println(res);
lv_fs_close(&f);
Serial.println("Finish Setup!");
}
The code returns:
Small FatFS Test!
1 (<- Filesystem should be ready - CORRECT)
A (<- Should be mounted to the letter 'A' - CORRECT)
12 (<- I'm assuming this indicates an 'LV_FS_RES_UNKNOWN' Error.)
Finish Setup!
What am I missing? What do I need to do in order to access the filesystem correctly? Am I missing some initialization? Of course, the file exists. If I try to open a directory with lv_fs_dir_open the same LV_FS_RES_UNKNOWN Error is thrown - even when I try to access the root with A: or A:/