From 48e116afca93a006209efe0d64d7ec0b5705ab63 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 21 Nov 2019 14:54:07 +1100 Subject: [PATCH] GCS_MAVLink: support MAV_CMD_FIXED_MAG_CAL_YAW --- libraries/GCS_MAVLink/GCS.h | 2 ++ libraries/GCS_MAVLink/GCS_Common.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/libraries/GCS_MAVLink/GCS.h b/libraries/GCS_MAVLink/GCS.h index 8ff3b47458..265768bc91 100644 --- a/libraries/GCS_MAVLink/GCS.h +++ b/libraries/GCS_MAVLink/GCS.h @@ -417,6 +417,8 @@ protected: void handle_optical_flow(const mavlink_message_t &msg); + MAV_RESULT handle_fixed_mag_cal_yaw(const mavlink_command_long_t &packet); + // vehicle-overridable message send function virtual bool try_send_message(enum ap_message id); virtual void send_global_position_int(); diff --git a/libraries/GCS_MAVLink/GCS_Common.cpp b/libraries/GCS_MAVLink/GCS_Common.cpp index 4880852c90..9f729f9e9b 100644 --- a/libraries/GCS_MAVLink/GCS_Common.cpp +++ b/libraries/GCS_MAVLink/GCS_Common.cpp @@ -3012,6 +3012,19 @@ void GCS_MAVLINK::handle_optical_flow(const mavlink_message_t &msg) optflow->handle_msg(msg); } + +/* + handle MAV_CMD_FIXED_MAG_CAL_YAW + */ +MAV_RESULT GCS_MAVLINK::handle_fixed_mag_cal_yaw(const mavlink_command_long_t &packet) +{ + Compass &compass = AP::compass(); + return compass.mag_cal_fixed_yaw(packet.param1, + uint8_t(packet.param2), + packet.param3, + packet.param4); +} + /* handle messages which don't require vehicle specific data */ @@ -3731,6 +3744,10 @@ MAV_RESULT GCS_MAVLINK::handle_command_long_packet(const mavlink_command_long_t return MAV_RESULT_UNSUPPORTED; + case MAV_CMD_FIXED_MAG_CAL_YAW: + result = handle_fixed_mag_cal_yaw(packet); + break; + default: result = MAV_RESULT_UNSUPPORTED; break;