From 535e77bdf89c6816ff8f2806ab2237ed00072036 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sat, 1 Jul 2017 20:00:18 -0400 Subject: [PATCH] A3XX: Improve FMA --- Models/Instruments/PFD/PFD1.xml | 138 ++++---------------------------- Models/Instruments/PFD/PFD2.xml | 138 ++++---------------------------- Nasal/PFD_FMA.nas | 86 +++++++++++--------- 3 files changed, 81 insertions(+), 281 deletions(-) diff --git a/Models/Instruments/PFD/PFD1.xml b/Models/Instruments/PFD/PFD1.xml index ff1a88a0..3c790ff7 100644 --- a/Models/Instruments/PFD/PFD1.xml +++ b/Models/Instruments/PFD/PFD1.xml @@ -2141,29 +2141,6 @@ - - athr-thrlvr-fma - - 0.00091828 - -0.0546226 - 0.0710781 - - center-center - yz-plane - text-value - THR LVR - autopilot/serviceable - helvetica_medium.txf - true - false - false - 0.0055 - - 32 - 32 - - - select thrust-mode-fma @@ -2174,68 +2151,22 @@ 1 - - - /it-autoflight/output/thr-mode - 2 - - - - /it-autoflight/output/fd1 - 1 - - - /it-autoflight/output/fd2 - 1 - - - - - /systems/thrust/state1 - CL - - - /systems/thrust/state2 - CL - - - - - - - /it-autoflight/output/thr-mode - 2 - - - - /it-autoflight/output/fd1 - 0 - - - /it-autoflight/output/fd2 - 0 - - - - - - /systems/thrust/state1 - MAN - - - /systems/thrust/state2 - MAN - - - /systems/thrust/state1 - CL - - - /systems/thrust/state2 - CL - - - + + /systems/thrust/state1 + MAN + + + /systems/thrust/state2 + MAN + + + /systems/thrust/state1 + CL + + + /systems/thrust/state2 + CL + @@ -2350,41 +2281,6 @@ - - - select - athr-thrlvr-fma - - - - /it-autoflight/output/athr - 1 - - - /it-autoflight/output/thr-mode - 2 - - - - /it-autoflight/output/fd1 - 1 - - - /it-autoflight/output/fd2 - 1 - - - - /controls/engines/engine[0]/throttle - 0.60 - - - /controls/engines/engine[1]/throttle - 0.60 - - - - athr-man-fma @@ -2883,7 +2779,6 @@ select thrust-mode-fma athr-lvrclb-fma - athr-thrlvr-fma athr-thr-fma athr-mct-fma athr-toga-fma @@ -3396,7 +3291,6 @@ pitch-mode-fma land-mode-fma roll-mode-fma - athr-thrlvr-fma 0 0.843 diff --git a/Models/Instruments/PFD/PFD2.xml b/Models/Instruments/PFD/PFD2.xml index 6f59a256..60755415 100644 --- a/Models/Instruments/PFD/PFD2.xml +++ b/Models/Instruments/PFD/PFD2.xml @@ -2141,29 +2141,6 @@ - - athr-thrlvr-fma - - 0.00091828 - -0.0546226 - 0.0710781 - - center-center - yz-plane - text-value - THR LVR - autopilot/serviceable - helvetica_medium.txf - true - false - false - 0.0055 - - 32 - 32 - - - select thrust-mode-fma @@ -2174,68 +2151,22 @@ 1 - - - /it-autoflight/output/thr-mode - 2 - - - - /it-autoflight/output/fd1 - 1 - - - /it-autoflight/output/fd2 - 1 - - - - - /systems/thrust/state1 - CL - - - /systems/thrust/state2 - CL - - - - - - - /it-autoflight/output/thr-mode - 2 - - - - /it-autoflight/output/fd1 - 0 - - - /it-autoflight/output/fd2 - 0 - - - - - - /systems/thrust/state1 - MAN - - - /systems/thrust/state2 - MAN - - - /systems/thrust/state1 - CL - - - /systems/thrust/state2 - CL - - - + + /systems/thrust/state1 + MAN + + + /systems/thrust/state2 + MAN + + + /systems/thrust/state1 + CL + + + /systems/thrust/state2 + CL + @@ -2350,41 +2281,6 @@ - - - select - athr-thrlvr-fma - - - - /it-autoflight/output/athr - 1 - - - /it-autoflight/output/thr-mode - 2 - - - - /it-autoflight/output/fd1 - 1 - - - /it-autoflight/output/fd2 - 1 - - - - /controls/engines/engine[0]/throttle - 0.60 - - - /controls/engines/engine[1]/throttle - 0.60 - - - - athr-man-fma @@ -2883,7 +2779,6 @@ select thrust-mode-fma athr-lvrclb-fma - athr-thrlvr-fma athr-thr-fma athr-mct-fma athr-toga-fma @@ -3396,7 +3291,6 @@ pitch-mode-fma land-mode-fma roll-mode-fma - athr-thrlvr-fma 0 0.843 diff --git a/Nasal/PFD_FMA.nas b/Nasal/PFD_FMA.nas index f2c95831..3f0405fb 100644 --- a/Nasal/PFD_FMA.nas +++ b/Nasal/PFD_FMA.nas @@ -1,33 +1,59 @@ # Airbus PFD FMA -# Joshua Davidson (it0uchpods/411) +# Joshua Davidson (it0uchpods) setprop("/FMGC/internal/cruise-ft", 10000); setprop("/it-autoflight/internal/alt", 10000); -# Speed or Mach? -var speedmach = func { - if ((getprop("/it-autoflight/output/vert") == 4) or (getprop("/it-autoflight/output/vert") == 6) or (getprop("/it-autoflight/output/vert") == 7) or (getprop("/it-autoflight/output/vert") == 8)) { - if (getprop("/it-autoflight/output/fd1") == 0 and getprop("/it-autoflight/output/fd2") == 0 and getprop("/it-autoflight/output/ap1") == 0 and getprop("/it-autoflight/output/ap2") == 0) { - speedmach_b(); - } else { - var thr = getprop("/it-autoflight/output/thr-mode"); - var newthr = getprop("/modes/pfd/fma/throttle-mode"); - if (thr == 0) { - speedmach_b(); - } else if (thr == 1) { - if (newthr != "THR IDLE") { - setprop("/modes/pfd/fma/throttle-mode", "THR IDLE"); - } - } else if (thr == 2) { - if (newthr != "THR CLB") { - setprop("/modes/pfd/fma/throttle-mode", "THR CLB"); - } - } +setlistener("sim/signals/fdm-initialized", func { + speedmach.start(); +}); + +# Master Thrust +var speedmach = maketimer(0.05, func { + var state1 = getprop("/systems/thrust/state1"); + var state2 = getprop("/systems/thrust/state2"); + var newthr = getprop("/modes/pfd/fma/throttle-mode"); + if (state1 == "TOGA" or state2 == "TOGA") { + if (newthr != " ") { + setprop("/modes/pfd/fma/throttle-mode", " "); + } + } else if (state1 == "MCT" or state2 == "MCT") { + if (newthr != " ") { + setprop("/modes/pfd/fma/throttle-mode", " "); + } + } else if (state1 == "MAN THR" or state2 == "MAN THR") { + if (newthr != " ") { + setprop("/modes/pfd/fma/throttle-mode", " "); } } else { - speedmach_b(); + if ((getprop("/it-autoflight/output/vert") == 4) or (getprop("/it-autoflight/output/vert") == 6) or (getprop("/it-autoflight/output/vert") == 7) or (getprop("/it-autoflight/output/vert") == 8)) { + if (getprop("/it-autoflight/output/fd1") == 0 and getprop("/it-autoflight/output/fd2") == 0 and getprop("/it-autoflight/output/ap1") == 0 and getprop("/it-autoflight/output/ap2") == 0) { + speedmach_b(); + } else { + var thr = getprop("/it-autoflight/output/thr-mode"); + if (thr == 0) { + speedmach_b(); + } else if (thr == 1) { + if (newthr != "THR IDLE") { + setprop("/modes/pfd/fma/throttle-mode", "THR IDLE"); + } + } else if (thr == 2) { + if (state1 == "CL" or state2 == "CL") { + if (newthr != "THR CLB") { + setprop("/modes/pfd/fma/throttle-mode", "THR CLB"); + } + } else { + if (newthr != "THR LVR") { + setprop("/modes/pfd/fma/throttle-mode", "THR LVR"); + } + } + } + } + } else { + speedmach_b(); + } } -} +}); var speedmach_b = func { var newthr = getprop("/modes/pfd/fma/throttle-mode"); @@ -42,16 +68,7 @@ var speedmach_b = func { } } -# Update Speed or Mach -setlistener("/it-autoflight/input/kts-mach", func { - speedmach(); -}); - -# Master Thrust -setlistener("/it-autoflight/output/thr-mode", func { - speedmach(); -}); - +# HDG/TRK var hdgmde = func { var lat = getprop("/it-autoflight/mode/lat"); var newlat = getprop("/modes/pfd/fma/roll-mode"); @@ -67,7 +84,6 @@ var hdgmde = func { } } -# HDG/TRK setlistener("/it-autoflight/custom/trk-fpa", func { hdgmde(); }); @@ -389,22 +405,18 @@ var boxchk_b = func { # Update AP FD ATHR setlistener("/it-autoflight/output/ap1", func { - speedmach(); ap(); boxchk(); }); setlistener("/it-autoflight/output/ap2", func { - speedmach(); ap(); boxchk(); }); setlistener("/it-autoflight/output/fd1", func { - speedmach(); fd(); boxchk(); }); setlistener("/it-autoflight/output/fd2", func { - speedmach(); fd(); boxchk(); });