Radio init / masstorage start / massstorage end / shutdown sequences … (#3674)

* Radio init / masstorage start / massstorage end / shutdown sequences reordering:

- More traces
- Fixes #3642
- Reuses idea of #3662

Still not finished and completely untested

* More traces

* Compilation fix

* Reuses the idea of #3652

* Alarms were checked 2 times on massstorage end
This commit is contained in:
Bertrand Songis
2016-08-01 18:39:34 +02:00
committed by GitHub
parent 6c34752907
commit 6d2c5a4db6
16 changed files with 109 additions and 63 deletions
+12 -2
View File
@@ -292,14 +292,22 @@ FATFS g_FATFS_Obj __DMA;
FIL g_telemetryFile = {0};
#endif
void sdInit(void)
void sdInit()
{
TRACE("sdInit");
ioMutex = CoCreateMutex();
if (ioMutex >= CFG_MAX_MUTEX ) {
if (ioMutex >= CFG_MAX_MUTEX) {
// sd error
return;
}
sdMount();
}
void sdMount()
{
TRACE("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
sdGetFreeSectors();
@@ -320,6 +328,8 @@ void sdInit(void)
void sdDone()
{
TRACE("sdDone");
if (sdMounted()) {
audioQueue.stopSD();
#if defined(LOG_TELEMETRY)