From 08124faab46c4006b82ad49fca7d9c05d048c4cc Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Mon, 25 Feb 2019 01:11:25 +0100 Subject: [PATCH] Copter: replace location_offset() and get_distance() function calls with Location object member function calls This allows removing duplicated code --- ArduCopter/commands.cpp | 2 +- ArduCopter/navigation.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ArduCopter/commands.cpp b/ArduCopter/commands.cpp index fdf0b27d89..28256d37d0 100644 --- a/ArduCopter/commands.cpp +++ b/ArduCopter/commands.cpp @@ -107,7 +107,7 @@ bool Copter::far_from_EKF_origin(const Location& loc) { // check distance to EKF origin const struct Location &ekf_origin = inertial_nav.get_origin(); - if (get_distance(ekf_origin, loc) > EKF_ORIGIN_MAX_DIST_M) { + if (ekf_origin.get_distance(loc) > EKF_ORIGIN_MAX_DIST_M) { return true; } diff --git a/ArduCopter/navigation.cpp b/ArduCopter/navigation.cpp index 2b00eaa4e0..675a62c178 100644 --- a/ArduCopter/navigation.cpp +++ b/ArduCopter/navigation.cpp @@ -14,7 +14,7 @@ void Copter::run_nav_updates(void) uint32_t Copter::home_distance() { if (position_ok()) { - _home_distance = get_distance_cm(current_loc, ahrs.get_home()); + _home_distance = current_loc.get_distance(ahrs.get_home()) * 100; } return _home_distance; }