From a33573352ec7ea04a2436cfda8b3c7fc2a5ca9fa Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 5 Aug 2013 10:30:04 +1000 Subject: [PATCH] Plane: fixes for updated AP_Math and AHRS APIs Pair-Programmed-With: Brandon Jones --- ArduPlane/ArduPlane.pde | 2 +- ArduPlane/commands_logic.pde | 4 ++-- ArduPlane/geofence.pde | 2 +- ArduPlane/navigation.pde | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ArduPlane/ArduPlane.pde b/ArduPlane/ArduPlane.pde index a4b62595e0..b4a44c5542 100644 --- a/ArduPlane/ArduPlane.pde +++ b/ArduPlane/ArduPlane.pde @@ -987,7 +987,7 @@ static void update_GPS(void) } // get position from AHRS - have_position = ahrs.get_position(¤t_loc); + have_position = ahrs.get_position(current_loc); if (g_gps->new_data && g_gps->status() >= GPS::GPS_OK_FIX_3D) { g_gps->new_data = false; diff --git a/ArduPlane/commands_logic.pde b/ArduPlane/commands_logic.pde index adfa605cbd..ea78c0a1fe 100644 --- a/ArduPlane/commands_logic.pde +++ b/ArduPlane/commands_logic.pde @@ -393,7 +393,7 @@ static bool verify_nav_wp() if (wp_distance <= nav_controller->turn_distance(g.waypoint_radius)) { gcs_send_text_fmt(PSTR("Reached Waypoint #%i dist %um"), (unsigned)nav_command_index, - (unsigned)get_distance(¤t_loc, &next_WP)); + (unsigned)get_distance(current_loc, next_WP)); return true; } @@ -401,7 +401,7 @@ static bool verify_nav_wp() if (location_passed_point(current_loc, prev_WP, next_WP)) { gcs_send_text_fmt(PSTR("Passed Waypoint #%i dist %um"), (unsigned)nav_command_index, - (unsigned)get_distance(¤t_loc, &next_WP)); + (unsigned)get_distance(current_loc, next_WP)); return true; } diff --git a/ArduPlane/geofence.pde b/ArduPlane/geofence.pde index dc856f94b0..cd008f928a 100644 --- a/ArduPlane/geofence.pde +++ b/ArduPlane/geofence.pde @@ -213,7 +213,7 @@ static void geofence_check(bool altitude_check_only) } else if (geofence_check_maxalt()) { outside = true; breach_type = FENCE_BREACH_MAXALT; - } else if (!altitude_check_only && ahrs.get_position(&loc)) { + } else if (!altitude_check_only && ahrs.get_position(loc)) { Vector2l location; location.x = loc.lat; location.y = loc.lng; diff --git a/ArduPlane/navigation.pde b/ArduPlane/navigation.pde index 5e9bbec91f..6efb2b01ec 100644 --- a/ArduPlane/navigation.pde +++ b/ArduPlane/navigation.pde @@ -60,7 +60,7 @@ static void navigate() // waypoint distance from plane // ---------------------------- - wp_distance = get_distance(¤t_loc, &next_WP); + wp_distance = get_distance(current_loc, next_WP); if (wp_distance < 0) { gcs_send_text_P(SEVERITY_HIGH,PSTR("WP error - distance < 0")); @@ -186,9 +186,9 @@ static void update_cruise() if (cruise_state.locked_heading) { next_WP = prev_WP; // always look 1km ahead - location_update(&next_WP, + location_update(next_WP, cruise_state.locked_heading_cd*0.01f, - get_distance(&prev_WP, ¤t_loc) + 1000); + get_distance(prev_WP, current_loc) + 1000); nav_controller->update_waypoint(prev_WP, next_WP); } } @@ -233,7 +233,7 @@ static void setup_glide_slope(void) { // establish the distance we are travelling to the next waypoint, // for calculating out rate of change of altitude - wp_totalDistance = get_distance(¤t_loc, &next_WP); + wp_totalDistance = get_distance(current_loc, next_WP); wp_distance = wp_totalDistance; /*