File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
3
3
## [ Unreleased]
4
- -
4
+ - Attempt to fix flaky SD behavior
5
5
6
6
## 9.5.0 [ released 2021-03-10]
7
7
- RestoreFrommnemonic: ported to Rust. Will now return UserAbortError on user abort instead of GenericError.
Original file line number Diff line number Diff line change @@ -380,7 +380,17 @@ bool sd_card_inserted(void)
380
380
#else
381
381
sd_mmc_err_t err = sd_mmc_check (0 );
382
382
sd_mmc_pause_clock ();
383
- return (err == SD_MMC_OK || err == SD_MMC_INIT_ONGOING );
383
+ /* If initialization is ongoing, wait up to 1 second for it to initialize */
384
+ if (err == SD_MMC_INIT_ONGOING ) {
385
+ for (int i = 0 ; i < 10 ; ++ i ) {
386
+ delay_ms (100 );
387
+ err = sd_mmc_check (0 );
388
+ if (err != SD_MMC_INIT_ONGOING ) {
389
+ break ;
390
+ }
391
+ }
392
+ }
393
+ return err == SD_MMC_OK ;
384
394
#endif
385
395
}
386
396
You can’t perform that action at this time.
0 commit comments