1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 22:05:17 +03:00

Restructure flashfs MSC to prevent device timeout on MacOS

For devices using the 1Gb NAND flash the scanning phase that discovers the individual logs was taking to long resulting in the operating system thinking the mass storage device had become unresponsive. It is simply a factor of the larger flash size and the amount of time needed to scan all 2K blocks.

Restructured to scan the flash before initializing and starting the USB device. That way the mass storage device can start quickly and bee immediately ready for operating system requests.
This commit is contained in:
Bruce Luckcuck 2019-12-01 10:22:59 -05:00
parent 9425831756
commit ee3c0e4f97
5 changed files with 44 additions and 34 deletions

View file

@ -122,6 +122,7 @@
#include "io/vtx_smartaudio.h"
#include "io/vtx_tramp.h"
#include "msc/emfat_file.h"
#ifdef USE_PERSISTENT_MSC_RTC
#include "msc/usbd_storage.h"
#endif
@ -611,6 +612,16 @@ void init(void)
* so there is no bottleneck in reading and writing data */
mscInit();
if (mscCheckBoot() || mscCheckButton()) {
ledInit(statusLedConfig());
#if defined(USE_FLASHFS) && defined(USE_FLASH_CHIP)
// If the blackbox device is onboard flash, then initialize and scan
// it to identify the log files *before* starting the USB device to
// prevent timeouts of the mass storage device.
if (blackboxConfig()->device == BLACKBOX_DEVICE_FLASH) {
emfat_init_files();
}
#endif
if (mscStart() == 0) {
mscWaitForButton();
} else {