Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@ _build
# Generated rst files
######################
genrst/

# ctags and similar
###################
TAGS

# Merge leftovers
#################
*.orig

27 changes: 18 additions & 9 deletions atmel-samd/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,25 @@ void init_flash_fs(bool create_allowed) {
if (res == FR_NO_FILESYSTEM && create_allowed) {
// no filesystem so create a fresh one

uint8_t working_buf[_MAX_SS];
res = f_mkfs(&vfs_fat->fatfs, FM_FAT, 0, working_buf, sizeof(working_buf));
// Flush the new file system to make sure its repaired immediately.
flash_flush();
if (res != FR_OK) {
return;
}
// Wait two seconds before creating. Jittery power might
// fail before we're ready. This can happen if someone
// is bobbling a bit when plugging in a battery.
mp_hal_delay_ms(2000);

// Then try one more time to mount the flash in case it was late coming up.
res = f_mount(&vfs_fat->fatfs);
if (res == FR_NO_FILESYSTEM) {
uint8_t working_buf[_MAX_SS];
res = f_mkfs(&vfs_fat->fatfs, FM_FAT, 0, working_buf, sizeof(working_buf));
// Flush the new file system to make sure its repaired immediately.
flash_flush();
if (res != FR_OK) {
return;
}

// set label
f_setlabel(&vfs_fat->fatfs, "CIRCUITPY");
// set label
f_setlabel(&vfs_fat->fatfs, "CIRCUITPY");
}
} else if (res != FR_OK) {
return;
}
Expand Down