mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 19:30:36 +08:00
Refactored battery library for multiple instances
This commit is contained in:
committed by
Julian Oes
parent
d7b95870b9
commit
bff1df7080
@@ -239,7 +239,7 @@ private:
|
||||
hrt_abstime _last_sitl_timestamp{0};
|
||||
|
||||
// Lib used to do the battery calculations.
|
||||
Battery _battery {};
|
||||
Battery1 _battery {};
|
||||
battery_status_s _battery_status{};
|
||||
|
||||
#ifndef __PX4_QURT
|
||||
|
||||
@@ -370,10 +370,7 @@ void Simulator::handle_message_hil_sensor(const mavlink_message_t *msg)
|
||||
vbatt *= _battery.cell_count();
|
||||
|
||||
const float throttle = 0.0f; // simulate no throttle compensation to make the estimate predictable
|
||||
_battery.updateBatteryStatus(now_us, vbatt, ibatt, true, true, 0, throttle, armed, &_battery_status);
|
||||
|
||||
// publish the battery voltage
|
||||
_battery_pub.publish(_battery_status);
|
||||
_battery.updateBatteryStatus(vbatt, ibatt, now_us, true, 0, throttle, armed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user