Skip to content

Commit

Permalink
Merge branch 'fs-reinit' into fs-reinit-plus-titano
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeth committed Jan 17, 2024
2 parents 81e948a + 271ffd4 commit cc888d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/provisioning/tinyusb/Wippersnapper_FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Wippersnapper_FS::Wippersnapper_FS() {

// If a filesystem does not already exist - attempt to initialize a new
// filesystem
if (!initFilesystem()) {
if (!initFilesystem() || !initFilesystem(true)) {
WS_DEBUG_PRINTLN("ERROR Initializing Filesystem");
setStatusLEDColor(RED);
while (1)
Expand Down Expand Up @@ -123,13 +123,13 @@ Wippersnapper_FS::~Wippersnapper_FS() {}
@return True if filesystem initialized correctly, false otherwise.
*/
/**************************************************************************/
bool Wippersnapper_FS::initFilesystem() {
bool Wippersnapper_FS::initFilesystem(bool force_format) {
// Init. flash library
if (!flash.begin())
return false;

// Check if FS exists
if (!wipperFatFs.begin(&flash)) {
if (force_format || !wipperFatFs.begin(&flash)) {
// No filesystem exists - create a new FS
// NOTE: THIS WILL ERASE ALL DATA ON THE FLASH
if (!makeFilesystem())
Expand Down
2 changes: 1 addition & 1 deletion src/provisioning/tinyusb/Wippersnapper_FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Wippersnapper_FS {
Wippersnapper_FS();
~Wippersnapper_FS();

bool initFilesystem();
bool initFilesystem(bool force_format = false);
void initUSBMSC();

void eraseCPFS();
Expand Down

0 comments on commit cc888d9

Please sign in to comment.