diff options
| author | Dan Halbert <halbert@halwitz.org> | 2017-11-07 21:05:49 -0500 |
|---|---|---|
| committer | Scott Shawcroft <scott@tannewt.org> | 2017-12-20 09:02:30 -0800 |
| commit | 23dd19757aadbb64112b882cd4ee2082d04791ee (patch) | |
| tree | e1a6a5fc8a01cfc57710588fcc126df02d977153 /atmel-samd | |
| parent | 22bbb6ab86fd1b843e03fb2474f69e6118c8aaad (diff) | |
Wait 2 secs before creating new filesystem in case power is jittery
Diffstat (limited to 'atmel-samd')
| -rw-r--r-- | atmel-samd/main.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/atmel-samd/main.c b/atmel-samd/main.c index 091dfa447..0013f3e20 100644 --- a/atmel-samd/main.c +++ b/atmel-samd/main.c @@ -122,6 +122,11 @@ void init_flash_fs(bool create_allowed) { if (res == FR_NO_FILESYSTEM && create_allowed) { // no filesystem so create a fresh one + // 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); + 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. |
