Skip to content

Commit

Permalink
battery: only compensate using sane current
Browse files Browse the repository at this point in the history
  • Loading branch information
MaEtUgR committed May 23, 2022
1 parent 2cbdcc9 commit 62edcc7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/battery/battery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void Battery::estimateStateOfCharge(const float voltage_v, const float current_a
float cell_voltage = voltage_v / _params.n_cells;

// correct battery voltage locally for load drop to avoid estimation fluctuations
if (_params.r_internal >= 0.f) {
if (_params.r_internal >= 0.f && current_a > FLT_EPSILON) {
cell_voltage += _params.r_internal * current_a;

} else {
Expand Down

0 comments on commit 62edcc7

Please sign in to comment.