Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitec1d29f

Browse files
dhalberttannewt
authored andcommitted
check twice for bad filesystem
1 parent23dd197 commitec1d29f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

‎atmel-samd/main.c‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,20 @@ void init_flash_fs(bool create_allowed) {
127127
// is bobbling a bit when plugging in a battery.
128128
mp_hal_delay_ms(2000);
129129

130-
uint8_tworking_buf[_MAX_SS];
131-
res=f_mkfs(&vfs_fat->fatfs,FM_FAT,0,working_buf,sizeof(working_buf));
132-
// Flush the new file system to make sure its repaired immediately.
133-
flash_flush();
134-
if (res!=FR_OK) {
135-
return;
136-
}
130+
// Then try one more time to mount the flash in case it was late coming up.
131+
res=f_mount(&vfs_fat->fatfs);
132+
if (res==FR_NO_FILESYSTEM) {
133+
uint8_tworking_buf[_MAX_SS];
134+
res=f_mkfs(&vfs_fat->fatfs,FM_FAT,0,working_buf,sizeof(working_buf));
135+
// Flush the new file system to make sure its repaired immediately.
136+
flash_flush();
137+
if (res!=FR_OK) {
138+
return;
139+
}
137140

138-
// set label
139-
f_setlabel(&vfs_fat->fatfs,"CIRCUITPY");
141+
// set label
142+
f_setlabel(&vfs_fat->fatfs,"CIRCUITPY");
143+
}
140144
}elseif (res!=FR_OK) {
141145
return;
142146
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp