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

Protection to ensure only one or the other is initialised in regards to blackbox (for BlueJayF4)

This commit is contained in:
blckmn 2017-02-25 16:24:01 +11:00
parent ff40e8c844
commit 4b799ada5e
4 changed files with 20 additions and 8 deletions

View file

@ -1657,7 +1657,8 @@ void handleBlackbox(timeUs_t currentTimeUs)
static bool canUseBlackboxWithCurrentConfiguration(void)
{
return feature(FEATURE_BLACKBOX);
return feature(FEATURE_BLACKBOX) &&
(blackboxConfig()->device != BLACKBOX_SDCARD || feature(FEATURE_SDCARD));
}
/**

View file

@ -23,6 +23,12 @@
#include "config/parameter_group.h"
typedef enum {
BLACKBOX_SERIAL = 0,
BLACKBOX_SPIFLASH,
BLACKBOX_SDCARD
} blackBoxDevice_e;
typedef struct blackboxConfig_s {
uint8_t rate_num;
uint8_t rate_denom;

View file

@ -488,15 +488,16 @@ void init(void)
#endif
#ifdef USE_FLASHFS
if (blackboxConfig()->device == BLACKBOX_SPIFLASH) {
#if defined(USE_FLASH_M25P16)
m25p16_init(flashConfig());
m25p16_init(flashConfig());
#endif
flashfsInit();
flashfsInit();
}
#endif
#ifdef USE_SDCARD
if (feature(FEATURE_SDCARD)) {
if (feature(FEATURE_SDCARD) && blackboxConfig()->device == BLACKBOX_SDCARD) {
sdcardInsertionDetectInit();
sdcard_init(sdcardConfig()->useDma);
afatfs_init();

View file

@ -57,9 +57,13 @@ void targetPreInit(void)
/* ensure the CS pin for the flash is pulled hi so any SD card initialisation does not impact the chip */
if (hardwareRevision == BJF4_REV3) {
IO_t io = IOGetByTag(IO_TAG(M25P16_CS_PIN));
IOConfigGPIO(io, IOCFG_OUT_PP);
IOHi(io);
IO_t flashIo = IOGetByTag(IO_TAG(M25P16_CS_PIN));
IOConfigGPIO(flashIo, IOCFG_OUT_PP);
IOHi(flashIo);
IO_t sdcardIo = IOGetByTag(IO_TAG(SDCARD_SPI_CS_PIN));
IOConfigGPIO(sdcardIo, IOCFG_OUT_PP);
IOHi(sdcardIo);
}
}