Skip to content

Commit 8156663

Browse files
committed
Don't report mount failure when formatting
Fixes igrr/mkspiffs#39.
1 parent dc797c2 commit 8156663

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

main.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,22 +103,24 @@ int spiffsTryMount()
103103
NULL);
104104
}
105105

106-
bool spiffsMount()
106+
bool spiffsMount(bool printError = true)
107107
{
108108
if (SPIFFS_mounted(&s_fs)) {
109109
return true;
110110
}
111111
int res = spiffsTryMount();
112112
if (res != SPIFFS_OK) {
113-
std::cerr << "SPIFFS mount failed with error: " << res << std::endl;
113+
if (printError) {
114+
std::cerr << "SPIFFS mount failed with error: " << res << std::endl;
115+
}
114116
return false;
115117
}
116118
return true;
117119
}
118120

119121
bool spiffsFormat()
120122
{
121-
spiffsMount();
123+
spiffsMount(false);
122124
SPIFFS_unmount(&s_fs);
123125
int formated = SPIFFS_format(&s_fs);
124126
if (formated != SPIFFS_OK) {

0 commit comments

Comments
 (0)