mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
battery: check source param inside battery lib
This moves the handling of the BAT%d_SOURCE param inside of the battery library. Users of the library now pass the source instead of the flag whether to publish. The battery library then checks if the source is selected using the param and publishes accordingly. Since we removed the strange system_source flag, we now need to look at all batteries in commander. For current estimation - I think - it makes sense to sum them up.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Copyright (c) 2015 Mark Charlebois. All rights reserved.
|
||||
* Copyright (c) 2016 Anton Matosov. All rights reserved.
|
||||
* Copyright (c) 2017-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2017-2020 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -366,7 +366,8 @@ 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, true);
|
||||
_battery.updateBatteryStatus(now_us, vbatt, ibatt, true, battery_status_s::BATTERY_SOURCE_POWER_MODULE,
|
||||
0, throttle);
|
||||
|
||||
_last_battery_timestamp = now_us;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user