AP_Airspeed: use send_to_active_channels for airspeed_autocal

This commit is contained in:
Peter Barker 2019-06-27 09:47:38 +10:00 committed by Peter Barker
parent 6442dd1f2f
commit 04ebb9de0b

View File

@ -165,27 +165,20 @@ void AP_Airspeed::update_calibration(const Vector3f &vground, int16_t max_airspe
void AP_Airspeed::send_airspeed_calibration(const Vector3f &vground) void AP_Airspeed::send_airspeed_calibration(const Vector3f &vground)
{ {
for (uint8_t i=0; i<gcs().num_gcs(); i++) { const mavlink_airspeed_autocal_t packet{
if (!gcs().chan(i).initialised) { vground.x,
continue; vground.y,
} vground.z,
const mavlink_channel_t chan = (mavlink_channel_t)i; get_differential_pressure(primary),
if (!HAVE_PAYLOAD_SPACE(chan, AIRSPEED_AUTOCAL)) { AP::baro().get_EAS2TAS(),
continue; param[primary].ratio.get(),
} state[primary].calibration.state.x,
mavlink_msg_airspeed_autocal_send( state[primary].calibration.state.y,
chan, state[primary].calibration.state.z,
vground.x, state[primary].calibration.P.a.x,
vground.y, state[primary].calibration.P.b.y,
vground.z, state[primary].calibration.P.c.z
get_differential_pressure(primary), };
AP::baro().get_EAS2TAS(), gcs().send_to_active_channels(MAVLINK_MSG_ID_AIRSPEED_AUTOCAL,
param[primary].ratio.get(), (const char *)&packet);
state[primary].calibration.state.x,
state[primary].calibration.state.y,
state[primary].calibration.state.z,
state[primary].calibration.P.a.x,
state[primary].calibration.P.b.y,
state[primary].calibration.P.c.z);
}
} }