diff --git a/ArduCopter/mode_auto.cpp b/ArduCopter/mode_auto.cpp index 45d382aa49..d10c0106ec 100644 --- a/ArduCopter/mode_auto.cpp +++ b/ArduCopter/mode_auto.cpp @@ -1524,7 +1524,7 @@ bool ModeAuto::verify_land() // check if we've reached the location if (copter.wp_nav->reached_wp_destination()) { // get destination so we can use it for loiter target - Vector3f dest = copter.wp_nav->get_wp_destination(); + const Vector3f& dest = copter.wp_nav->get_wp_destination(); // initialise landing controller land_start(dest); diff --git a/ArduCopter/mode_guided.cpp b/ArduCopter/mode_guided.cpp index e9ce6180c9..1b5fc8a0c7 100644 --- a/ArduCopter/mode_guided.cpp +++ b/ArduCopter/mode_guided.cpp @@ -370,7 +370,7 @@ void ModeGuided::takeoff_run() { auto_takeoff_run(); if (wp_nav->reached_wp_destination()) { - const Vector3f target = wp_nav->get_wp_destination(); + const Vector3f& target = wp_nav->get_wp_destination(); set_destination(target); } } diff --git a/ArduCopter/mode_zigzag.cpp b/ArduCopter/mode_zigzag.cpp index ea0a8f0f65..6e5c7c464c 100644 --- a/ArduCopter/mode_zigzag.cpp +++ b/ArduCopter/mode_zigzag.cpp @@ -123,7 +123,7 @@ void ModeZigZag::return_to_manual_control(bool maintain_target) stage = MANUAL_REGAIN; loiter_nav->clear_pilot_desired_acceleration(); if (maintain_target) { - const Vector3f wp_dest = wp_nav->get_wp_destination(); + const Vector3f& wp_dest = wp_nav->get_wp_destination(); loiter_nav->init_target(wp_dest); if (wp_nav->origin_and_destination_are_terrain_alt()) { copter.surface_tracking.set_target_alt_cm(wp_dest.z);