mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 14:38:30 -04:00
AP_Battery: fixed bug in SUI driver
fixed bug in total voltage
This commit is contained in:
parent
d96c7049ca
commit
ff112a726b
@ -139,10 +139,11 @@ void AP_BattMonitor_SMBus_SUI::read_cell_voltages()
|
||||
pack_voltage_mv = total_mv;
|
||||
} else {
|
||||
// we can't get total pack voltage. Use average of cells we have so far
|
||||
const uint16_t cell_mv = pack_voltage_mv / SUI_MAX_CELL_READ;
|
||||
for (uint8_t i = SUI_MAX_CELL_READ; i < cell_count; i++) {
|
||||
_state.cell_voltages.cells[i] = pack_voltage_mv / SUI_MAX_CELL_READ;
|
||||
pack_voltage_mv += _state.cell_voltages.cells[i];
|
||||
_state.cell_voltages.cells[i] = cell_mv;
|
||||
}
|
||||
pack_voltage_mv += cell_mv * (cell_count - SUI_MAX_CELL_READ);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user