From 4e26c2a78763e4a7350d04040202beada3c33929 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Mon, 13 Nov 2017 12:03:31 -0500 Subject: [PATCH] A3XX: FMGC ILS improvements --- A320-main.xml | 6 +- Nasal/FMGC-b.nas | 60 +++++++++---------- Nasal/{PFD_FMA.nas => FMGC-c.nas} | 8 +-- Systems/{fmgc-b.xml => fmgc-drivers.xml} | 0 ...{custom-autothrust.xml => fmgc-thrust.xml} | 0 revision.txt | 2 +- 6 files changed, 36 insertions(+), 40 deletions(-) rename Nasal/{PFD_FMA.nas => FMGC-c.nas} (98%) rename Systems/{fmgc-b.xml => fmgc-drivers.xml} (100%) rename Systems/{custom-autothrust.xml => fmgc-thrust.xml} (100%) diff --git a/A320-main.xml b/A320-main.xml index 3e659d5b..9d76189a 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -119,7 +119,7 @@ Aircraft/IDG-A32X/Systems/it-fbw.xml - Aircraft/IDG-A32X/Systems/fmgc-b.xml + Aircraft/IDG-A32X/Systems/fmgc-drivers.xml Aircraft/IDG-A32X/Systems/fmgc-roll-yaw.xml @@ -128,7 +128,7 @@ Aircraft/IDG-A32X/Systems/fmgc-pitch.xml - Aircraft/IDG-A32X/Systems/custom-autothrust.xml + Aircraft/IDG-A32X/Systems/fmgc-thrust.xml Aircraft/IDG-A32X/Systems/libraries.xml @@ -1211,7 +1211,6 @@ Aircraft/IDG-A32X/Nasal/libraries.nas Aircraft/IDG-A32X/Nasal/buttons.nas - Aircraft/IDG-A32X/Nasal/PFD_FMA.nas Aircraft/IDG-A32X/Nasal/gpws.nas Aircraft/IDG-A32X/Nasal/efis.nas Aircraft/IDG-A32X/Nasal/ECAM.nas @@ -1239,6 +1238,7 @@ Aircraft/IDG-A32X/Nasal/FMGC.nas Aircraft/IDG-A32X/Nasal/FMGC-b.nas + Aircraft/IDG-A32X/Nasal/FMGC-c.nas Aircraft/IDG-A32X/Nasal/MCDU1/MCDU.nas diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index cf7632c6..b6b71d6b 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -16,7 +16,6 @@ setprop("/it-autoflight/internal/altitude-5-sec-ahead", 0); setlistener("/sim/signals/fdm-initialized", func { var trueSpeedKts = getprop("/instrumentation/airspeed-indicator/true-speed-kt"); var locdefl = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm"); - var locdefl_b = getprop("/instrumentation/nav[1]/heading-needle-deflection-norm"); var signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); var VS = getprop("/velocities/vertical-speed-fps"); var TAS = getprop("/velocities/uBody-fps"); @@ -235,13 +234,13 @@ var lateral = func { gui.popupTip("Please make sure you have a route set, and that it is Activated!"); } } else if (latset == 2) { - if (getprop("/it-autoflight/output/lat") == 2) { - # Do nothing because VOR/LOC is active + if (getprop("/instrumentation/nav[0]/in-range") == 1) { + if (getprop("/it-autoflight/output/lat") != 2) { + setprop("/it-autoflight/output/loc-armed", 1); + setprop("/it-autoflight/mode/arm", "LOC"); + } } else { 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/mode/arm", "LOC"); } } else if (latset == 3) { alandt.stop(); @@ -338,19 +337,17 @@ var vertical = func { } thrustmode(); } else if (vertset == 2) { - if (getprop("/it-autoflight/output/lat") == 2) { - # Do nothing because VOR/LOC is active + if (getprop("/instrumentation/nav[0]/in-range") == 1) { + if (getprop("/it-autoflight/output/lat") != 2) { + setprop("/it-autoflight/output/loc-armed", 1); + } + if (getprop("/it-autoflight/output/vert") != 2 and getprop("/it-autoflight/output/vert") != 6) { + setprop("/it-autoflight/output/appr-armed", 1); + setprop("/it-autoflight/mode/arm", "ILS"); + } } else { setprop("/instrumentation/nav[0]/signal-quality-norm", 0); - setprop("/instrumentation/nav[1]/signal-quality-norm", 0); - setprop("/it-autoflight/output/loc-armed", 1); - } - if ((getprop("/it-autoflight/output/vert") == 2) or (getprop("/it-autoflight/output/vert") == 6)) { - # Do nothing because G/S or LAND or FLARE is active - } else { setprop("/instrumentation/nav[0]/gs-rate-of-climb", 0); - setprop("/it-autoflight/output/appr-armed", 1); - setprop("/it-autoflight/mode/arm", "ILS"); } } else if (vertset == 3) { alandt.stop(); @@ -788,23 +785,22 @@ var check_arms = func { } var update_arms = func { - if (getprop("/it-autoflight/output/loc-armed")) { - locdefl = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm"); - 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("/FMGC/internal/loc-source") == "NAV0")) { - make_loc_active(); - } else if ((locdefl_b < 0.9233) and (getprop("/instrumentation/nav[2]/signal-quality-norm") > 0.99) and (getprop("/FMGC/internal/loc-source") == "VOR0")) { - make_loc_active(); - } else { - return 0; + if (getprop("/instrumentation/nav[0]/in-range") == 1) { + if (getprop("/it-autoflight/output/loc-armed")) { + locdefl = abs(getprop("/instrumentation/nav[0]/heading-needle-deflection-norm")); + if (locdefl < 0.95 and locdefl != 0 and getprop("/instrumentation/nav[0]/signal-quality-norm") > 0.99) { + make_loc_active(); + } else { + return 0; + } } - } - if (getprop("/it-autoflight/output/appr-armed")) { - signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); - if (((signal < 0 and signal >= -0.30) or (signal > 0 and signal <= 0.30)) and (getprop("/FMGC/internal/loc-source") == "NAV0") and (getprop("/it-autoflight/output/lat") == 2)) { - make_appr_active(); - } else { - return 0; + if (getprop("/it-autoflight/output/appr-armed")) { + signal = getprop("/instrumentation/nav[0]/gs-needle-deflection-norm"); + if (((signal < 0 and signal >= -0.20) or (signal > 0 and signal <= 0.20)) and getprop("/it-autoflight/output/lat") == 2) { + make_appr_active(); + } else { + return 0; + } } } } diff --git a/Nasal/PFD_FMA.nas b/Nasal/FMGC-c.nas similarity index 98% rename from Nasal/PFD_FMA.nas rename to Nasal/FMGC-c.nas index 82a00171..7aebfefa 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/FMGC-c.nas @@ -1,5 +1,5 @@ -# Airbus PFD FMA -# Joshua Davidson (it0uchpods) +# A3XX FMGC/Autoflight +# Joshua Davidson (it0uchpods) and Jonathan Redpath (legoboyvdlp) ######################################### # Copyright (c) it0uchpods Design Group # @@ -237,9 +237,9 @@ setlistener("/it-autoflight/mode/lat", func { var locupdate = maketimer(0.5, func { var lat = getprop("/it-autoflight/mode/lat"); var newlat = getprop("/modes/pfd/fma/roll-mode"); - var nav_defl = getprop("/it-autoflight/internal/nav-heading-error-deg"); + var nav_defl = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm"); if (lat == "LOC") { - if (nav_defl > -1 and nav_defl < 1) { + if (nav_defl > -0.15 and nav_defl < 0.15) { locupdate.stop(); if (newlat != "LOC") { setprop("/modes/pfd/fma/roll-mode", "LOC"); diff --git a/Systems/fmgc-b.xml b/Systems/fmgc-drivers.xml similarity index 100% rename from Systems/fmgc-b.xml rename to Systems/fmgc-drivers.xml diff --git a/Systems/custom-autothrust.xml b/Systems/fmgc-thrust.xml similarity index 100% rename from Systems/custom-autothrust.xml rename to Systems/fmgc-thrust.xml diff --git a/revision.txt b/revision.txt index 8b364a1a..7ef86c62 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -3063 \ No newline at end of file +3064 \ No newline at end of file