GCS_MAVLink: Provide the time remaining

This commit is contained in:
李孟晓 2021-10-11 07:25:35 +00:00 committed by Andrew Tridgell
parent bf1a17825c
commit 54b68ffae3
1 changed files with 5 additions and 1 deletions

View File

@ -280,6 +280,10 @@ void GCS_MAVLINK::send_battery_status(const uint8_t instance) const
} else {
consumed_wh = -1;
}
uint32_t time_remaining;
if (!battery.time_remaining(time_remaining, instance)) {
time_remaining = 0;
}
mavlink_msg_battery_status_send(chan,
instance, // id
@ -291,7 +295,7 @@ void GCS_MAVLINK::send_battery_status(const uint8_t instance) const
consumed_mah, // total consumed current in milliampere.hour
consumed_wh, // consumed energy in hJ (hecto-Joules)
percentage,
0, // time remaining, seconds (not provided)
time_remaining, // time remaining, seconds
battery.get_mavlink_charge_state(instance), // battery charge state
cell_volts_ext, // Cell 11..14 voltages
0, // battery mode