Fix battery unittest

New code uses divition to get cell count, so nonzero vbatmaxcellvoltage is neccessary. Also added remaining fields to avoid future problems (and g++ doesn't support non-trivial initializers)
This commit is contained in:
Petr Ledvina 2015-01-30 12:35:01 +01:00
parent 3abcbace72
commit 737fbe02ed
1 changed files with 11 additions and 1 deletions

View File

@ -37,7 +37,17 @@ TEST(BatteryTest, BatteryADCToVoltage)
{
// given
batteryConfig_t batteryConfig;
batteryConfig_t batteryConfig = {
.vbatscale = 110,
.vbatmaxcellvoltage = 43,
.vbatmincellvoltage = 33,
.vbatwarningcellvoltage = 35,
.currentMeterScale = 400,
.currentMeterOffset = 0,
.currentMeterType = CURRENT_SENSOR_NONE,
.multiwiiCurrentMeterOutput = 0,
.batteryCapacity = 2200,
};
// batteryInit() reads a bunch of fields including vbatscale, so set up the config with useful initial values:
memset(&batteryConfig, 0, sizeof(batteryConfig));