From c48feefe232ec871435ef07aea270a2c6d540db8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 25 Nov 2023 08:24:39 +1100 Subject: [PATCH] AP_BattMonitor: fixed battery percentage with aux info 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 --- libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp b/libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp index 281831f0d1..123287c89a 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor_DroneCAN.cpp @@ -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