mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Default blackbox device to NONE on reset (#12221)
* Default blackbox device to NONE on reset * Add check for flashIsSupported * Move blackbox validation outside of validateAndFixGyroConfig()
This commit is contained in:
parent
99088f28d1
commit
d9264045b3
5 changed files with 28 additions and 19 deletions
|
@ -88,7 +88,7 @@
|
||||||
#elif defined(ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT)
|
#elif defined(ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT)
|
||||||
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SDCARD
|
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SDCARD
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SERIAL
|
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_NONE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 3);
|
PG_REGISTER_WITH_RESET_TEMPLATE(blackboxConfig_t, blackboxConfig, PG_BLACKBOX_CONFIG, 3);
|
||||||
|
@ -873,7 +873,7 @@ STATIC_UNIT_TESTED bool writeSlowFrameIfNeeded(void)
|
||||||
|
|
||||||
void blackboxValidateConfig(void)
|
void blackboxValidateConfig(void)
|
||||||
{
|
{
|
||||||
// If we've chosen an unsupported device, change the device to serial
|
// If we've chosen an unsupported device, change the device to NONE
|
||||||
switch (blackboxConfig()->device) {
|
switch (blackboxConfig()->device) {
|
||||||
#ifdef USE_FLASHFS
|
#ifdef USE_FLASHFS
|
||||||
case BLACKBOX_DEVICE_FLASH:
|
case BLACKBOX_DEVICE_FLASH:
|
||||||
|
@ -886,7 +886,7 @@ void blackboxValidateConfig(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
blackboxConfigMutable()->device = BLACKBOX_DEVICE_SERIAL;
|
blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -593,6 +593,10 @@ static void validateAndFixConfig(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_BLACKBOX
|
||||||
|
validateAndFixBlackBox();
|
||||||
|
#endif // USE_BLACKBOX
|
||||||
|
|
||||||
#if defined(TARGET_VALIDATECONFIG)
|
#if defined(TARGET_VALIDATECONFIG)
|
||||||
// This should be done at the end of the validation
|
// This should be done at the end of the validation
|
||||||
targetValidateConfiguration();
|
targetValidateConfiguration();
|
||||||
|
@ -687,7 +691,19 @@ void validateAndFixGyroConfig(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (systemConfig()->activeRateProfile >= CONTROL_RATE_PROFILE_COUNT) {
|
||||||
|
systemConfigMutable()->activeRateProfile = 0;
|
||||||
|
}
|
||||||
|
loadControlRateProfile();
|
||||||
|
|
||||||
|
if (systemConfig()->pidProfileIndex >= PID_PROFILE_COUNT) {
|
||||||
|
systemConfigMutable()->pidProfileIndex = 0;
|
||||||
|
}
|
||||||
|
loadPidProfile();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef USE_BLACKBOX
|
#ifdef USE_BLACKBOX
|
||||||
|
void validateAndFixBlackBox(void) {
|
||||||
#ifndef USE_FLASHFS
|
#ifndef USE_FLASHFS
|
||||||
if (blackboxConfig()->device == BLACKBOX_DEVICE_FLASH) {
|
if (blackboxConfig()->device == BLACKBOX_DEVICE_FLASH) {
|
||||||
blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
|
blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
|
||||||
|
@ -702,18 +718,8 @@ void validateAndFixGyroConfig(void)
|
||||||
blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
|
blackboxConfigMutable()->device = BLACKBOX_DEVICE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // USE_BLACKBOX
|
|
||||||
|
|
||||||
if (systemConfig()->activeRateProfile >= CONTROL_RATE_PROFILE_COUNT) {
|
|
||||||
systemConfigMutable()->activeRateProfile = 0;
|
|
||||||
}
|
|
||||||
loadControlRateProfile();
|
|
||||||
|
|
||||||
if (systemConfig()->pidProfileIndex >= PID_PROFILE_COUNT) {
|
|
||||||
systemConfigMutable()->pidProfileIndex = 0;
|
|
||||||
}
|
|
||||||
loadPidProfile();
|
|
||||||
}
|
}
|
||||||
|
#endif // USE_BLACKBOX
|
||||||
|
|
||||||
bool readEEPROM(void)
|
bool readEEPROM(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,6 +68,9 @@ void ensureEEPROMStructureIsValid(void);
|
||||||
|
|
||||||
void saveConfigAndNotify(void);
|
void saveConfigAndNotify(void);
|
||||||
void validateAndFixGyroConfig(void);
|
void validateAndFixGyroConfig(void);
|
||||||
|
#ifdef USE_BLACKBOX
|
||||||
|
void validateAndFixBlackBox(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
void setConfigDirty(void);
|
void setConfigDirty(void);
|
||||||
bool isConfigDirty(void);
|
bool isConfigDirty(void);
|
||||||
|
|
|
@ -234,9 +234,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_FLASH
|
#ifdef USE_FLASH
|
||||||
#define USE_FLASHFS
|
|
||||||
#define USE_FLASH_TOOLS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(USE_FLASH_W25M512) || defined(USE_FLASH_W25Q128FV)) && !defined(USE_FLASH_M25P16)
|
#if (defined(USE_FLASH_W25M512) || defined(USE_FLASH_W25Q128FV)) && !defined(USE_FLASH_M25P16)
|
||||||
#define USE_FLASH_M25P16
|
#define USE_FLASH_M25P16
|
||||||
|
@ -252,9 +249,14 @@
|
||||||
|
|
||||||
#if defined(USE_FLASH_M25P16) || defined(USE_FLASH_W25M) || defined(USE_FLASH_W25N01G) || defined(USE_FLASH_W25Q128FV)
|
#if defined(USE_FLASH_M25P16) || defined(USE_FLASH_W25M) || defined(USE_FLASH_W25N01G) || defined(USE_FLASH_W25Q128FV)
|
||||||
#define USE_FLASH_CHIP
|
#define USE_FLASH_CHIP
|
||||||
|
#define USE_FLASH_TOOLS
|
||||||
|
#define USE_FLASHFS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif // USE_FLASH
|
||||||
|
|
||||||
#ifndef USE_FLASH_CHIP
|
#ifndef USE_FLASH_CHIP
|
||||||
|
#undef USE_FLASH_TOOLS
|
||||||
#undef USE_FLASHFS
|
#undef USE_FLASHFS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,6 @@
|
||||||
|
|
||||||
#define TARGET_BOARD_IDENTIFIER "TEST"
|
#define TARGET_BOARD_IDENTIFIER "TEST"
|
||||||
|
|
||||||
#define DEFAULT_BLACKBOX_DEVICE BLACKBOX_DEVICE_SERIAL
|
|
||||||
|
|
||||||
#define LED_STRIP_TIMER 1
|
#define LED_STRIP_TIMER 1
|
||||||
#define SOFTSERIAL_1_TIMER 2
|
#define SOFTSERIAL_1_TIMER 2
|
||||||
#define SOFTSERIAL_2_TIMER 3
|
#define SOFTSERIAL_2_TIMER 3
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue