mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 18:41:36 +08:00
Fix up power consumption estimation
This commit is contained in:
@@ -120,7 +120,7 @@ Battery::sumDischarged(hrt_abstime timestamp, float current_a)
|
|||||||
|
|
||||||
// Ignore first update because we don't know dT.
|
// Ignore first update because we don't know dT.
|
||||||
if (_last_timestamp != 0) {
|
if (_last_timestamp != 0) {
|
||||||
_discharged_mah = current_a * (timestamp - _last_timestamp) * 1.0e-3f / 3600.0f;
|
_discharged_mah += current_a * ((float)(timestamp - _last_timestamp)) / 1e3f / 3600.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
_last_timestamp = timestamp;
|
_last_timestamp = timestamp;
|
||||||
|
|||||||
Reference in New Issue
Block a user