Copter: move handling of SET_GPS_GLOBAL_ORIGIN up

This commit is contained in:
Peter Barker 2017-09-19 12:36:05 +10:00 committed by Randy Mackay
parent 7e631ba16c
commit 0afe1e7473
2 changed files with 7 additions and 16 deletions

View File

@ -742,22 +742,6 @@ void GCS_MAVLINK_Copter::handleMessage(mavlink_message_t* msg)
break;
}
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;
copter.set_ekf_origin(ekf_origin);
break;
}
case MAVLINK_MSG_ID_REQUEST_DATA_STREAM: // MAV ID: 66
{
handle_request_data_stream(msg, false);
@ -1767,3 +1751,9 @@ const AP_FWVersion &GCS_MAVLINK_Copter::get_fwver() const
{
return copter.fwver;
}
void GCS_MAVLINK_Copter::set_ekf_origin(const Location& loc)
{
copter.set_ekf_origin(loc);
}

View File

@ -27,6 +27,7 @@ protected:
MAV_RESULT handle_flight_termination(const mavlink_command_long_t &packet) override;
AP_AdvancedFailsafe *get_advanced_failsafe() const override;
const AP_FWVersion &get_fwver() const override;
void set_ekf_origin(const Location& loc) override;
uint8_t sysid_my_gcs() const override;