From 76f587b65d1f918dadf4982b4408e14df87154ff Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sun, 19 Feb 2017 17:24:50 -0500 Subject: [PATCH] new ITAF 132 --- Nasal/it-autoflight.nas | 80 +++++++++++++++++++-------------- Systems/autopilot-dlg.xml | 65 +++++++++++++-------------- Systems/it-autoflight.xml | 94 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 166 insertions(+), 73 deletions(-) diff --git a/Nasal/it-autoflight.nas b/Nasal/it-autoflight.nas index 9fb31117..a4b8bbf0 100644 --- a/Nasal/it-autoflight.nas +++ b/Nasal/it-autoflight.nas @@ -1,5 +1,6 @@ -# IT AUTOFLIGHT System Controller by Joshua Davidson (it0uchpods/411). -# V3.0.0 Build 130 +# IT AUTOFLIGHT System Controller +# Joshua Davidson (it0uchpods) +# V3.0.0 Build 132 # This program is 100% GPL! print("IT-AUTOFLIGHT: Please Wait!"); @@ -36,6 +37,8 @@ var ap_init = func { setprop("/it-autoflight/output/vert", 7); setprop("/it-autoflight/settings/min-pitch", -8); setprop("/it-autoflight/settings/max-pitch", 8); + setprop("/it-autoflight/settings/use-nav2-radio", 0); + setprop("/it-autoflight/settings/use-backcourse", 0); setprop("/it-autoflight/internal/min-pitch", -8); setprop("/it-autoflight/internal/max-pitch", 8); setprop("/it-autoflight/internal/alt", 10000); @@ -179,7 +182,8 @@ var lateral = func { setprop("/it-autoflight/mode/arm", " "); } } else if (latset == 2) { - setprop("/instrumentation/nav/signal-quality-norm", 0); + setprop("/instrumentation/nav[0]/signal-quality-norm", 0); + setprop("/instrumentation/nav[1]/signal-quality-norm", 0); setprop("/it-autoflight/output/loc-armed", 1); setprop("/it-autoflight/output/appr-armed", 0); setprop("/it-autoflight/mode/arm", "LOC"); @@ -264,10 +268,12 @@ var vertical = func { if (getprop("/it-autoflight/output/lat") == 2) { # Do nothing because VORLOC is active } else { - setprop("/instrumentation/nav/signal-quality-norm", 0); + setprop("/instrumentation/nav[0]/signal-quality-norm", 0); + setprop("/instrumentation/nav[1]/signal-quality-norm", 0); setprop("/it-autoflight/output/loc-armed", 1); } - setprop("/instrumentation/nav/gs-rate-of-climb", 0); + setprop("/instrumentation/nav[0]/gs-rate-of-climb", 0); + setprop("/instrumentation/nav[1]/gs-rate-of-climb", 0); setprop("/it-autoflight/output/appr-armed", 1); setprop("/it-autoflight/mode/arm", "ILS"); setprop("/it-autoflight/autoland/target-vs", "-650"); @@ -312,13 +318,7 @@ var vertical = func { var altinput = getprop("/it-autoflight/input/alt"); setprop("/it-autoflight/internal/alt", altinput); var fpanow = (int(10*getprop("/it-autoflight/internal/fpa")))*0.1; - if (fpanow < 9.9 and fpanow > -9.9) { - setprop("/it-autoflight/input/fpa", fpanow); - } else if (fpanow >= 9.9) { - setprop("/it-autoflight/input/fpa", 9.9); - } else if (fpanow <= -9.9) { - setprop("/it-autoflight/input/fpa", -9.9); - } + setprop("/it-autoflight/input/fpa", fpanow); setprop("/it-autoflight/output/appr-armed", 0); setprop("/it-autoflight/output/vert", 5); setprop("/it-autoflight/mode/vert", "FPA"); @@ -341,7 +341,7 @@ var vertical = func { setprop("/it-autoflight/mode/arm", " "); var altinput = getprop("/it-autoflight/input/alt"); setprop("/it-autoflight/internal/alt", altinput); - thrustmode(); + thrustmodet.start(); alandt.stop(); alandt1.stop(); } @@ -624,37 +624,51 @@ var update_apparmelec = func { } var locarmcheck = func { - var locdefl = getprop("instrumentation/nav/heading-needle-deflection-norm"); - if ((locdefl < 0.9233) and (getprop("instrumentation/nav/signal-quality-norm") > 0.99)) { - setprop("/it-autoflight/output/loc-armed", 0); - setprop("/it-autoflight/output/lat", 2); - setprop("/it-autoflight/mode/lat", "LOC"); - if (getprop("/it-autoflight/output/appr-armed") == 1) { - # Do nothing because G/S is armed - } else { - setprop("/it-autoflight/mode/arm", " "); - } + var locdefl = getprop("instrumentation/nav[0]/heading-needle-deflection-norm"); + var locdefl_b = getprop("instrumentation/nav[1]/heading-needle-deflection-norm"); + if ((locdefl < 0.9233) and (getprop("instrumentation/nav[0]/signal-quality-norm") > 0.99) and (getprop("/it-autoflight/settings/use-nav2-radio") == 0)) { + make_loc_active(); + } else if ((locdefl_b < 0.9233) and (getprop("instrumentation/nav[1]/signal-quality-norm") > 0.99) and (getprop("/it-autoflight/settings/use-nav2-radio") == 1)) { + make_loc_active(); } else { return 0; } } -var apparmcheck = func { - var signal = getprop("/instrumentation/nav/gs-needle-deflection-norm"); - if (signal <= -0.000000001) { - setprop("/it-autoflight/output/appr-armed", 0); - setprop("/it-autoflight/output/vert", 2); - setprop("/it-autoflight/mode/vert", "G/S"); +var make_loc_active = func { + setprop("/it-autoflight/output/loc-armed", 0); + setprop("/it-autoflight/output/lat", 2); + setprop("/it-autoflight/mode/lat", "LOC"); + if (getprop("/it-autoflight/output/appr-armed") == 1) { + # Do nothing because G/S is armed + } else { setprop("/it-autoflight/mode/arm", " "); - if (getprop("/it-autoflight/settings/land-enable") == 1){ - alandt.start(); - } - thrustmode(); + } +} + +var apparmcheck = func { + var signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); + var signal_b = getprop("/instrumentation/nav[1]/gs-needle-deflection-norm"); + if ((signal <= -0.000000001) and (getprop("/it-autoflight/settings/use-nav2-radio") == 0)) { + make_appr_active(); + } else if ((signal_b <= -0.000000001) and (getprop("/it-autoflight/settings/use-nav2-radio") == 1)) { + make_appr_active(); } else { return 0; } } +var make_appr_active = func { + setprop("/it-autoflight/output/appr-armed", 0); + setprop("/it-autoflight/output/vert", 2); + setprop("/it-autoflight/mode/vert", "G/S"); + setprop("/it-autoflight/mode/arm", " "); + if (getprop("/it-autoflight/settings/land-enable") == 1){ + alandt.start(); + } + thrustmode(); +} + # Autoland Stage 1 Logic (Land) var aland = func { var ap1 = getprop("/it-autoflight/output/ap1"); diff --git a/Systems/autopilot-dlg.xml b/Systems/autopilot-dlg.xml index 4aa8ab7d..136e0d5c 100644 --- a/Systems/autopilot-dlg.xml +++ b/Systems/autopilot-dlg.xml @@ -622,45 +622,40 @@ hbox - - - - - - - - /it-autoflight/input/trk - 0 - - - - - - - - /it-autoflight/input/trk - 1 - - - - - + true + + + + /it-autoflight/settings/use-backcourse + + /it-autoflight/settings/extra/unused-button + + + dialog-apply + + true + diff --git a/Systems/it-autoflight.xml b/Systems/it-autoflight.xml index ae65c246..81f564c2 100644 --- a/Systems/it-autoflight.xml +++ b/Systems/it-autoflight.xml @@ -98,17 +98,36 @@ - NAV1 ERROR DEG + NAV ERROR DEG false gain + + + /it-autoflight/settings/use-nav2-radio + 0 + + /instrumentation/nav[0]/radials/target-auto-hdg-deg /orientation/heading-deg -1.0 - /it-autoflight/internal/nav1-heading-error-deg + + + + /it-autoflight/settings/use-nav2-radio + 1 + + + /instrumentation/nav[1]/radials/target-auto-hdg-deg + + /orientation/heading-deg + -1.0 + + + /it-autoflight/internal/nav-heading-error-deg -180 180 @@ -117,23 +136,58 @@ - NAV1 COURSE ERROR + NAV COURSE ERROR false gain + + + /it-autoflight/settings/use-nav2-radio + 0 + + /instrumentation/nav[0]/radials/selected-deg /orientation/heading-magnetic-deg -1.0 - /it-autoflight/internal/nav1-course-error + + + + /it-autoflight/settings/use-nav2-radio + 1 + + + /instrumentation/nav[1]/radials/selected-deg + + /orientation/heading-magnetic-deg + -1.0 + + + /it-autoflight/internal/nav-course-error -180 180 1.0 + + INTERNAL VERTICAL SPEED COMPUTER @@ -347,7 +401,22 @@ - /it-autoflight/internal/nav1-heading-error-deg + + + /it-autoflight/settings/use-backcourse + 0 + + + /it-autoflight/internal/nav-heading-error-deg + + + + + /it-autoflight/settings/use-backcourse + 1 + + + /it-autoflight/internal/nav-bc-heading-error-deg 0.0 @@ -656,8 +725,23 @@ /velocities/vertical-speed-fps + + + /it-autoflight/settings/use-nav2-radio + 0 + + /instrumentation/nav[0]/gs-rate-of-climb + + + + /it-autoflight/settings/use-nav2-radio + 1 + + + /instrumentation/nav[1]/gs-rate-of-climb + /it-autoflight/internal/target-pitch-deg