GCS_MAVLink: Don't send BATTERY_STATUS for empty instances

This commit is contained in:
Michael du Breuil 2019-03-10 00:07:37 -07:00 committed by Francisco Ferreira
parent d96aad86a5
commit f7b34677df

View File

@ -256,9 +256,11 @@ bool GCS_MAVLINK::send_battery_status() const
const AP_BattMonitor &battery = AP::battery();
for(uint8_t i = 0; i < battery.num_instances(); i++) {
if (battery.get_type(i) != AP_BattMonitor_Params::BattMonitor_Type::BattMonitor_TYPE_NONE) {
CHECK_PAYLOAD_SIZE(BATTERY_STATUS);
send_battery_status(battery, i);
}
}
return true;
}