AP off / athr off

This commit is contained in:
Jonathan Redpath 2018-11-19 15:13:52 +00:00
parent ff85ac3d87
commit 270e173a77
6 changed files with 89 additions and 1 deletions

View file

@ -1071,6 +1071,9 @@
if (getprop("/it-autoflight/output/athr") == 1) { if (getprop("/it-autoflight/output/athr") == 1) {
setprop("/it-autoflight/input/athr", 0); setprop("/it-autoflight/input/athr", 0);
} }
if (libraries.athr_active == 1) {
libraries.athr_active = 0;
}
</script> </script>
</binding> </binding>
</key> </key>
@ -1317,6 +1320,12 @@
if (getprop("/it-autoflight/output/ap2") == 1) { if (getprop("/it-autoflight/output/ap2") == 1) {
setprop("/it-autoflight/input/ap2", 0); setprop("/it-autoflight/input/ap2", 0);
} }
if (libraries.ap1_active == 1) {
libraries.ap1_active = 0;
}
if (libraries.ap2_active == 1) {
libraries.ap2_active = 0;
}
</script> </script>
</binding> </binding>
</key> </key>

View file

@ -132,6 +132,17 @@ var messages_right_memo = func {
land_asap_a.active = 0; land_asap_a.active = 0;
} }
if (libraries.ap1_active == 1 or libraries.ap2_active == 1) {
ap_off.active = 1;
} else {
ap_off.active = 0;
}
if (libraries.athr_active == 1) {
athr_off.active = 1;
} else {
athr_off.active = 0;
}
if ((getprop("/ECAM/warning-phase") >= 2 and getprop("/ECAM/warning-phase") <= 7) and getprop("controls/flight/speedbrake") != 0) { if ((getprop("/ECAM/warning-phase") >= 2 and getprop("/ECAM/warning-phase") <= 7) and getprop("controls/flight/speedbrake") != 0) {
spd_brk.active = 1; spd_brk.active = 1;
} else { } else {

View file

@ -41,6 +41,9 @@ var ENGCounting = 0;
var flapLever = 0; var flapLever = 0;
var CRZTime = 0; var CRZTime = 0;
var CRZCondition = 0; var CRZCondition = 0;
var ap1_active = 0;
var ap2_active = 0;
var athr_active = 0;
setprop("/ECAM/left-msg", "NONE"); setprop("/ECAM/left-msg", "NONE");
setprop("/position/gear-agl-ft", 0); setprop("/position/gear-agl-ft", 0);
# w = White, b = Blue, g = Green, a = Amber, r = Red # w = White, b = Blue, g = Green, a = Amber, r = Red
@ -73,6 +76,12 @@ var ECAM = {
setprop("/ECAM/Lower/light/wheel", 0); setprop("/ECAM/Lower/light/wheel", 0);
setprop("/ECAM/warning-phase", 1); setprop("/ECAM/warning-phase", 1);
setprop("/ECAM/warning-phase-10-time", 0); setprop("/ECAM/warning-phase-10-time", 0);
setprop("/ECAM/ap1-off-time", 0);
setprop("/ECAM/ap2-off-time", 0);
setprop("/ECAM/athr-off-time", 0);
var ap1_off_time = getprop("/ECAM/ap1-off-time");
var ap2_off_time = getprop("/ECAM/ap2-off-time");
var athr_off_time = getprop("/ECAM/athr-off-time");
LowerECAM.reset(); LowerECAM.reset();
}, },
MSGclr: func() { MSGclr: func() {
@ -185,6 +194,19 @@ var ECAM = {
} }
} }
# AP / ATHR warnings
if (ap1_active == 1 and (getprop("/ECAM/ap1-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) {
ap1_active = 0;
}
if (ap2_active == 1 and (getprop("/ECAM/ap2-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) {
ap2_active = 0;
}
if (athr_active == 1 and (getprop("/ECAM/athr-off-time") + 9 < getprop("/sim/time/elapsed-sec"))) {
athr_active = 0;
}
# Warning Phases # Warning Phases
if (getprop("/systems/electrical/bus/ac1") < 110 and getprop("/systems/electrical/bus/ac2") < 110 and getprop("/systems/electrical/bus/ac-ess") < 110) { # Reset warning phases if (getprop("/systems/electrical/bus/ac1") < 110 and getprop("/systems/electrical/bus/ac2") < 110 and getprop("/systems/electrical/bus/ac-ess") < 110) { # Reset warning phases
if (getprop("/ECAM/warning-phase") != 1) { if (getprop("/ECAM/warning-phase") != 1) {
@ -411,3 +433,26 @@ var LowerECAM = {
setprop("/ECAM/Lower/light/wheel", 0); setprop("/ECAM/Lower/light/wheel", 0);
}, },
}; };
# Logic for autopilot disconnect warning
setlistener("/it-autoflight/input/ap1", func {
if (getprop("/it-autoflight/input/ap1") == 0) {
ap1_active = 1;
setprop("/ECAM/ap1-off-time", getprop("/sim/time/elapsed-sec"));
}
}, 0, 0);
setlistener("/it-autoflight/input/ap2", func {
if (getprop("/it-autoflight/input/ap2") == 0) {
ap2_active = 1;
setprop("/ECAM/ap2-off-time", getprop("/sim/time/elapsed-sec"));
}
}, 0, 0);
setlistener("/it-autoflight/input/athr", func {
if (getprop("/it-autoflight/input/athr") == 0) {
athr_active = 1;
setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec"));
}
}, 0, 0);

View file

@ -170,9 +170,15 @@ setlistener("/it-autoflight/input/athr", func {
var atmas = getprop("/it-autoflight/input/athr"); var atmas = getprop("/it-autoflight/input/athr");
if (atmas == 0) { if (atmas == 0) {
setprop("/it-autoflight/output/athr", 0); setprop("/it-autoflight/output/athr", 0);
if (getprop("/it-autoflight/sound/enableathrsound") == 1 and getprop("/it-autoflight/output/athr") == 0) {
setprop("/it-autoflight/sound/athrsound", 1);
setprop("/it-autoflight/sound/enableathrsound", 0);
}
} else if (atmas == 1) { } else if (atmas == 1) {
thrustmode(); thrustmode();
setprop("/it-autoflight/output/athr", 1); setprop("/it-autoflight/output/athr", 1);
setprop("/it-autoflight/sound/athrsound", 0);
setprop("/it-autoflight/sound/enableathrsound", 1);
} }
}); });

View file

@ -553,7 +553,7 @@ var lightsLoop = maketimer(0.2, func {
if (getprop("/controls/lighting/no-smoking-sign") == 0) { if (getprop("/controls/lighting/no-smoking-sign") == 0) {
setprop("/controls/lighting/no-smoking-sign", 1); setprop("/controls/lighting/no-smoking-sign", 1);
} }
} elsif (getprop("controls/switches/no-smoking-sign") == 0.5 and getprop("gear/gear[0]/position-norm") != 0) { } elsif (getprop("controls/switches/no-smoking-sign") == 0.5 and getprop("gear/gear[0]/position-norm") != 0) { # todo: should be when uplocks not engaged
if (getprop("/controls/lighting/no-smoking-sign") == 0) { if (getprop("/controls/lighting/no-smoking-sign") == 0) {
setprop("/controls/lighting/no-smoking-sign", 1); setprop("/controls/lighting/no-smoking-sign", 1);
} }

View file

@ -840,6 +840,23 @@
</volume> </volume>
</apoff> </apoff>
<apoff>
<name>athroff</name>
<path>/Aircraft/IDG-A32X/Sounds/Cockpit/chime.wav</path>
<condition>
<and>
<equals>
<property>/it-autoflight/output/athr</property>
<value>0</value>
</equals>
<property>/it-autoflight/sound/athrsound</property>
</and>
</condition>
<volume>
<factor>40.0</factor>
</volume>
</apoff>
<gear> <gear>
<name>gear0</name> <name>gear0</name>
<mode>in-transit</mode> <mode>in-transit</mode>