Unmount the FS befor formating

This commit is contained in:
Jeremy Poulter committed 2019-03-11 22:35:58 +00:00
1 parent f42cf4b60b
commit affe391677
2 files changed
+9 -1

No files matched your search

+8 -1
View File
@@ -193,6 +193,7 @@ LittleFS::LittleFS (void)
_lfs_cfg.lookahead = 128;
_begun = false;
_mounted = false;
}
LittleFS::~LittleFS ()
@@ -212,6 +213,8 @@ bool LittleFS::begin (void)
{
LOG_LV1("IFLASH", "Format internal file system");
this->format(false);
} else {
_mounted = true;
}
return true;
@@ -226,10 +229,14 @@ bool LittleFS::format (bool eraseall)
flash_nrf5x_erase(addr);
}
}
if(_mounted) {
VERIFY_LFS(lfs_unmount(&_lfs), false);
}
VERIFY_LFS(lfs_format(&_lfs, &_lfs_cfg), false);
VERIFY_LFS(lfs_mount(&_lfs, &_lfs_cfg), false);
_mounted = true;
return true;
}