mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Remove custom defaults and enable features on boot (#13216)
* Remove custom defaults * Fixes per review * Fixes per review (thanks ledvinap) * Fix copy pasta
This commit is contained in:
parent
43c645a006
commit
65aaf732f9
5 changed files with 7 additions and 18 deletions
|
@ -280,7 +280,10 @@ static const char *mcuTypeNames[] = {
|
||||||
"AT32F435"
|
"AT32F435"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *configurationStates[] = { "UNCONFIGURED", "CUSTOM DEFAULTS", "CONFIGURED" };
|
static const char *configurationStates[] = {
|
||||||
|
[CONFIGURATION_STATE_UNCONFIGURED] = "UNCONFIGURED",
|
||||||
|
[CONFIGURATION_STATE_CONFIGURED] = "CONFIGURED"
|
||||||
|
};
|
||||||
|
|
||||||
typedef enum dumpFlags_e {
|
typedef enum dumpFlags_e {
|
||||||
DUMP_MASTER = (1 << 0),
|
DUMP_MASTER = (1 << 0),
|
||||||
|
|
|
@ -25,10 +25,8 @@
|
||||||
extern bool cliMode;
|
extern bool cliMode;
|
||||||
|
|
||||||
void cliProcess(void);
|
void cliProcess(void);
|
||||||
bool hasCustomDefaults(void);
|
|
||||||
struct serialPort_s;
|
struct serialPort_s;
|
||||||
void cliEnter(struct serialPort_s *serialPort);
|
void cliEnter(struct serialPort_s *serialPort);
|
||||||
bool resetConfigToCustomDefaults(void);
|
|
||||||
|
|
||||||
#ifdef USE_CLI_DEBUG_PRINT
|
#ifdef USE_CLI_DEBUG_PRINT
|
||||||
void cliPrint(const char *str);
|
void cliPrint(const char *str);
|
||||||
|
|
|
@ -125,7 +125,7 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
|
||||||
.powerOnArmingGraceTime = 5,
|
.powerOnArmingGraceTime = 5,
|
||||||
.boardIdentifier = TARGET_BOARD_IDENTIFIER,
|
.boardIdentifier = TARGET_BOARD_IDENTIFIER,
|
||||||
.hseMhz = SYSTEM_HSE_MHZ, // Only used for F4 and G4 targets
|
.hseMhz = SYSTEM_HSE_MHZ, // Only used for F4 and G4 targets
|
||||||
.configurationState = CONFIGURATION_STATE_DEFAULTS_BARE,
|
.configurationState = CONFIGURATION_STATE_UNCONFIGURED,
|
||||||
.enableStickArming = false,
|
.enableStickArming = false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -475,10 +475,7 @@ static void validateAndFixConfig(void)
|
||||||
featureDisableImmediate(FEATURE_RSSI_ADC);
|
featureDisableImmediate(FEATURE_RSSI_ADC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable features in Cloud Build
|
if (systemConfig()->configurationState == CONFIGURATION_STATE_UNCONFIGURED) {
|
||||||
#ifdef CLOUD_BUILD
|
|
||||||
|
|
||||||
if (systemConfig()->configurationState == CONFIGURATION_STATE_DEFAULTS_BARE) {
|
|
||||||
|
|
||||||
#ifdef USE_DASHBOARD
|
#ifdef USE_DASHBOARD
|
||||||
featureEnableImmediate(FEATURE_DASHBOARD);
|
featureEnableImmediate(FEATURE_DASHBOARD);
|
||||||
|
@ -511,9 +508,6 @@ if (systemConfig()->configurationState == CONFIGURATION_STATE_DEFAULTS_BARE) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // CLOUD_BUILD
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(USE_BEEPER)
|
#if defined(USE_BEEPER)
|
||||||
#ifdef USE_TIMER
|
#ifdef USE_TIMER
|
||||||
if (beeperDevConfig()->frequency && !timerGetConfiguredByTag(beeperDevConfig()->ioTag)) {
|
if (beeperDevConfig()->frequency && !timerGetConfiguredByTag(beeperDevConfig()->ioTag)) {
|
||||||
|
|
|
@ -28,8 +28,7 @@
|
||||||
#define MAX_NAME_LENGTH 16u
|
#define MAX_NAME_LENGTH 16u
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CONFIGURATION_STATE_DEFAULTS_BARE = 0,
|
CONFIGURATION_STATE_UNCONFIGURED = 0,
|
||||||
CONFIGURATION_STATE_DEFAULTS_CUSTOM,
|
|
||||||
CONFIGURATION_STATE_CONFIGURED,
|
CONFIGURATION_STATE_CONFIGURED,
|
||||||
} configurationState_e;
|
} configurationState_e;
|
||||||
|
|
||||||
|
|
|
@ -655,10 +655,7 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
|
||||||
// Target capabilities (uint8)
|
// Target capabilities (uint8)
|
||||||
#define TARGET_HAS_VCP 0
|
#define TARGET_HAS_VCP 0
|
||||||
#define TARGET_HAS_SOFTSERIAL 1
|
#define TARGET_HAS_SOFTSERIAL 1
|
||||||
#define TARGET_IS_UNIFIED 2
|
|
||||||
#define TARGET_HAS_FLASH_BOOTLOADER 3
|
#define TARGET_HAS_FLASH_BOOTLOADER 3
|
||||||
#define TARGET_SUPPORTS_CUSTOM_DEFAULTS 4
|
|
||||||
#define TARGET_HAS_CUSTOM_DEFAULTS 5
|
|
||||||
#define TARGET_SUPPORTS_RX_BIND 6
|
#define TARGET_SUPPORTS_RX_BIND 6
|
||||||
|
|
||||||
uint8_t targetCapabilities = 0;
|
uint8_t targetCapabilities = 0;
|
||||||
|
@ -668,11 +665,9 @@ static bool mspCommonProcessOutCommand(int16_t cmdMSP, sbuf_t *dst, mspPostProce
|
||||||
#if defined(USE_SOFTSERIAL)
|
#if defined(USE_SOFTSERIAL)
|
||||||
targetCapabilities |= BIT(TARGET_HAS_SOFTSERIAL);
|
targetCapabilities |= BIT(TARGET_HAS_SOFTSERIAL);
|
||||||
#endif
|
#endif
|
||||||
targetCapabilities |= BIT(TARGET_IS_UNIFIED);
|
|
||||||
#if defined(USE_FLASH_BOOT_LOADER)
|
#if defined(USE_FLASH_BOOT_LOADER)
|
||||||
targetCapabilities |= BIT(TARGET_HAS_FLASH_BOOTLOADER);
|
targetCapabilities |= BIT(TARGET_HAS_FLASH_BOOTLOADER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_RX_BIND)
|
#if defined(USE_RX_BIND)
|
||||||
if (getRxBindSupported()) {
|
if (getRxBindSupported()) {
|
||||||
targetCapabilities |= BIT(TARGET_SUPPORTS_RX_BIND);
|
targetCapabilities |= BIT(TARGET_SUPPORTS_RX_BIND);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue