diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-07-29 10:47:24 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-29 10:47:24 -0700 |
| commit | b76d37f24a3f1d8e26e080ed9b88e05af6dfae5c (patch) | |
| tree | ff13b3c6131c969c54d5d22e5160f9898a356373 /shared-module/storage | |
| parent | 05a1519e5d1f508ab02c27da5f30eeb87ed56819 (diff) | |
| parent | 65c22aa4347abc145493f44a4bc8d91a4f200860 (diff) | |
Merge pull request #3223 from dhalbert/unmount-before-reset
storage.erase_filesystem(): disconnect from USB and wait 1 second before resetting
Diffstat (limited to 'shared-module/storage')
| -rw-r--r-- | shared-module/storage/__init__.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/shared-module/storage/__init__.c b/shared-module/storage/__init__.c index aa3bcc686..5864307fd 100644 --- a/shared-module/storage/__init__.c +++ b/shared-module/storage/__init__.c @@ -30,6 +30,7 @@ #include "extmod/vfs.h" #include "py/mperrno.h" +#include "py/mphal.h" #include "py/obj.h" #include "py/runtime.h" #include "shared-bindings/microcontroller/__init__.h" @@ -159,6 +160,8 @@ void common_hal_storage_remount(const char *mount_path, bool readonly, bool disa } void common_hal_storage_erase_filesystem(void) { + usb_disconnect(); + mp_hal_delay_ms(1000); filesystem_init(false, true); // Force a re-format. common_hal_mcu_reset(); // We won't actually get here, since we're resetting. |
