Skip to content

Commit

Permalink
ArduCopter: provide and use base class set_home_from_current_location
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Apr 10, 2024
1 parent 6a3d78e commit 868ef5e
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions ArduCopter/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@ void Copter::set_home_to_current_location_inflight() {
}

// set_home_to_current_location - set home to current GPS location
bool Copter::set_home_to_current_location(bool lock) {
// get current location from EKF
Location temp_loc;
if (ahrs.get_location(temp_loc)) {
if (!set_home(temp_loc, lock)) {
return false;
}
// we have successfully set AHRS home, set it for SmartRTL
bool Copter::set_home_to_current_location(bool lock)
{
if (!AP_Vehicle::set_home_to_current_location(lock)) {
return false;
}

// we have successfully set AHRS home, set it for SmartRTL
#if MODE_SMARTRTL_ENABLED == ENABLED
g2.smart_rtl.set_home(true);
g2.smart_rtl.set_home(true);
#endif
return true;
}
return false;

return true;
}

0 comments on commit 868ef5e

Please sign in to comment.