Ensure battery cell detection happens after everything has powered up.
Previously, on the OLIMEXINO at least, initial readings are lower than normal readings and that meant that the battery warning voltage was incorrectly set.
This commit is contained in:
parent
a8874dc499
commit
bb356057fc
|
@ -127,10 +127,6 @@ void init(void)
|
|||
|
||||
adcInit(&adc_params);
|
||||
|
||||
// Check battery type/voltage
|
||||
if (feature(FEATURE_VBAT))
|
||||
batteryInit(&masterConfig.batteryConfig);
|
||||
|
||||
initBoardAlignment(&masterConfig.boardAlignment);
|
||||
|
||||
// We have these sensors; SENSORS_SET defined in board.h depending on hardware platform
|
||||
|
@ -242,6 +238,12 @@ void init(void)
|
|||
}
|
||||
serialPrint(loopbackPort, "LOOPBACK\r\n");
|
||||
#endif
|
||||
|
||||
// Now that everything has powered up the voltage and cell count be determined.
|
||||
|
||||
// Check battery type/voltage
|
||||
if (feature(FEATURE_VBAT))
|
||||
batteryInit(&masterConfig.batteryConfig);
|
||||
}
|
||||
|
||||
#ifdef SOFTSERIAL_LOOPBACK
|
||||
|
|
|
@ -83,7 +83,7 @@ void batteryInit(batteryConfig_t *initialBatteryConfig)
|
|||
}
|
||||
|
||||
batteryCellCount = i;
|
||||
batteryWarningVoltage = i * batteryConfig->vbatmincellvoltage; // 3.3V per cell minimum, configurable in CLI
|
||||
batteryWarningVoltage = batteryCellCount * batteryConfig->vbatmincellvoltage; // 3.3V per cell minimum, configurable in CLI
|
||||
}
|
||||
|
||||
#define ADCVREF 33L
|
||||
|
|
Loading…
Reference in New Issue