|
|
|
@ -91,6 +91,7 @@ Battery::updateBatteryStatus(hrt_abstime timestamp, float voltage_v, float curre
@@ -91,6 +91,7 @@ Battery::updateBatteryStatus(hrt_abstime timestamp, float voltage_v, float curre
|
|
|
|
|
battery_status->discharged_mah = _discharged_mah; |
|
|
|
|
battery_status->cell_count = _param_n_cells.get(); |
|
|
|
|
battery_status->warning = _warning; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
reset(battery_status); |
|
|
|
|
} |
|
|
|
@ -101,6 +102,7 @@ Battery::filterVoltage(float voltage_v)
@@ -101,6 +102,7 @@ Battery::filterVoltage(float voltage_v)
|
|
|
|
|
{ |
|
|
|
|
// TODO: inspect that filter performance
|
|
|
|
|
const float filtered_next = _voltage_filtered_v * 0.999f + voltage_v * 0.001f; |
|
|
|
|
|
|
|
|
|
if (PX4_ISFINITE(filtered_next)) { |
|
|
|
|
_voltage_filtered_v = filtered_next; |
|
|
|
|
} |
|
|
|
@ -113,6 +115,7 @@ Battery::sumDischarged(hrt_abstime timestamp, float current_a)
@@ -113,6 +115,7 @@ Battery::sumDischarged(hrt_abstime timestamp, float current_a)
|
|
|
|
|
if (_last_timestamp != 0) { |
|
|
|
|
_discharged_mah = current_a * (timestamp - _last_timestamp) * 1.0e-3f / 3600.0f; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
_last_timestamp = timestamp; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|