Skip to content

Commit e9db24b

Browse files
Update files
1 parent dc5bae2 commit e9db24b

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

building/lv_conf.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,15 +755,15 @@ extern void *mp_lv_roots;
755755
#endif
756756

757757
/*API for memory-mapped file access. */
758-
#define LV_USE_FS_MEMFS 0
758+
#define LV_USE_FS_MEMFS 1
759759
#if LV_USE_FS_MEMFS
760760
#define LV_FS_MEMFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
761761
#endif
762762

763763
/*API for LittleFs. */
764-
#define LV_USE_FS_LITTLEFS 0
764+
#define LV_USE_FS_LITTLEFS 1
765765
#if LV_USE_FS_LITTLEFS
766-
#define LV_FS_LITTLEFS_LETTER '\0' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
766+
#define LV_FS_LITTLEFS_LETTER 'L' /*Set an upper cased letter on which the drive will accessible (e.g. 'A')*/
767767
#endif
768768

769769
/*API for Arduino LittleFs. */

internal_filesystem/apps/com.example.files/assets/files.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import lvgl as lv
22
import uos
3+
import vfs
34
import machine
45
import time
56

6-
subwindow.clean()
7-
canary = lv.obj(subwindow)
8-
canary.add_flag(lv.obj.FLAG.HIDDEN)
9-
107
# LVGL File System Driver for LittleFS
118
class LittleFSDriver:
129
def __init__(self, letter='L'):
1310
self.letter = letter
14-
self.files = {} # Track open files
11+
self.files = {}
1512
def init(self):
1613
drv = lv.fs_drv_t()
1714
lv.fs_drv_init(drv)
@@ -107,10 +104,9 @@ def dir_read_cb(self, drv, dir_p, fn):
107104
dir_obj = self.files[dir_id]
108105
if dir_obj['index'] < len(dir_obj['list']):
109106
name = dir_obj['list'][dir_obj['index']]
110-
# Check if it's a directory
111107
try:
112108
uos.stat(dir_obj['path'] + '/' + name + '/')
113-
name = '/' + name # Prefix directories with '/'
109+
name = '/' + name
114110
except:
115111
pass
116112
dir_obj['index'] += 1
@@ -131,19 +127,19 @@ def dir_close_cb(self, drv, dir_p):
131127
fs_drv = LittleFSDriver('L')
132128
fs_drv.init()
133129

130+
# Create subwindow
131+
subwindow = lv.obj()
132+
subwindow.set_size(lv.pct(100), lv.pct(100))
134133
# Create File Explorer
135134
def file_explorer_event_cb(e):
136135
code = e.get_code()
137136
obj = e.get_target()
138-
if code == lv.EVENT_VALUE_CHANGED:
137+
if code == lv.EVENT.VALUE_CHANGED:
139138
file_path = obj.get_selected_file_path()
140139
print(f"Selected file: {file_path}")
141140

142141

143142
explorer = lv.file_explorer(subwindow)
144143
explorer.set_size(lv.pct(100), lv.pct(100))
145-
#explorer.set_root_path("L:/")
144+
explorer.set_root_path("L:/")
146145
explorer.add_event_cb(file_explorer_event_cb, lv.EVENT.VALUE_CHANGED, None)
147-
148-
while canary.is_valid():
149-
time.sleep_ms(100)

0 commit comments

Comments
 (0)