1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +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:
Hydra 2017-03-12 11:26:30 +00:00 committed by Dominic Clifton
parent b46e0fe46d
commit 067d3c0ac2
69 changed files with 1178 additions and 514 deletions

View file

@ -377,9 +377,9 @@ void init(void)
#endif
#ifdef USE_ADC
/* these can be removed from features! */
adcConfigMutable()->vbat.enabled = feature(FEATURE_VBAT);
adcConfigMutable()->currentMeter.enabled = feature(FEATURE_CURRENT_METER);
adcConfigMutable()->vbat.enabled = (batteryConfig()->voltageMeterSource == VOLTAGE_METER_ADC);
adcConfigMutable()->currentMeter.enabled = (batteryConfig()->currentMeterSource == CURRENT_METER_ADC);
adcConfigMutable()->rssi.enabled = feature(FEATURE_RSSI_ADC);
adcInit(adcConfig());
#endif
@ -556,10 +556,7 @@ void init(void)
serialPrint(loopbackPort, "LOOPBACK\r\n");
#endif
// Now that everything has powered up the voltage and cell count be determined.
if (feature(FEATURE_VBAT | FEATURE_CURRENT_METER))
batteryInit();
batteryInit(); // always needs doing, regardless of features.
#ifdef USE_DASHBOARD
if (feature(FEATURE_DASHBOARD)) {