rp2/modules: Fix FatFS boot script to detect invalid FAT filesystem.
This change helps detect if the filesystem is invalid, by also including the first mount attempt within the try-except. Then the FAT is reformatted if needed. Fixes issue #15779. Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
This commit is contained in:
committed by
Damien George
parent
ded8bbdd5e
commit
451ba1cf38
@@ -5,10 +5,9 @@ import machine, rp2
|
|||||||
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
# Try to mount the filesystem, and format the flash if it doesn't exist.
|
||||||
bdev = rp2.Flash()
|
bdev = rp2.Flash()
|
||||||
try:
|
try:
|
||||||
fs = vfs.VfsFat(bdev)
|
vfs.mount(vfs.VfsFat(bdev), "/")
|
||||||
except:
|
except:
|
||||||
vfs.VfsFat.mkfs(bdev)
|
vfs.VfsFat.mkfs(bdev)
|
||||||
fs = vfs.VfsFat(bdev)
|
vfs.mount(vfs.VfsFat(bdev), "/")
|
||||||
vfs.mount(fs, "/")
|
|
||||||
|
|
||||||
del vfs, bdev, fs
|
del vfs, bdev
|
||||||
|
|||||||
Reference in New Issue
Block a user