From 0a6fab4d018d0c57420328924b38abb03e95d31b Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 8 Jan 2024 09:54:00 +0900 Subject: [PATCH] GCS_MAVLink: report battery soh --- libraries/GCS_MAVLink/GCS_Common.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 9981cb5e594368..672f428434be60 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -346,6 +346,10 @@ void GCS_MAVLINK::send_battery_status(const uint8_t instance) const time_remaining = 0; } + uint8_t state_of_health_pct; + if (!battery.get_state_of_health_pct(instance, state_of_health_pct)) { + state_of_health_pct = 0; + } mavlink_msg_battery_status_send(chan, instance, // id MAV_BATTERY_FUNCTION_UNKNOWN, // function @@ -360,7 +364,8 @@ void GCS_MAVLINK::send_battery_status(const uint8_t instance) const battery.get_mavlink_charge_state(instance), // battery charge state cell_mvolts_ext, // Cell 11..14 voltages 0, // battery mode - battery.get_mavlink_fault_bitmask(instance)); // fault_bitmask + battery.get_mavlink_fault_bitmask(instance), // fault_bitmask + state_of_health_pct); // state of health } // returns true if all battery instances were reported