mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 09:45:37 +03:00
Speed up the first boot on generic firmware
This commit is contained in:
parent
c9788f1831
commit
feab0bcb81
4 changed files with 37 additions and 7 deletions
|
@ -87,6 +87,7 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
|
|||
.powerOnArmingGraceTime = 5,
|
||||
.boardIdentifier = TARGET_BOARD_IDENTIFIER,
|
||||
.hseMhz = SYSTEM_HSE_VALUE, // Not used for non-F4 targets
|
||||
.configured = false,
|
||||
);
|
||||
|
||||
uint8_t getCurrentPidProfileIndex(void)
|
||||
|
@ -527,30 +528,43 @@ bool readEEPROM(void)
|
|||
return success;
|
||||
}
|
||||
|
||||
void writeEEPROM(void)
|
||||
static void ValidateAndWriteConfigToEEPROM(bool setConfigured)
|
||||
{
|
||||
validateAndFixConfig();
|
||||
|
||||
suspendRxPwmPpmSignal();
|
||||
|
||||
#ifdef USE_CONFIGURATION_STATE
|
||||
if (setConfigured) {
|
||||
systemConfigMutable()->configured = true;
|
||||
}
|
||||
#else
|
||||
UNUSED(setConfigured);
|
||||
#endif
|
||||
|
||||
writeConfigToEEPROM();
|
||||
|
||||
resumeRxPwmPpmSignal();
|
||||
}
|
||||
|
||||
void writeEEPROM(void)
|
||||
{
|
||||
ValidateAndWriteConfigToEEPROM(true);
|
||||
}
|
||||
|
||||
void writeEEPROMWithFeatures(uint32_t features)
|
||||
{
|
||||
featureDisableAll();
|
||||
featureEnable(features);
|
||||
|
||||
writeEEPROM();
|
||||
ValidateAndWriteConfigToEEPROM(true);
|
||||
}
|
||||
|
||||
void resetEEPROM(void)
|
||||
{
|
||||
resetConfigs();
|
||||
|
||||
writeEEPROM();
|
||||
ValidateAndWriteConfigToEEPROM(false);
|
||||
|
||||
activateConfig();
|
||||
}
|
||||
|
@ -565,7 +579,7 @@ void ensureEEPROMStructureIsValid(void)
|
|||
|
||||
void saveConfigAndNotify(void)
|
||||
{
|
||||
writeEEPROM();
|
||||
ValidateAndWriteConfigToEEPROM(true);
|
||||
readEEPROM();
|
||||
beeperConfirmationBeeps(1);
|
||||
}
|
||||
|
@ -581,3 +595,12 @@ void changePidProfile(uint8_t pidProfileIndex)
|
|||
|
||||
beeperConfirmationBeeps(pidProfileIndex + 1);
|
||||
}
|
||||
|
||||
bool isSystemConfigured(void)
|
||||
{
|
||||
#ifdef USE_CONFIGURATION_STATE
|
||||
return systemConfig()->configured;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue