diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index 57e34d2f..8cda9925 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -555,43 +555,43 @@ var ap_various = func { } if (getprop("/autopilot/route-manager/route/num") > 0 and getprop("/autopilot/route-manager/active") == 1) { - gnds_mps = getprop("/velocities/groundspeed-kt") * 0.5144444444444; - wp_fly_from = getprop("/autopilot/route-manager/current-wp"); - if (wp_fly_from < 0) { - wp_fly_from = 0; - } - current_course = getprop("/autopilot/route-manager/route/wp[" ~ wp_fly_from ~ "]/leg-bearing-true-deg"); - wp_fly_to = getprop("/autopilot/route-manager/current-wp") + 1; - if (wp_fly_to < 0) { - wp_fly_to = 0; - } - next_course = getprop("/autopilot/route-manager/route/wp[" ~ wp_fly_to ~ "]/leg-bearing-true-deg"); - max_bank_limit = getprop("/it-autoflight/internal/bank-limit"); + if ((getprop("/autopilot/route-manager/current-wp") + 1) < getprop("/autopilot/route-manager/route/num")) { + gnds_mps = getprop("/velocities/groundspeed-kt") * 0.5144444444444; + wp_fly_from = getprop("/autopilot/route-manager/current-wp"); + if (wp_fly_from < 0) { + wp_fly_from = 0; + } + current_course = getprop("/autopilot/route-manager/route/wp[" ~ wp_fly_from ~ "]/leg-bearing-true-deg"); + wp_fly_to = getprop("/autopilot/route-manager/current-wp") + 1; + if (wp_fly_to < 0) { + wp_fly_to = 0; + } + next_course = getprop("/autopilot/route-manager/route/wp[" ~ wp_fly_to ~ "]/leg-bearing-true-deg"); + max_bank_limit = getprop("/it-autoflight/internal/bank-limit"); - delta_angle = math.abs(geo.normdeg180(current_course - next_course)); - max_bank = delta_angle * 1.5; - if (max_bank > max_bank_limit) { - max_bank = max_bank_limit; - } - radius = (gnds_mps * gnds_mps) / (9.81 * math.tan(max_bank / 57.2957795131)); - time = 0.64 * gnds_mps * delta_angle * 0.7 / (360 * math.tan(max_bank / 57.2957795131)); - delta_angle_rad = (180 - delta_angle) / 114.5915590262; - R = radius/math.sin(delta_angle_rad); - dist_coeff = delta_angle * -0.011111 + 2; - if (dist_coeff < 1) { - dist_coeff = 1; - } - turn_dist = math.cos(delta_angle_rad) * R * dist_coeff / 1852; - if (getprop("/gear/gear[0]/wow") == 1 and turn_dist < 1) { - turn_dist = 1; - } - setprop("/it-autoflight/internal/lnav-advance-nm", turn_dist); - if (getprop("/sim/time/elapsed-sec")-getprop("/autopilot/internal/wp-change-time") > 60) { - setprop("/autopilot/internal/wp-change-check-period", time); - } - - if (getprop("/autopilot/route-manager/wp/dist") <= turn_dist) { - if ((getprop("/autopilot/route-manager/current-wp") + 1) < getprop("/autopilot/route-manager/route/num")) { + delta_angle = math.abs(geo.normdeg180(current_course - next_course)); + max_bank = delta_angle * 1.5; + if (max_bank > max_bank_limit) { + max_bank = max_bank_limit; + } + radius = (gnds_mps * gnds_mps) / (9.81 * math.tan(max_bank / 57.2957795131)); + time = 0.64 * gnds_mps * delta_angle * 0.7 / (360 * math.tan(max_bank / 57.2957795131)); + delta_angle_rad = (180 - delta_angle) / 114.5915590262; + R = radius/math.sin(delta_angle_rad); + dist_coeff = delta_angle * -0.011111 + 2; + if (dist_coeff < 1) { + dist_coeff = 1; + } + turn_dist = math.cos(delta_angle_rad) * R * dist_coeff / 1852; + if (getprop("/gear/gear[0]/wow") == 1 and turn_dist < 1) { + turn_dist = 1; + } + setprop("/it-autoflight/internal/lnav-advance-nm", turn_dist); + if (getprop("/sim/time/elapsed-sec")-getprop("/autopilot/internal/wp-change-time") > 60) { + setprop("/autopilot/internal/wp-change-check-period", time); + } + + if (getprop("/autopilot/route-manager/wp/dist") <= turn_dist) { setprop("/autopilot/route-manager/current-wp", getprop("/autopilot/route-manager/current-wp") + 1); } } diff --git a/revision.txt b/revision.txt index f2c96cd5..7aee86b9 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -4100 \ No newline at end of file +4101 \ No newline at end of file