@@ -313,7 +313,9 @@ DRESULT disk_ioctl (
|
||||
|
||||
// TODO everything here should not be in the driver layer ...
|
||||
|
||||
bool _g_FATFS_init = false;
|
||||
FATFS g_FATFS_Obj __DMA; // initialized in boardInit()
|
||||
|
||||
#if defined(LOG_TELEMETRY)
|
||||
FIL g_telemetryFile = {};
|
||||
#endif
|
||||
@@ -348,6 +350,7 @@ void sdMount()
|
||||
|
||||
if (f_mount(&g_FATFS_Obj, "", 1) == FR_OK) {
|
||||
// call sdGetFreeSectors() now because f_getfree() takes a long time first time it's called
|
||||
_g_FATFS_init = true;
|
||||
sdGetFreeSectors();
|
||||
|
||||
#if defined(LOG_TELEMETRY)
|
||||
@@ -378,7 +381,7 @@ void sdDone()
|
||||
|
||||
uint32_t sdMounted()
|
||||
{
|
||||
return g_FATFS_Obj.fs_type != 0;
|
||||
return _g_FATFS_init && g_FATFS_Obj.fs_type != 0;
|
||||
}
|
||||
|
||||
uint32_t sdIsHC()
|
||||
|
||||
Reference in New Issue
Block a user