From 8a2617156ef3f5233f029ac5ff9017332e86b1c9 Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Sat, 5 Aug 2017 15:46:37 -0400 Subject: [PATCH] A3XX: Improve FBW, AP unavailable unless Normal Law --- Nasal/FMGC-b.nas | 6 ++++-- Nasal/it-fbw.nas | 11 ++++++++++- Systems/it-fbw.xml | 30 ++++++++++++++++++++++++++---- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Nasal/FMGC-b.nas b/Nasal/FMGC-b.nas index 75d5f991..4f0e248c 100644 --- a/Nasal/FMGC-b.nas +++ b/Nasal/FMGC-b.nas @@ -78,6 +78,7 @@ var APinit = func { setlistener("/it-autoflight/input/ap1", func { var apmas = getprop("/it-autoflight/input/ap1"); var ac_ess = getprop("/systems/electrical/bus/ac-ess"); + var law = getprop("/it-fbw/law"); if (apmas == 0) { fmabox(); setprop("/it-autoflight/output/ap1", 0); @@ -85,7 +86,7 @@ setlistener("/it-autoflight/input/ap1", func { setprop("/it-autoflight/sound/apoffsound", 1); setprop("/it-autoflight/sound/enableapoffsound", 0); } - } else if (apmas == 1 and ac_ess >= 110) { + } else if (apmas == 1 and ac_ess >= 110 and law == 0) { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { fmabox(); setprop("/it-autoflight/output/ap1", 1); @@ -99,6 +100,7 @@ setlistener("/it-autoflight/input/ap1", func { setlistener("/it-autoflight/input/ap2", func { var apmas = getprop("/it-autoflight/input/ap2"); var ac_ess = getprop("/systems/electrical/bus/ac-ess"); + var law = getprop("/it-fbw/law"); if (apmas == 0) { fmabox(); setprop("/it-autoflight/output/ap2", 0); @@ -106,7 +108,7 @@ setlistener("/it-autoflight/input/ap2", func { setprop("/it-autoflight/sound/apoffsound2", 1); setprop("/it-autoflight/sound/enableapoffsound2", 0); } - } else if (apmas == 1 and ac_ess >= 110) { + } else if (apmas == 1 and ac_ess >= 110 and law == 0) { if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/gear/gear[2]/wow") == 0)) { fmabox(); setprop("/it-autoflight/output/ap2", 1); diff --git a/Nasal/it-fbw.nas b/Nasal/it-fbw.nas index d6d5a218..de28dc56 100644 --- a/Nasal/it-fbw.nas +++ b/Nasal/it-fbw.nas @@ -210,6 +210,15 @@ var fbw_loop = func { } } } + + if (getprop("/it-fbw/law") != 0) { + if (getprop("/it-autoflight/output/ap1") == 1) { + setprop("/it-autoflight/input/ap1", 0); + } + if (getprop("/it-autoflight/output/ap2") == 1) { + setprop("/it-autoflight/input/ap2", 0); + } + } } ########################### @@ -227,4 +236,4 @@ setlistener("/sim/signals/fdm-initialized", func { # Timers # ########## var updatet = maketimer(0.1, update_loop); -var fbwt = maketimer(0.05, fbw_loop); +var fbwt = maketimer(0.03, fbw_loop); diff --git a/Systems/it-fbw.xml b/Systems/it-fbw.xml index f45519ce..bf4bbaff 100644 --- a/Systems/it-fbw.xml +++ b/Systems/it-fbw.xml @@ -50,7 +50,18 @@ /it-autoflight/internal/aileron-cmd - /controls/flight/aileron + + + + /controls/flight/aileron + -1.00-1 + -0.04 0 + 0.00 0 + 0.04 0 + 1.00 1 +
+
+ /controls/flight/aileron-input 2.0 @@ -112,8 +123,8 @@ /controls/flight/elevator /position/gear-agl-ft - 50.12 - 500.07 + 50.13 + 500.08
@@ -191,7 +202,18 @@ /it-autoflight/internal/elevator-cmd - /controls/flight/elevator + + + + /controls/flight/elevator + -1.00-1 + -0.04 0 + 0.00 0 + 0.04 0 + 1.00 1 +
+
+ /controls/flight/elevator-input 2.0