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
1 changed files with 4 additions and 2 deletions

View File

@ -256,8 +256,10 @@ bool GCS_MAVLINK::send_battery_status() const
const AP_BattMonitor &battery = AP::battery();
for(uint8_t i = 0; i < battery.num_instances(); i++) {
CHECK_PAYLOAD_SIZE(BATTERY_STATUS);
send_battery_status(battery, 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;
}