Refactor autopilot off warnings
This commit is contained in:
parent
240879e036
commit
e94861b94a
7 changed files with 51 additions and 50 deletions
|
@ -1065,7 +1065,6 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
if (getprop("/it-autoflight/output/athr") == 1) {
|
||||
setprop("/it-autoflight/input/athr", 0);
|
||||
libraries.athrOff("soft");
|
||||
setprop("/ECAM/warnings/master-caution-light", 1);
|
||||
} else {
|
||||
|
@ -1315,13 +1314,7 @@
|
|||
<command>nasal</command>
|
||||
<script>
|
||||
if (getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
|
||||
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);
|
||||
}
|
||||
libraries.apOff("soft","B");
|
||||
libraries.apOff("soft", 0);
|
||||
} else {
|
||||
if (getprop("/it-autoflight/sound/apoffsound") == 1 or getprop("/it-autoflight/sound/apoffsound2") == 1) {
|
||||
setprop("/it-autoflight/sound/apoffsound", 0);
|
||||
|
|
|
@ -4041,19 +4041,18 @@
|
|||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-toggle</command>
|
||||
<property>it-autoflight/input/ap1</property>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>setprop("/sim/sounde/btn1", 1);</script>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>if (getprop("/it-autoflight/output/ap1") == 0) {
|
||||
libraries.apOff("hard",1);
|
||||
}
|
||||
<script>
|
||||
if (getprop("/it-autoflight/input/ap1") == 0) {
|
||||
setprop("it-autoflight/input/ap1", 1);
|
||||
} else {
|
||||
libraries.apOff("hard", 1);
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
</action>
|
||||
|
@ -4081,19 +4080,18 @@
|
|||
<action>
|
||||
<button>0</button>
|
||||
<repeatable type="bool">false</repeatable>
|
||||
<binding>
|
||||
<command>property-toggle</command>
|
||||
<property>it-autoflight/input/ap2</property>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>setprop("/sim/sounde/btn1", 1);</script>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>if (getprop("/it-autoflight/output/ap1") == 0) {
|
||||
libraries.apOff("hard",2);
|
||||
}
|
||||
<script>
|
||||
if (getprop("/it-autoflight/input/ap2") == 0) {
|
||||
setprop("it-autoflight/input/ap2", 1);
|
||||
} else {
|
||||
libraries.apOff("hard", 2);
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
</action>
|
||||
|
@ -4121,17 +4119,19 @@
|
|||
<action>
|
||||
<button>0</button>
|
||||
<repeatable>false</repeatable>
|
||||
<binding>
|
||||
<command>property-toggle</command>
|
||||
<property>it-autoflight/input/athr</property>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>setprop("/sim/sounde/btn1", 1);</script>
|
||||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>libraries.athrOff("hard");</script>
|
||||
<script>
|
||||
if (getprop("/it-autoflight/input/athr") == 0) {
|
||||
setprop("it-autoflight/input/athr", 1);
|
||||
} else {
|
||||
libraries.athrOff("hard");
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
</action>
|
||||
</animation>
|
||||
|
|
|
@ -157,10 +157,10 @@ var ECAM = {
|
|||
|
||||
if (stateL == 3 and stateR == 3 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec") and getprop("/ECAM/to-memo-enable") == 1 and wow == 1) {
|
||||
setprop("/ECAM/left-msg", "TO-MEMO");
|
||||
} else if (getprop("/ECAM/ldg-memo-enable") == 1) {
|
||||
} elsif (getprop("/ECAM/ldg-memo-enable") == 1) {
|
||||
setprop("/ECAM/left-msg", "LDG-MEMO");
|
||||
} else if (getprop("/ECAM/show-left-msg") == 1) {
|
||||
setprop("/ECAM/left-msg", "MSG");
|
||||
} elsif (getprop("/ECAM/show-left-msg") == 1) {
|
||||
setprop("/ECAM/left-msg", "MSG"); # messages should have priority over memos - how?
|
||||
} else {
|
||||
setprop("/ECAM/left-msg", "NONE");
|
||||
}
|
||||
|
|
|
@ -251,27 +251,40 @@ var decreaseManVS = func {
|
|||
}
|
||||
|
||||
var apOff = func(type, side) {
|
||||
if ((side == 1 and getprop("/it-autoflight/output/ap1") == 1) or (side == 2 and getprop("/it-autoflight/output/ap2") == 1)) {
|
||||
setprop("/it-autoflight/output/ap-warning", 0);
|
||||
return;
|
||||
if (side == 0) {
|
||||
setprop("/it-autoflight/input/ap1", 0);
|
||||
setprop("/it-autoflight/input/ap2", 0);
|
||||
} elsif (side == 1) {
|
||||
setprop("/it-autoflight/input/ap1", 0);
|
||||
} elsif (side == 2) {
|
||||
setprop("/it-autoflight/input/ap2", 0);
|
||||
}
|
||||
|
||||
if (type == "soft") {
|
||||
apWarn(type);
|
||||
}
|
||||
|
||||
var apWarn = func(type) {
|
||||
if (type == "none") {
|
||||
return;
|
||||
} elsif (type == "soft") {
|
||||
setprop("/ECAM/ap-off-time", getprop("/sim/time/elapsed-sec"));
|
||||
setprop("/it-autoflight/output/ap-warning", 1);
|
||||
setprop("/ECAM/warnings/master-warning-light", 1);
|
||||
} else {
|
||||
setprop("/it-autoflight/output/ap-warning", 2);
|
||||
# master warning handled by warning system in this case
|
||||
libraries.LowerECAM.clrLight();
|
||||
}
|
||||
}
|
||||
|
||||
var athrOff = func(type) {
|
||||
if (getprop("it-autoflight/output/athr") == 1) {
|
||||
setprop("/it-autoflight/output/athr-warning", 0);
|
||||
return;
|
||||
}
|
||||
if (type == "soft") {
|
||||
setprop("/it-autoflight/input/athr", 0);
|
||||
athrWarn(type);
|
||||
}
|
||||
|
||||
var athrWarn = func(type) {
|
||||
if (type == "none") {
|
||||
return;
|
||||
} elsif (type == "soft") {
|
||||
setprop("/ECAM/athr-off-time", getprop("/sim/time/elapsed-sec"));
|
||||
setprop("/it-autoflight/output/athr-warning", 1);
|
||||
} else {
|
||||
|
|
|
@ -194,10 +194,11 @@ var atoff_request = func {
|
|||
state1 = getprop("/systems/thrust/state1");
|
||||
state2 = getprop("/systems/thrust/state2");
|
||||
if ((state1 == "IDLE") and (state2 == "IDLE") and (getprop("/systems/thrust/alpha-floor") == 0) and (getprop("/systems/thrust/toga-lk") == 0)) {
|
||||
if (getprop("/it-autoflight/output/athr") == 1 and getprop("/position/gear-agl-ft") > 50) {
|
||||
if (getprop("/it-autoflight/input/athr") == 1 and getprop("/position/gear-agl-ft") > 50) {
|
||||
libraries.athrOff("soft");
|
||||
} elsif (getprop("/position/gear-agl-ft") < 50) {
|
||||
libraries.athrOff("none");
|
||||
}
|
||||
setprop("/it-autoflight/input/athr", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -208,12 +208,6 @@ var update_loop = func {
|
|||
if (getprop("/it-fbw/protections/overspeed") != 1) {
|
||||
setprop("/it-fbw/protections/overspeed", 1);
|
||||
}
|
||||
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);
|
||||
}
|
||||
libraries.apOff("hard", 0);
|
||||
} else {
|
||||
if (getprop("/it-fbw/protections/overspeed") != 0) {
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>libraries.apOff("hard",1);</script>
|
||||
<script>libraries.apOff("hard", 1);</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</binding>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>libraries.apOff("hard",2);</script>
|
||||
<script>libraries.apOff("hard", 2);</script>
|
||||
</binding>
|
||||
</button>
|
||||
<button>
|
||||
|
|
Reference in a new issue