From 3073ea4853bc671c189b21187302ab5222c33ada Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 9 Apr 2024 19:36:47 +1000 Subject: [PATCH] Rover: provide and use base class set_home_from_current_location --- Rover/commands.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Rover/commands.cpp b/Rover/commands.cpp index d43ebbe3da8a9..7e9410c4df578 100644 --- a/Rover/commands.cpp +++ b/Rover/commands.cpp @@ -3,16 +3,14 @@ // set ahrs home to current location from inertial-nav location bool Rover::set_home_to_current_location(bool lock) { - Location temp_loc; - if (ahrs.have_inertial_nav() && ahrs.get_location(temp_loc)) { - if (!set_home(temp_loc, lock)) { - return false; - } - // we have successfully set AHRS home, set it for SmartRTL - g2.smart_rtl.set_home(true); - return true; + if (!AP_Vehicle::set_home_to_current_location(lock)) { + return false; } - return false; + + // we have successfully set AHRS home, set it for SmartRTL + g2.smart_rtl.set_home(true); + + return true; } // sets ahrs home to specified location