Skip to content

Commit

Permalink
GCS_MAVLink: report battery soh
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Jan 8, 2024
1 parent 895012f commit 0a6fab4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 0a6fab4

Please sign in to comment.