Skip to content

Commit 40431c7

Browse files
Qinghao ShiSeppo Takalo
authored andcommitted
update master with forced formating
1 parent a647cf9 commit 40431c7

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
// Maximum number of elements in buffer
2323
#define BUFFER_MAX_LEN 10
24-
24+
#define FORCE_REFORMAT true
2525
// This will take the system's default block device
2626
BlockDevice *bd = BlockDevice::get_default_instance();
2727

@@ -82,10 +82,9 @@ int main() {
8282
fflush(stdout);
8383
int err = fs.mount(bd);
8484
printf("%s\n", (err ? "Fail :(" : "OK"));
85-
if (err) {
85+
if (err || FORCE_REFORMAT) {
8686
// Reformat if we can't mount the filesystem
87-
// this should only happen on the first boot
88-
printf("No filesystem found, formatting... ");
87+
printf("formatting... ");
8988
fflush(stdout);
9089
err = fs.reformat(bd);
9190
printf("%s\n", (err ? "Fail :(" : "OK"));

tests/filesystem.log

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
--- Mbed OS filesystem example ---
22
Mounting the filesystem... OK
3-
Opening "\/fs\/numbers.txt"... OK
43
Incrementing numbers \(10\/10\)... OK
54
Closing "\/fs\/numbers.txt"... OK
65
Opening the root directory... OK

0 commit comments

Comments
 (0)