From 8346203d4356bd857b60c0b0e2df2f82bde33a94 Mon Sep 17 00:00:00 2001 From: TsuyoshiKawamura Date: Tue, 23 Jan 2024 15:41:32 +0900 Subject: [PATCH] Copter: simplify update_target_location --- ArduCopter/Copter.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/ArduCopter/Copter.cpp b/ArduCopter/Copter.cpp index d8e1b684a7..2ff3fea190 100644 --- a/ArduCopter/Copter.cpp +++ b/ArduCopter/Copter.cpp @@ -457,15 +457,11 @@ bool Copter::get_target_location(Location& target_loc) */ bool Copter::update_target_location(const Location &old_loc, const Location &new_loc) { - Location next_WP_loc; - flightmode->get_wp(next_WP_loc); - if (!old_loc.same_loc_as(next_WP_loc)) { - return false; - } - next_WP_loc = new_loc; - next_WP_loc.change_alt_frame(old_loc.get_alt_frame()); + Location next_wp_loc; + next_wp_loc = new_loc; + next_wp_loc.change_alt_frame(old_loc.get_alt_frame()); - return set_target_location(next_WP_loc); + return set_target_location(next_wp_loc); } #endif // AP_SCRIPTING_ENABLED