Skip to content

Commit

Permalink
AP_BattMonitor: fixed battery percentage with aux info
Browse files Browse the repository at this point in the history
when we have aux battery information we had assumed the CAN device
would provide the battery remaining percentage. We should obey the "do
not use CAN SoC" with or without an AUX message

This fixes CAN battery monitors with a cell monitor
  • Loading branch information
tridge committed Nov 27, 2023
1 parent 73eb3b0 commit c48feef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ void AP_BattMonitor_DroneCAN::update_interim_state(const float voltage, const fl

const uint32_t tnow = AP_HAL::micros();

if (!_has_battery_info_aux || _mppt.is_detected) {
if (!_has_battery_info_aux ||
!use_CAN_SoC()) {
const uint32_t dt_us = tnow - _interim_state.last_time_micros;

// update total current drawn since startup
Expand Down

0 comments on commit c48feef

Please sign in to comment.