From 2343472f50ef30b545c71a894fb3f4c7ccbb7734 Mon Sep 17 00:00:00 2001 From: George Zogopoulos Date: Fri, 14 Aug 2026 22:52:45 +0200 Subject: [PATCH] AP_BattMonitor: Keep mavlink_charge_state instanced Currently the method will report unhealthy in BATTERY_STATUS.charge_state for ALL batteries, if one battery is unhealthy. Fix it to refer to the current instance only. --- libraries/AP_BattMonitor/AP_BattMonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/AP_BattMonitor/AP_BattMonitor.cpp b/libraries/AP_BattMonitor/AP_BattMonitor.cpp index 61554c8d417..b7bf891c38a 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor.cpp @@ -1202,7 +1202,7 @@ MAV_BATTERY_CHARGE_STATE AP_BattMonitor::get_mavlink_charge_state(const uint8_t case Failsafe::None: case Failsafe::Unhealthy: - if (get_mavlink_fault_bitmask(instance) != 0 || !healthy()) { + if (get_mavlink_fault_bitmask(instance) != 0 || !healthy(instance)) { return MAV_BATTERY_CHARGE_STATE_UNHEALTHY; } return MAV_BATTERY_CHARGE_STATE_OK;