Avoid reading uninitialised memory during battery unit tests
This commit is contained in:
parent
70fbeb22ba
commit
1bd091a031
|
@ -39,6 +39,14 @@ TEST(BatteryTest, BatteryADCToVoltage)
|
|||
|
||||
batteryConfig_t batteryConfig;
|
||||
|
||||
// batteryInit() reads a bunch of fields including vbatscale, so set up the config with useful initial values:
|
||||
memset(&batteryConfig, 0, sizeof(batteryConfig));
|
||||
|
||||
batteryConfig.vbatmaxcellvoltage = 43;
|
||||
batteryConfig.vbatmincellvoltage = 33;
|
||||
batteryConfig.vbatwarningcellvoltage = 35;
|
||||
batteryConfig.vbatscale = VBAT_SCALE_DEFAULT;
|
||||
|
||||
batteryInit(&batteryConfig);
|
||||
|
||||
batteryAdcToVoltageExpectation_t batteryAdcToVoltageExpectations[] = {
|
||||
|
|
Loading…
Reference in New Issue