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
+1 -1
View File
@@ -149,7 +149,7 @@ void boardInit()
__enable_irq();
TRACE("Horus started :)");
TRACE("\nHorus board started :)");
keysInit();
adcInit();
+1
View File
@@ -109,6 +109,7 @@ uint32_t sdGetSpeed(void);
#define SD_GET_FREE_BLOCKNR() (sdGetFreeSectors())
#define SD_CARD_PRESENT() (~SD_PRESENT_GPIO->IDR & SD_PRESENT_GPIO_PIN)
void sdInit(void);
void sdMount(void);
void sdDone(void);
#define sdPoll10ms()
#define sdMountPoll()
+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)
+2
View File
@@ -843,6 +843,8 @@ const char * sdEnum()
void sdInit()
{
TRACE("sdInit");
const char * result;
uint8_t i;
@@ -151,9 +151,9 @@ uint32_t unlocked = 0;
extern uint32_t EepromBlocked;
extern void init_spi(void);
extern void writeBlock(void);
extern void usbPluggedIn();
void init_spi(void);
void writeBlock(void);
void usbPluggedIn();
#if defined(PCBX9E)
typedef int32_t rotenc_t;
+2
View File
@@ -992,6 +992,8 @@ void sdInit(void)
// TODO shouldn't be there!
void sdInit(void)
{
TRACE("sdInit");
ioMutex = CoCreateMutex();
if (ioMutex >= CFG_MAX_MUTEX ) {
//sd error