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 10, 2024
1 parent 58a2274 commit a2a890a
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 @@ -361,6 +361,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);
}
}

// returns true if all battery instances were reported
Expand Down

0 comments on commit a2a890a

Please sign in to comment.