A3XX: Fix some FMGC bugs and trimReset bugs

This commit is contained in:
Joshua Davidson 2017-11-12 00:22:16 -05:00
parent 4778bf8d3b
commit 3354c40a93
3 changed files with 104 additions and 19 deletions

View file

@ -26,6 +26,7 @@ setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99"); setprop("/FMGC/internal/ils2-mcdu", "XXX/999.99");
setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99"); setprop("/FMGC/internal/vor1-mcdu", "XXX/999.99");
setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX"); setprop("/FMGC/internal/vor2-mcdu", "999.99/XXX");
setprop("/gear/gear[0]/wow-fmgc", 1);
setlistener("/sim/signals/fdm-initialized", func { setlistener("/sim/signals/fdm-initialized", func {
var database1 = getprop("/FMGC/internal/navdatabase"); var database1 = getprop("/FMGC/internal/navdatabase");
@ -135,29 +136,17 @@ var FMGCinit = func {
various2.start(); various2.start();
} }
############# ############
# TO Status # # FBW Trim #
############# ############
setlistener("/gear/gear[1]/wow", func { setlistener("/gear/gear[0]/wow-fmgc", func {
flarecheck(); trimReset();
}); });
setlistener("/gear/gear[2]/wow", func { var trimReset = func {
flarecheck();
});
var flarecheck = func {
gear0 = getprop("/gear/gear[0]/wow"); gear0 = getprop("/gear/gear[0]/wow");
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
flaps = getprop("/controls/flight/flap-pos"); flaps = getprop("/controls/flight/flap-pos");
if (gear0 == 1 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) {
setprop("/FMGC/status/to-state", 1);
}
if (getprop("/position/gear-agl-ft") >= 55) {
setprop("/FMGC/status/to-state", 0);
}
if (gear0 == 1 and getprop("/FMGC/status/to-state") == 0 and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) { if (gear0 == 1 and getprop("/FMGC/status/to-state") == 0 and (flaps >= 5 or (flaps >= 4 and getprop("/instrumentation/mk-viii/inputs/discretes/momentary-flap3-override") == 1))) {
interpolate("/controls/flight/elevator-trim", 0.0, 1.5); interpolate("/controls/flight/elevator-trim", 0.0, 1.5);
} }
@ -220,6 +209,13 @@ var phasecheck = maketimer(0.2, func {
newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed"); newvertarm = getprop("/modes/pfd/fma/pitch-mode2-armed");
thr1 = getprop("/controls/engines/engine[0]/throttle-pos"); thr1 = getprop("/controls/engines/engine[0]/throttle-pos");
thr2 = getprop("/controls/engines/engine[1]/throttle-pos"); thr2 = getprop("/controls/engines/engine[1]/throttle-pos");
gear0 = getprop("/gear/gear[0]/wow");
state1 = getprop("/systems/thrust/state1");
state2 = getprop("/systems/thrust/state2");
if (getprop("/gear/gear[0]/wow") != getprop("/gear/gear[0]/wow-fmgc")) {
setprop("/gear/gear[0]/wow-fmgc", getprop("/gear/gear[0]/wow"));
}
if ((n1_left < 70 or n1_right < 70 or gs < 90) and mode == " " and gear0 == 1 and phase == 1) { if ((n1_left < 70 or n1_right < 70 or gs < 90) and mode == " " and gear0 == 1 and phase == 1) {
setprop("/FMGC/status/phase", "0"); setprop("/FMGC/status/phase", "0");
@ -293,6 +289,13 @@ var phasecheck = maketimer(0.2, func {
setprop("/FMGC/internal/minspeed", 134); setprop("/FMGC/internal/minspeed", 134);
setprop("/FMGC/internal/alpha-prot-speed", 123); setprop("/FMGC/internal/alpha-prot-speed", 123);
} }
if (gear0 == 1 and (state1 == "MCT" or state1 == "MAN THR" or state1 == "TOGA") and (state2 == "MCT" or state2 == "MAN THR" or state2 == "TOGA") and flaps < 5) {
setprop("/FMGC/status/to-state", 1);
}
if (getprop("/position/gear-agl-ft") >= 55) {
setprop("/FMGC/status/to-state", 0);
}
}); });
var reset_FMGC = func { var reset_FMGC = func {

View file

@ -279,11 +279,93 @@
<!-- =============================================================== --> <!-- =============================================================== -->
<!-- Other stuff --> <!-- Other stuff -->
<!-- =============================================================== --> <!-- =============================================================== -->
<filter>
<name>Ground Horizon</name>
<type>gain</type>
<gain>1</gain>
<enable>
<condition>
<not-equals>
<property>/options/test-canvas</property>
<value>1</value>
</not-equals>
</condition>
</enable>
<input>
<condition>
<and>
<equals>
<property>/gear/gear[1]/wow</property>
<value>0</value>
</equals>
<equals>
<property>/gear/gear[2]/wow</property>
<value>0</value>
</equals>
</and>
</condition>
<expression>
<dif>
<table>
<property>/position/gear-agl-ft</property>
<entry><ind> 1</ind><dep> 0</dep></entry>
<entry><ind>150</ind><dep> 16</dep></entry>
</table>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind>16</ind><dep>-16</dep></entry>
</table>
</dif>
</expression>
</input>
<input>
<condition>
<or>
<equals>
<property>/gear/gear[1]/wow</property>
<value>1</value>
</equals>
<equals>
<property>/gear/gear[2]/wow</property>
<value>1</value>
</equals>
</or>
</condition>
<expression>
<dif>
<table>
<property>/position/gear-agl-ft</property>
<entry><ind> 1</ind><dep> 0</dep></entry>
<entry><ind>150</ind><dep> 16</dep></entry>
</table>
<table>
<property>/orientation/pitch-deg</property>
<entry><ind>-16</ind><dep> 16</dep></entry>
<entry><ind> 0</ind><dep> 0</dep></entry>
<entry><ind> 16</ind><dep>-16</dep></entry>
</table>
</dif>
</expression>
</input>
<output>/instrumentation/pfd/horizon-ground</output>
<min>-16</min>
<max>16</max>
</filter>
<filter> <filter>
<name>Ground Horizon</name> <name>Ground Horizon</name>
<type>gain</type> <type>gain</type>
<gain>1</gain> <gain>1</gain>
<enable>
<condition>
<equals>
<property>/options/test-canvas</property>
<value>1</value>
</equals>
</condition>
</enable>
<input> <input>
<condition> <condition>
<and> <and>

View file

@ -1 +1 @@
3060 3061