A3XX: Improve FBW, AP unavailable unless Normal Law

This commit is contained in:
Joshua Davidson 2017-08-05 15:46:37 -04:00
parent 7d58a9cdb8
commit 8a2617156e
3 changed files with 40 additions and 7 deletions

View file

@ -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);

View file

@ -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);

View file

@ -50,7 +50,18 @@
</condition>
<property>/it-autoflight/internal/aileron-cmd</property>
</input>
<input>/controls/flight/aileron</input>
<input>
<expression>
<table>
<property>/controls/flight/aileron</property>
<entry><ind>-1.00</ind><dep>-1</dep></entry>
<entry><ind>-0.04</ind><dep> 0</dep></entry>
<entry><ind> 0.00</ind><dep> 0</dep></entry>
<entry><ind> 0.04</ind><dep> 0</dep></entry>
<entry><ind> 1.00</ind><dep> 1</dep></entry>
</table>
</expression>
</input>
<output>/controls/flight/aileron-input</output>
<max-rate-of-change>2.0</max-rate-of-change>
</filter>
@ -112,8 +123,8 @@
<property>/controls/flight/elevator</property>
<table>
<property>/position/gear-agl-ft</property>
<entry><ind> 5</ind><dep>0.12</dep></entry>
<entry><ind>50</ind><dep>0.07</dep></entry>
<entry><ind> 5</ind><dep>0.13</dep></entry>
<entry><ind>50</ind><dep>0.08</dep></entry>
</table>
</sum>
</expression>
@ -191,7 +202,18 @@
</condition>
<property>/it-autoflight/internal/elevator-cmd</property>
</input>
<input>/controls/flight/elevator</input>
<input>
<expression>
<table>
<property>/controls/flight/elevator</property>
<entry><ind>-1.00</ind><dep>-1</dep></entry>
<entry><ind>-0.04</ind><dep> 0</dep></entry>
<entry><ind> 0.00</ind><dep> 0</dep></entry>
<entry><ind> 0.04</ind><dep> 0</dep></entry>
<entry><ind> 1.00</ind><dep> 1</dep></entry>
</table>
</expression>
</input>
<output>/controls/flight/elevator-input</output>
<max-rate-of-change>2.0</max-rate-of-change>
</filter>