Added Manual LECAM page select logic

Signed-off-by: merspieler <merspieler@airmail.cc>
This commit is contained in:
merspieler 2018-09-14 11:35:00 +02:00
parent aea8bb1e52
commit d970754180
2 changed files with 51 additions and 16 deletions

View file

@ -1074,7 +1074,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(sts);</script>
<script>libraries.LowerECAM.button("sts");</script>
</binding>
</action>
</animation>
@ -1093,7 +1093,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(apu);</script>
<script>libraries.LowerECAM.button("apu");</script>
</binding>
</action>
</animation>
@ -1112,7 +1112,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(bleed);</script>
<script>libraries.LowerECAM.button("bleed");</script>
</binding>
</action>
</animation>
@ -1131,7 +1131,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(press);</script>
<script>libraries.LowerECAM.button("press");</script>
</binding>
</action>
</animation>
@ -1150,7 +1150,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(elec);</script>
<script>libraries.LowerECAM.button("elec");</script>
</binding>
</action>
</animation>
@ -1169,7 +1169,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(hyd);</script>
<script>libraries.LowerECAM.button("hyd");</script>
</binding>
</action>
</animation>
@ -1188,7 +1188,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(fuel);</script>
<script>libraries.LowerECAM.button("fuel");</script>
</binding>
</action>
</animation>
@ -1207,7 +1207,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(eng);</script>
<script>libraries.LowerECAM.button("eng");</script>
</binding>
</action>
</animation>
@ -1226,7 +1226,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(cond);</script>
<script>libraries.LowerECAM.button("cond");</script>
</binding>
</action>
</animation>
@ -1245,7 +1245,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(door);</script>
<script>libraries.LowerECAM.button("door");</script>
</binding>
</action>
</animation>
@ -1264,7 +1264,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(wheel);</script>
<script>libraries.LowerECAM.button("wheel");</script>
</binding>
</action>
</animation>
@ -1283,7 +1283,7 @@
</greater-than-equals>
</condition>
<command>nasal</command>
<script>libraries.LowerECAM.button(fctl);</script>
<script>libraries.LowerECAM.button("fctl");</script>
</binding>
</action>
</animation>

View file

@ -16,7 +16,8 @@ var ECAM = {
setprop("/ECAM/to-memo-enable", 1);
setprop("/ECAM/to-config", 0);
setprop("/ECAM/ldg-memo-enable", 0);
setprop("/ECAM/Lower/page", "");
setprop("/ECAM/Lower/page", "door");
setprop("/ECAM/Lower/man-select", 0);
setprop("/ECAM/Lower/light/apu", 0);
setprop("/ECAM/Lower/light/bleed", 0);
setprop("/ECAM/Lower/light/cond", 0);
@ -155,12 +156,46 @@ ECAM.MSGclr();
var LowerECAM = {
button: func(b) {
var man_sel = getprop("/ECAM/Lower/man-select");
if(!man_sel) {
setprop("/ECAM/Lower/man-select", 1);
setprop("/ECAM/Lower/page", b);
setprop("/ECAM/Lower/light/" ~ b, 1);
} else {
if(b == getprop("/ECAM/Lower/page")) {
setprop("/ECAM/Lower/man-select", 0);
LowerECAM.loop();
setprop("/ECAM/Lower/light/" ~ b, 0);
} else {
setprop("/ECAM/Lower/light/" ~ getprop("/ECAM/Lower/page"), 0);
setprop("/ECAM/Lower/page", b);
setprop("/ECAM/Lower/light/" ~ b, 1);
}
}
},
loop: func() {
var man_sel = getprop("/ECAM/Lower/man-select");
if(!man_sel) {
setprop("/ECAM/Lower/page", "crz");
#TODO auto select page
}
},
reset: func() {
setprop("/ECAM/Lower/page", "door");
setprop("/ECAM/Lower/man-select", 0);
setprop("/ECAM/Lower/light/apu", 0);
setprop("/ECAM/Lower/light/bleed", 0);
setprop("/ECAM/Lower/light/cond", 0);
setprop("/ECAM/Lower/light/door", 0);
setprop("/ECAM/Lower/light/elec", 0);
setprop("/ECAM/Lower/light/eng", 0);
setprop("/ECAM/Lower/light/fctl", 0);
setprop("/ECAM/Lower/light/fuel", 0);
setprop("/ECAM/Lower/light/hyd", 0);
setprop("/ECAM/Lower/light/press", 0);
setprop("/ECAM/Lower/light/sts", 0);
setprop("/ECAM/Lower/light/wheel", 0);
},
};