diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 1223191657..cc46bed8b9 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -303,6 +303,7 @@ protected: virtual MAV_RESULT handle_command_preflight_calibration(const mavlink_command_long_t &packet); virtual MAV_RESULT _handle_command_preflight_calibration(const mavlink_command_long_t &packet); + virtual MAV_RESULT _handle_command_preflight_calibration_baro(); MAV_RESULT handle_command_mag_cal(const mavlink_command_long_t &packet); MAV_RESULT handle_command_long_message(mavlink_command_long_t &packet); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 58a9e2c037..523ae8dd72 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -2229,6 +2229,16 @@ bool GCS_MAVLINK::calibrate_gyros() return true; } +MAV_RESULT GCS_MAVLINK::_handle_command_preflight_calibration_baro() +{ + // fast barometer calibration + gcs().send_text(MAV_SEVERITY_INFO, "Updating barometer calibration"); + AP::baro().update_calibration(); + gcs().send_text(MAV_SEVERITY_INFO, "Barometer calibration complete"); + + return MAV_RESULT_ACCEPTED; +} + MAV_RESULT GCS_MAVLINK::_handle_command_preflight_calibration(const mavlink_command_long_t &packet) { if (is_equal(packet.param1,1.0f)) { @@ -2238,6 +2248,10 @@ MAV_RESULT GCS_MAVLINK::_handle_command_preflight_calibration(const mavlink_comm return MAV_RESULT_ACCEPTED; } + if (is_equal(packet.param3,1.0f)) { + return _handle_command_preflight_calibration_baro(); + } + if (is_equal(packet.param5,1.0f)) { // start with gyro calibration if (!calibrate_gyros()) {