allow safely call InternalFS.begin() multple times
This commit is contained in:
1 parent
ba0af40808
commit
7e6891e5c8
2 files changed
+8
-3
No files matched your search
@@ -182,6 +182,8 @@ LittleFS::LittleFS (void)
|
||||
_lfs_cfg.block_size = LFS_BLOCK_SIZE;
|
||||
_lfs_cfg.block_count = LFS_FLASH_SIZE / LFS_BLOCK_SIZE;
|
||||
_lfs_cfg.lookahead = 128;
|
||||
|
||||
_begun = false;
|
||||
}
|
||||
|
||||
LittleFS::~LittleFS ()
|
||||
@@ -191,6 +193,9 @@ LittleFS::~LittleFS ()
|
||||
|
||||
bool LittleFS::begin (void)
|
||||
{
|
||||
if ( _begun ) return true;
|
||||
_begun = true;
|
||||
|
||||
int err = lfs_mount(&_lfs, &_lfs_cfg);
|
||||
|
||||
// reformat if we can't mount the filesystem
|
||||
|
||||
@@ -68,12 +68,12 @@ class LittleFS: public BluefuritLib::FileSystemClass
|
||||
virtual void _f_rewindDirectory (void* fhdl);
|
||||
|
||||
private:
|
||||
BluefuritLib::File _open_file (char const *filepath, uint8_t mode);
|
||||
BluefuritLib::File _open_dir (char const *filepath);
|
||||
|
||||
struct lfs_config _lfs_cfg;
|
||||
lfs_t _lfs;
|
||||
bool _begun;
|
||||
|
||||
BluefuritLib::File _open_file (char const *filepath, uint8_t mode);
|
||||
BluefuritLib::File _open_dir (char const *filepath);
|
||||
};
|
||||
|
||||
extern LittleFS InternalFS;
|
||||
|
||||
Reference in new issue
Block a user