Skip to content

Commit

Permalink
GCS_MAVLink: send battery soh as named value
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Jan 12, 2024
1 parent 06de7f9 commit f3ba164
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libraries/GCS_MAVLink/GCS_Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ void GCS_MAVLINK::send_battery_status(const uint8_t instance) const
cell_mvolts_ext, // Cell 11..14 voltages
0, // battery mode
battery.get_mavlink_fault_bitmask(instance)); // fault_bitmask

// send state of health percentage if available
uint8_t batt_soh_pct;
if (battery.get_state_of_health_pct(instance, batt_soh_pct)) {
char name[12];
snprintf(name, sizeof(name), "BATT%u_SOH", instance);
send_named_float(name, batt_soh_pct);
}
#else
(void)instance;
#endif
Expand Down

0 comments on commit f3ba164

Please sign in to comment.