Copter: use const reference when retrieving wpnav destination

This commit is contained in:
Randy Mackay 2019-11-11 20:33:14 +09:00
parent 7ed3efd377
commit d6c913cc50
3 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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);