mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 15:25:36 +03:00
CF/BF - First cut of Current/Voltage/Battery cleanup.
many refactorings, bugs squished, concerns separated, single-responsibility violations fixed and performance optimizations.
This commit is contained in:
parent
b46e0fe46d
commit
067d3c0ac2
69 changed files with 1178 additions and 514 deletions
|
@ -113,7 +113,7 @@ pidProfile_t *currentPidProfile;
|
|||
PG_REGISTER_WITH_RESET_TEMPLATE(featureConfig_t, featureConfig, PG_FEATURE_CONFIG, 0);
|
||||
|
||||
PG_RESET_TEMPLATE(featureConfig_t, featureConfig,
|
||||
.enabledFeatures = DEFAULT_FEATURES | DEFAULT_RX_FEATURE | FEATURE_FAILSAFE
|
||||
.enabledFeatures = DEFAULT_FEATURES | DEFAULT_RX_FEATURE | FEATURE_FAILSAFE
|
||||
);
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(systemConfig_t, systemConfig, PG_SYSTEM_CONFIG, 0);
|
||||
|
@ -503,12 +503,6 @@ void createDefaultConfig(master_t *config)
|
|||
#endif
|
||||
#endif // USE_PARAMETER_GROUPS
|
||||
|
||||
#ifdef BOARD_HAS_VOLTAGE_DIVIDER
|
||||
// only enable the VBAT feature by default if the board has a voltage divider otherwise
|
||||
// the user may see incorrect readings and unexpected issues with pin mappings may occur.
|
||||
intFeatureSet(FEATURE_VBAT, featuresPtr);
|
||||
#endif
|
||||
|
||||
config->version = EEPROM_CONF_VERSION;
|
||||
|
||||
// global settings
|
||||
|
@ -873,8 +867,8 @@ void validateAndFixConfig(void)
|
|||
// rssi adc needs the same ports
|
||||
featureClear(FEATURE_RSSI_ADC);
|
||||
// current meter needs the same ports
|
||||
if (batteryConfig()->currentMeterType == CURRENT_SENSOR_ADC) {
|
||||
featureClear(FEATURE_CURRENT_METER);
|
||||
if (batteryConfig()->currentMeterSource == CURRENT_METER_ADC) {
|
||||
batteryConfigMutable()->currentMeterSource = CURRENT_METER_NONE;
|
||||
}
|
||||
#endif
|
||||
// software serial needs free PWM ports
|
||||
|
@ -883,14 +877,15 @@ void validateAndFixConfig(void)
|
|||
|
||||
#ifdef USE_SOFTSPI
|
||||
if (featureConfigured(FEATURE_SOFTSPI)) {
|
||||
featureClear(FEATURE_RX_PPM | FEATURE_RX_PARALLEL_PWM | FEATURE_SOFTSERIAL | FEATURE_VBAT);
|
||||
featureClear(FEATURE_RX_PPM | FEATURE_RX_PARALLEL_PWM | FEATURE_SOFTSERIAL);
|
||||
batteryConfigMutable()->voltageMeterSource = VOLTAGE_METER_NONE;
|
||||
#if defined(STM32F10X)
|
||||
featureClear(FEATURE_LED_STRIP);
|
||||
// rssi adc needs the same ports
|
||||
featureClear(FEATURE_RSSI_ADC);
|
||||
// current meter needs the same ports
|
||||
if (batteryConfig()->currentMeterType == CURRENT_SENSOR_ADC) {
|
||||
featureClear(FEATURE_CURRENT_METER);
|
||||
if (batteryConfig()->currentMeterSource == CURRENT_METER_ADC) {
|
||||
batteryConfigMutable()->currentMeterSource = CURRENT_METER_NONE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue