From 7e631ba16cdfa64ddee058c7e1dd1a57efd8a2a4 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 19 Sep 2017 12:30:45 +1000 Subject: [PATCH] Plane: move handling of SET_GPS_GLOBAL_ORIGIN up --- ArduPlane/GCS_Mavlink.cpp | 21 +++++---------------- ArduPlane/GCS_Mavlink.h | 1 + 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/ArduPlane/GCS_Mavlink.cpp b/ArduPlane/GCS_Mavlink.cpp index d43a8bd228..eaf78c227e 100644 --- a/ArduPlane/GCS_Mavlink.cpp +++ b/ArduPlane/GCS_Mavlink.cpp @@ -895,22 +895,6 @@ void GCS_MAVLINK_Plane::handleMessage(mavlink_message_t* msg) { switch (msg->msgid) { - case MAVLINK_MSG_ID_SET_GPS_GLOBAL_ORIGIN: - { - mavlink_set_gps_global_origin_t packet; - mavlink_msg_set_gps_global_origin_decode(msg, &packet); - // sanity check location - if (!check_latlng(packet.latitude, packet.longitude)) { - break; - } - Location ekf_origin {}; - ekf_origin.lat = packet.latitude; - ekf_origin.lng = packet.longitude; - ekf_origin.alt = packet.altitude / 10; - plane.set_ekf_origin(ekf_origin); - break; - } - case MAVLINK_MSG_ID_REQUEST_DATA_STREAM: { handle_request_data_stream(msg, true); @@ -1955,3 +1939,8 @@ const AP_FWVersion &GCS_MAVLINK_Plane::get_fwver() const { return plane.fwver; } + +void GCS_MAVLINK_Plane::set_ekf_origin(const Location& loc) +{ + plane.set_ekf_origin(loc); +} diff --git a/ArduPlane/GCS_Mavlink.h b/ArduPlane/GCS_Mavlink.h index da1b47deef..998435e795 100644 --- a/ArduPlane/GCS_Mavlink.h +++ b/ArduPlane/GCS_Mavlink.h @@ -28,6 +28,7 @@ protected: AP_Rally *get_rally() const override; AP_GPS *get_gps() const override; const AP_FWVersion &get_fwver() const override; + void set_ekf_origin(const Location& loc) override; uint8_t sysid_my_gcs() const override;