Skip to content

Commit cc888d9

Browse files
committed
Merge branch 'fs-reinit' into fs-reinit-plus-titano
2 parents 81e948a + 271ffd4 commit cc888d9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/provisioning/tinyusb/Wippersnapper_FS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Wippersnapper_FS::Wippersnapper_FS() {
9595

9696
// If a filesystem does not already exist - attempt to initialize a new
9797
// filesystem
98-
if (!initFilesystem()) {
98+
if (!initFilesystem() || !initFilesystem(true)) {
9999
WS_DEBUG_PRINTLN("ERROR Initializing Filesystem");
100100
setStatusLEDColor(RED);
101101
while (1)
@@ -123,13 +123,13 @@ Wippersnapper_FS::~Wippersnapper_FS() {}
123123
@return True if filesystem initialized correctly, false otherwise.
124124
*/
125125
/**************************************************************************/
126-
bool Wippersnapper_FS::initFilesystem() {
126+
bool Wippersnapper_FS::initFilesystem(bool force_format) {
127127
// Init. flash library
128128
if (!flash.begin())
129129
return false;
130130

131131
// Check if FS exists
132-
if (!wipperFatFs.begin(&flash)) {
132+
if (force_format || !wipperFatFs.begin(&flash)) {
133133
// No filesystem exists - create a new FS
134134
// NOTE: THIS WILL ERASE ALL DATA ON THE FLASH
135135
if (!makeFilesystem())

src/provisioning/tinyusb/Wippersnapper_FS.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Wippersnapper_FS {
4444
Wippersnapper_FS();
4545
~Wippersnapper_FS();
4646

47-
bool initFilesystem();
47+
bool initFilesystem(bool force_format = false);
4848
void initUSBMSC();
4949

5050
void eraseCPFS();

0 commit comments

Comments
 (0)