From 889a19f7903ef44ffbfae58c35f981cdd590208b Mon Sep 17 00:00:00 2001 From: rmackay9 Date: Mon, 17 Dec 2012 16:54:03 +0900 Subject: [PATCH] ArduCopter: move scaleLongUp and scaleLongDown initialisation to init_home --- ArduCopter/commands.pde | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArduCopter/commands.pde b/ArduCopter/commands.pde index b6ef87f552..8833b4f71c 100644 --- a/ArduCopter/commands.pde +++ b/ArduCopter/commands.pde @@ -158,11 +158,6 @@ static void set_next_WP(struct Location *wp) // Save new altitude so we can track it for climb_rate set_new_altitude(next_WP.alt); - // this is used to offset the shrinking longitude as we go towards the poles - float rads = (fabs((float)next_WP.lat)/t7) * 0.0174532925; - scaleLongDown = cos(rads); - scaleLongUp = 1.0f/cos(rads); - // this is handy for the groundstation // ----------------------------------- wp_distance = get_distance_cm(¤t_loc, &next_WP); @@ -202,6 +197,11 @@ static void init_home() if (g.log_bitmask & MASK_LOG_CMD) Log_Write_Cmd(0, &home); + // update navigation scalers. used to offset the shrinking longitude as we go towards the poles + float rads = (fabs((float)next_WP.lat)/t7) * 0.0174532925; + scaleLongDown = cos(rads); + scaleLongUp = 1.0f/cos(rads); + // Save prev loc this makes the calcs look better before commands are loaded prev_WP = home;