From 7775b519bbe68d1bbab85fddc57631df2765b3bc Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 3 Feb 2022 15:01:56 +1100 Subject: [PATCH] Blimp: create and use location_from_command_t --- Blimp/GCS_Mavlink.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Blimp/GCS_Mavlink.cpp b/Blimp/GCS_Mavlink.cpp index 693cabbb6e..30ae53ed83 100644 --- a/Blimp/GCS_Mavlink.cpp +++ b/Blimp/GCS_Mavlink.cpp @@ -450,19 +450,10 @@ MAV_RESULT GCS_MAVLINK_Blimp::handle_command_int_do_reposition(const mavlink_com } Location request_location {}; - request_location.lat = packet.x; - request_location.lng = packet.y; - - if (fabsf(packet.z) > LOCATION_ALT_MAX_M) { + if (!location_from_command_t(packet, request_location)) { return MAV_RESULT_DENIED; } - Location::AltFrame frame; - if (!mavlink_coordinate_frame_to_location_alt_frame((MAV_FRAME)packet.frame, frame)) { - return MAV_RESULT_DENIED; // failed as the location is not valid - } - request_location.set_alt_cm((int32_t)(packet.z * 100.0f), frame); - if (request_location.sanitize(blimp.current_loc)) { // if the location wasn't already sane don't load it return MAV_RESULT_DENIED; // failed as the location is not valid