mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
battery: skip charge estimation if N cells is 0
This triggers the undefined behaviour fuzzer, so let's try to fix it. Signed-off-by: Julian Oes <julian@oes.ch>
This commit is contained in:
parent
44d1003f8e
commit
84577ce2c2
@ -206,6 +206,10 @@ void Battery::sumDischarged(const hrt_abstime ×tamp, float current_a)
|
||||
|
||||
float Battery::calculateStateOfChargeVoltageBased(const float voltage_v, const float current_a)
|
||||
{
|
||||
if (_params.n_cells == 0) {
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
// remaining battery capacity based on voltage
|
||||
float cell_voltage = voltage_v / _params.n_cells;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user