Skip to content

Commit bbd2b76

Browse files
committed
Fix battery charge level filter
1 parent 6c61b67 commit bbd2b76

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/modules/systemlib/battery.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ Battery::estimateRemaining(float voltage_v, float throttle_normalized)
146146
// remaining battery capacity based on voltage
147147
const float rvoltage = (voltage_v - (_param_n_cells.get() * bat_v_empty_dynamic))
148148
/ (_param_n_cells.get() * voltage_range);
149-
const float rvoltage_filt = rvoltage * 0.997f + _remaining_voltage * 0.003f;
149+
const float rvoltage_filt = _remaining_voltage * 0.99f + rvoltage * 0.01f;
150150

151151
if (PX4_ISFINITE(rvoltage_filt)) {
152152
_remaining_voltage = rvoltage_filt;
153153
}
154154

155155
// remaining battery capacity based on used current integrated time
156156
const float rcap = 1.0f - _discharged_mah / _param_capacity.get();
157-
const float rcap_filt = rcap * 0.99f + _remaining_capacity * 0.01f;
157+
const float rcap_filt = _remaining_capacity * 0.99f + rcap * 0.01f;
158158

159159
if (PX4_ISFINITE(rcap_filt)) {
160160
_remaining_capacity = rcap_filt;

0 commit comments

Comments
 (0)