diff --git a/ArduCopter/commands.cpp b/ArduCopter/commands.cpp index 8b89d639c8..3dd838cad2 100644 --- a/ArduCopter/commands.cpp +++ b/ArduCopter/commands.cpp @@ -72,15 +72,16 @@ bool Copter::set_home(const Location& loc, bool lock) return false; } + const bool home_was_set = ahrs.home_is_set(); + // set ahrs home (used for RTL) ahrs.set_home(loc); // init inav and compass declination - if (!ahrs.home_is_set()) { + if (!home_was_set) { // update navigation scalers. used to offset the shrinking longitude as we go towards the poles scaleLongDown = longitude_scale(loc); // record home is set - ahrs.set_home_status(HOME_SET_NOT_LOCKED); Log_Write_Event(DATA_SET_HOME); #if MODE_AUTO_ENABLED == ENABLED @@ -96,7 +97,7 @@ bool Copter::set_home(const Location& loc, bool lock) // lock home position if (lock) { - ahrs.set_home_status(HOME_SET_AND_LOCKED); + ahrs.lock_home(); } // log ahrs home and ekf origin dataflash diff --git a/ArduCopter/motors.cpp b/ArduCopter/motors.cpp index 66cb07c073..985e229af6 100644 --- a/ArduCopter/motors.cpp +++ b/ArduCopter/motors.cpp @@ -180,7 +180,7 @@ bool Copter::init_arm_motors(bool arming_from_gcs) // we have reset height, so arming height is zero arming_altitude_m = 0; - } else if (ahrs.home_status() == HOME_SET_NOT_LOCKED) { + } else if (!ahrs.home_is_locked()) { // Reset home position if it has already been set before (but not locked) set_home_to_current_location(false);