Add Eng Out ACC and make it work

This commit is contained in:
Joshua Davidson 2017-05-27 00:15:06 -04:00
parent e8b91aba78
commit d398f177b2
5 changed files with 422 additions and 283 deletions

View file

@ -641,30 +641,6 @@
<text>
<name>eoaccel</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
<z-m>0.030</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">[ ]</format>
<truncate type="bool">false</truncate>
<font type="string">helvetica_medium.txf</font>
<property>autopilot/serviceable</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0040</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>eoaccel2</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
@ -687,6 +663,70 @@
</font-resolution>
</text>
<text>
<name>eoaccel2</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
<z-m>0.030</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/eng-out-reduc</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0040</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>eoaccel3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
<z-m>0.030</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/eng-out-reduc</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>eoaccel2</object-name>
<condition>
<not><property>/MCDUC/reducacc-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>eoaccel3</object-name>
<condition>
<property>/MCDUC/reducacc-set</property>
</condition>
</animation>
<text>
<name>thredacc</name>
<offsets>
@ -1023,7 +1063,7 @@
<object-name>flex</object-name>
<object-name>thredacc</object-name>
<object-name>flapsmcdu</object-name>
<object-name>eoaccel2</object-name>
<object-name>eoaccel</object-name>
<object-name>flprtr</object-name>
<object-name>sltrtr</object-name>
<object-name>clean</object-name>
@ -1116,7 +1156,8 @@
<object-name>flapsmcdu2</object-name>
<object-name>flapsmcdu3</object-name>
<object-name>trans2</object-name>
<object-name>eoaccel</object-name>
<object-name>eoaccel2</object-name>
<object-name>eoaccel3</object-name>
<object-name>thred</object-name>
<object-name>thred2</object-name>
<object-name>flex2</object-name>

View file

@ -641,30 +641,6 @@
<text>
<name>eoaccel</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
<z-m>0.030</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">[ ]</format>
<truncate type="bool">false</truncate>
<font type="string">helvetica_medium.txf</font>
<property>autopilot/serviceable</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0040</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>eoaccel2</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
@ -687,6 +663,70 @@
</font-resolution>
</text>
<text>
<name>eoaccel2</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
<z-m>0.030</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/eng-out-reduc</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0040</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<text>
<name>eoaccel3</name>
<offsets>
<x-m>-0.001</x-m>
<y-m>0.045</y-m>
<z-m>0.030</z-m>
</offsets>
<alignment>right-center</alignment>
<axis-alignment>yz-plane</axis-alignment>
<type type="string">text-value</type>
<format type="string">%s</format>
<truncate type="bool">false</truncate>
<font type="string">BoeingCDU-Large.ttf</font>
<property>/FMGC/internal/eng-out-reduc</property>
<draw-text type="bool">true</draw-text>
<draw-alignment type="bool">false</draw-alignment>
<draw-boundingbox type="bool">false</draw-boundingbox>
<character-size>0.0050</character-size>
<font-resolution>
<width type="int">64</width>
<height type="int">64</height>
</font-resolution>
</text>
<animation>
<type>select</type>
<object-name>eoaccel2</object-name>
<condition>
<not><property>/MCDUC/reducacc-set</property></not>
</condition>
</animation>
<animation>
<type>select</type>
<object-name>eoaccel3</object-name>
<condition>
<property>/MCDUC/reducacc-set</property>
</condition>
</animation>
<text>
<name>thredacc</name>
<offsets>
@ -1023,7 +1063,7 @@
<object-name>flex</object-name>
<object-name>thredacc</object-name>
<object-name>flapsmcdu</object-name>
<object-name>eoaccel2</object-name>
<object-name>eoaccel</object-name>
<object-name>flprtr</object-name>
<object-name>sltrtr</object-name>
<object-name>clean</object-name>
@ -1116,7 +1156,8 @@
<object-name>flapsmcdu2</object-name>
<object-name>flapsmcdu3</object-name>
<object-name>trans2</object-name>
<object-name>eoaccel</object-name>
<object-name>eoaccel2</object-name>
<object-name>eoaccel3</object-name>
<object-name>thred</object-name>
<object-name>thred2</object-name>
<object-name>flex2</object-name>

View file

@ -12,6 +12,7 @@ var FMGCinit = func {
setprop("/FMGC/status/phase", "0"); # 0 is preflight 1 takeoff 2 climb 3 cruise 4 descent 5 approach 6 go around 7 done
setprop("/FMGC/internal/tropo", 36090);
phasecheck.start();
various.start();
}
#############
@ -62,7 +63,7 @@ setlistener("/FMGC/internal/cruise-ft", func {
# Flight Phase #
################
var phasecheck = maketimer(0.2, func {
var phasecheck = maketimer(0.2, func {
var n1_left = getprop("/engines/engine[0]/n1");
var n1_right = getprop("/engines/engine[1]/n1");
var flaps = getprop("/controls/flight/flap-pos");
@ -103,7 +104,7 @@ var phasecheck = maketimer(0.2, func {
if ((phase == "6") and ((vertmode == "G/A CLB") or (vertmode == "SPD CLB") or (vertmode == "CLB") or ((vertmode == "V/S") and (targetvs > 0)) or ((vertmode == "FPA") and (targetfpa > 0))) and (alt <= targetalt)) {
setprop("/FMGC/status/phase", "2"); # going to CLIMB mode from GA
}
if ((wowl and wowr) and (gs < 20) and (phase == "5")) { # below twenty knots.
if ((wowl and wowr) and (gs < 20) and (phase == "5")) {
setprop("/FMGC/status/phase", "7");
settimer(func {
itaf.ap_init();
@ -113,4 +114,14 @@ var phasecheck = maketimer(0.2, func {
}, 20);
}
});
var various = maketimer(1, func {
if (getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") != 3) {
setprop("/it-autoflight/settings/reduc-agl-ft", getprop("/FMGC/internal/eng-out-reduc"));
} else if (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") == 3) {
setprop("/it-autoflight/settings/reduc-agl-ft", getprop("/FMGC/internal/eng-out-reduc"));
} else {
setprop("/it-autoflight/settings/reduc-agl-ft", getprop("/FMGC/internal/reduc-agl-ft"));
}
});

View file

@ -14,6 +14,7 @@ var MCDU_reset = func {
setprop("/MCDU[0]/scratchpad", "");
setprop("/MCDUC/flight-num", "");
setprop("/MCDUC/thracc-set", 0);
setprop("/MCDUC/reducacc-set", 0);
setprop("/MCDUC/flight-num-set", 0);
setprop("/FMGC/internal/flex", 0);
setprop("/FMGC/internal/dep-arpt", "");
@ -22,6 +23,8 @@ var MCDU_reset = func {
setprop("/FMGC/internal/cruise-fl", 100);
setprop("/FMGC/internal/cost-index", "0");
setprop("/FMGC/internal/trans-alt", 18000);
setprop("/FMGC/internal/reduc-agl-ft", "3000");
setprop("/FMGC/internal/eng-out-reduc", "3500");
setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/v2", 0);
@ -96,6 +99,10 @@ var rskbutton = func(btn) {
if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R4");
}
} else if (btn == "5") {
if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R5");
}
} else if (btn == "6") {
if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R6");
@ -300,7 +307,7 @@ var PerfTOInput = func(key) {
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/systems/thrust/clbreduc-ft", "1500");
setprop("/it-autoflight/settings/reduc-agl-ft", "3000");
setprop("/FMGC/internal/reduc-agl-ft", "3000");
setprop("/MCDUC/thracc-set", 0);
setprop("/MCDU[0]/scratchpad", "");
} else {
@ -311,7 +318,7 @@ var PerfTOInput = func(key) {
var acc = size(thracc[1]);
if ((thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) {
setprop("/systems/thrust/clbreduc-ft", thracc[0]);
setprop("/it-autoflight/settings/reduc-agl-ft", thracc[1]);
setprop("/FMGC/internal/reduc-agl-ft", thracc[1]);
setprop("/MCDUC/thracc-set", 1);
setprop("/MCDU[0]/scratchpad", "");
} else {
@ -372,6 +379,22 @@ var PerfTOInput = func(key) {
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/eng-out-reduc", "3500");
setprop("/MCDUC/reducacc-set", 0);
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 5) {
setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("/MCDUC/reducacc-set", 1);
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
}
}

View file

@ -3,17 +3,18 @@
##################################################################
var MCDU_init = func {
setprop("/MCDU[1]/brightness", "1.0");
setprop("/MCDU[0]/brightness", "1.0");
MCDU_reset(); # Reset MCDU, clears data
}
var MCDU_reset = func {
setprop("/it-autoflight/settings/togaspd", 157);
setprop("/MCDU[1]/last-fmgc-page", "STATUS");
setprop("/MCDU[1]/page", "STATUS");
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/last-fmgc-page", "STATUS");
setprop("/MCDU[0]/page", "STATUS");
setprop("/MCDU[0]/scratchpad", "");
setprop("/MCDUC/flight-num", "");
setprop("/MCDUC/thracc-set", 0);
setprop("/MCDUC/reducacc-set", 0);
setprop("/MCDUC/flight-num-set", 0);
setprop("/FMGC/internal/flex", 0);
setprop("/FMGC/internal/dep-arpt", "");
@ -22,6 +23,8 @@ var MCDU_reset = func {
setprop("/FMGC/internal/cruise-fl", 100);
setprop("/FMGC/internal/cost-index", "0");
setprop("/FMGC/internal/trans-alt", 18000);
setprop("/FMGC/internal/reduc-agl-ft", "3000");
setprop("/FMGC/internal/eng-out-reduc", "3500");
setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/v2", 0);
@ -39,43 +42,43 @@ var MCDU_reset = func {
var lskbutton = func(btn) {
if (btn == "1") {
if (getprop("/MCDU[1]/page") == "MCDU") {
setprop("/MCDU[1]/page", getprop("/MCDU[1]/last-fmgc-page"));
} else if (getprop("/MCDU[1]/page") == "TO") {
if (getprop("/MCDU[0]/page") == "MCDU") {
setprop("/MCDU[0]/page", getprop("/MCDU[0]/last-fmgc-page"));
} else if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("L1");
}
} else if (btn == "2") {
if (getprop("/MCDU[1]/page") == "INITA") {
if (getprop("/MCDU[0]/page") == "INITA") {
PerfInput("L2");
} else if (getprop("/MCDU[1]/page") == "TO") {
} else if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("L2");
}
} else if (btn == "3") {
if (getprop("/MCDU[1]/page") == "INITA") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("L3");
} else if (getprop("/MCDU[1]/page") == "TO") {
} else if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("L3");
}
} else if (btn == "4") {
if (getprop("/MCDU[1]/page") == "DATA") {
setprop("/MCDU[1]/page", "STATUS");
} else if (getprop("/MCDU[1]/page") == "TO") {
if (getprop("/MCDU[0]/page") == "DATA") {
setprop("/MCDU[0]/page", "STATUS");
} else if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("L4");
}
} else if (btn == "5") {
if (getprop("/MCDU[1]/page") == "INITA") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("L5");
} else if (getprop("/MCDU[1]/page") == "TO") {
} else if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("L5");
} else if (getprop("/MCDU[1]/page") == "CLB") {
} else if (getprop("/MCDU[0]/page") == "CLB") {
perfCLBInput("L5");
}
} else if (btn == "6") {
if (getprop("/MCDU[1]/page") == "INITA") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("L6");
} else if (getprop("/MCDU[1]/page") == "CLB") {
} else if (getprop("/MCDU[0]/page") == "CLB") {
perfCLBInput("L6");
} else if (getprop("/MCDU[1]/page") == "CRZ") {
} else if (getprop("/MCDU[0]/page") == "CRZ") {
perfCRZInput("L6");
}
}
@ -83,70 +86,74 @@ var lskbutton = func(btn) {
var rskbutton = func(btn) {
if (btn == "1") {
if (getprop("/MCDU[1]/page") == "INITA") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("R1");
}
} else if (btn == "3") {
if (getprop("/MCDU[1]/page") == "INITA") {
if (getprop("/MCDU[0]/page") == "INITA") {
initInputA("R3");
} else if (getprop("/MCDU[1]/page") == "TO") {
} else if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R3");
}
} else if (btn == "4") {
if (getprop("/MCDU[1]/page") == "TO") {
if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R4");
}
} else if (btn == "5") {
if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R5");
}
} else if (btn == "6") {
if (getprop("/MCDU[1]/page") == "TO") {
if (getprop("/MCDU[0]/page") == "TO") {
PerfTOInput("R6");
} else if (getprop("/MCDU[1]/page") == "CLB") {
} else if (getprop("/MCDU[0]/page") == "CLB") {
perfCLBInput("R6");
} # else if (getprop("/MCDU[1]/page") == "CRZ") {
} # else if (getprop("/MCDU[0]/page") == "CRZ") {
# perfCRZInput("R6");
#}
}
}
var initInputA = func(key) {
var scratchpad = getprop("/MCDU[1]/scratchpad");
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (key == "L3") {
if (scratchpad == "CLR") {
setprop("/MCDUC/flight-num", "");
setprop("/MCDUC/flight-num-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var flts = size(scratchpad);
if (flts >= 1 and flts <= 8) {
setprop("/MCDUC/flight-num", scratchpad);
setprop("/MCDUC/flight-num-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci == nil) {
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
} else if (ci >= 0 and ci <= 120) {
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L6") {
@ -154,25 +161,25 @@ var initInputA = func(key) {
setprop("/FMGC/internal/cruise-ft", 10000);
setprop("/FMGC/internal/cruise-fl", 100);
setprop("/FMGC/internal/cruise-lvl-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var crz = int(scratchpad);
var crzs = size(scratchpad);
if (crzs >= 1 and crzs <= 3) {
if (crz == nil) {
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
} else if (crz > 0 and crz <= 430) {
setprop("/FMGC/internal/cruise-ft", crz * 100);
setprop("/FMGC/internal/cruise-fl", crz);
setprop("/FMGC/internal/cruise-lvl-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R1") {
@ -181,7 +188,7 @@ var initInputA = func(key) {
setprop("/FMGC/internal/arr-arpt", "");
setprop("/FMGC/internal/tofrom-set", 0);
fmgc.updateARPT();
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 9) {
@ -193,15 +200,15 @@ var initInputA = func(key) {
setprop("/FMGC/internal/arr-arpt", fromto[1]);
setprop("/FMGC/internal/tofrom-set", 1);
fmgc.updateARPT();
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "GPS PRIMARY");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "GPS PRIMARY");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R3") {
@ -212,47 +219,47 @@ var initInputA = func(key) {
}
var PerfTOInput = func(key) {
var scratchpad = getprop("/MCDU[1]/scratchpad");
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/v1-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (scratchpad >= 100 and scratchpad <= 200) {
setprop("/FMGC/internal/v1", scratchpad);
setprop("/FMGC/internal/v1-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L2") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/vr-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (scratchpad >= 100 and scratchpad <= 200) {
setprop("/FMGC/internal/vr", scratchpad);
setprop("/FMGC/internal/vr-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L3") {
@ -260,7 +267,7 @@ var PerfTOInput = func(key) {
setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/v2-set", 0);
setprop("/it-autoflight/settings/togaspd", 157);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
@ -268,41 +275,41 @@ var PerfTOInput = func(key) {
setprop("/FMGC/internal/v2", scratchpad);
setprop("/FMGC/internal/v2-set", 1);
setprop("/it-autoflight/settings/togaspd", scratchpad + 15);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L4") {
if (scratchpad == "CLR") {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
} else {
var tfs = size(scratchpad);
if (tfs == 4 or tfs == 5) {
if (scratchpad >= 1000 and scratchpad <= 18000) {
setprop("/FMGC/internal/trans-alt", scratchpad);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/systems/thrust/clbreduc-ft", "1500");
setprop("/it-autoflight/settings/reduc-agl-ft", "3000");
setprop("/FMGC/internal/reduc-agl-ft", "3000");
setprop("/MCDUC/thracc-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 9) {
@ -311,26 +318,26 @@ var PerfTOInput = func(key) {
var acc = size(thracc[1]);
if ((thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) {
setprop("/systems/thrust/clbreduc-ft", thracc[0]);
setprop("/it-autoflight/settings/reduc-agl-ft", thracc[1]);
setprop("/FMGC/internal/reduc-agl-ft", thracc[1]);
setprop("/MCDUC/thracc-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R6") {
setprop("/MCDU[1]/page", "CLB");
setprop("/MCDU[0]/page", "CLB");
} else if (key == "R3") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/flap-ths-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 7) {
@ -339,21 +346,21 @@ var PerfTOInput = func(key) {
setprop("/FMGC/internal/to-flap", flapths[0]);
setprop("/FMGC/internal/to-ths", flapths[1]);
setprop("/FMGC/internal/flap-ths-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R4") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/flex", 0);
setprop("/FMGC/internal/flex-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs == 1 or tfs == 2) {
@ -362,83 +369,99 @@ var PerfTOInput = func(key) {
setprop("/FMGC/internal/flex-set", 1);
var flex_calc = getprop("/FMGC/internal/flex") - getprop("/environment/temperature-degc");
setprop("/FMGC/internal/flex-cmd", flex_calc);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "R5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/eng-out-reduc", "3500");
setprop("/MCDUC/reducacc-set", 0);
setprop("/MCDU[0]/scratchpad", "");
} else {
var tfs = size(scratchpad);
if (tfs >= 3 and tfs <= 5) {
setprop("/FMGC/internal/eng-out-reduc", scratchpad);
setprop("/MCDUC/reducacc-set", 1);
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
}
}
var perfCLBInput = func(key) {
var scratchpad = getprop("/MCDU[1]/scratchpad");
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci == nil) {
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
} else if (ci >= 0 and ci <= 120) {
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[0]/scratchpad", "");
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
} else {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "NOT ALLOWED");
}
}
} else if (key == "L6") {
setprop("/MCDU[1]/page", "TO");
setprop("/MCDU[0]/page", "TO");
} else if (key == "R6") {
setprop("/MCDU[1]/page", "CRZ");
setprop("/MCDU[0]/page", "CRZ");
}
}
var perfCRZInput = func(key) {
if (key == "L6") {
setprop("/MCDU[1]/page", "CLB");
setprop("/MCDU[0]/page", "CLB");
}
# if (key == "R6") {
# setprop("/MCDU[1]/page", "DES");
# setprop("/MCDU[0]/page", "DES");
# }
}
var arrowbutton = func(btn) {
if (btn == "left") {
if (getprop("/MCDU[1]/page") == "DATA") {
setprop("/MCDU[1]/page", "DATA2");
} else if (getprop("/MCDU[1]/page") == "DATA2") {
setprop("/MCDU[1]/page", "DATA");
if (getprop("/MCDU[0]/page") == "DATA") {
setprop("/MCDU[0]/page", "DATA2");
} else if (getprop("/MCDU[0]/page") == "DATA2") {
setprop("/MCDU[0]/page", "DATA");
}
if (getprop("/MCDU[1]/page") == "INITA") {
setprop("/MCDU[1]/page", "INITB");
} else if (getprop("/MCDU[1]/page") == "INITB") {
setprop("/MCDU[1]/page", "INITA");
if (getprop("/MCDU[0]/page") == "INITA") {
setprop("/MCDU[0]/page", "INITB");
} else if (getprop("/MCDU[0]/page") == "INITB") {
setprop("/MCDU[0]/page", "INITA");
}
} else if (btn == "right") {
if (getprop("/MCDU[1]/page") == "DATA") {
setprop("/MCDU[1]/page", "DATA2");
} else if (getprop("/MCDU[1]/page") == "DATA2") {
setprop("/MCDU[1]/page", "DATA");
if (getprop("/MCDU[0]/page") == "DATA") {
setprop("/MCDU[0]/page", "DATA2");
} else if (getprop("/MCDU[0]/page") == "DATA2") {
setprop("/MCDU[0]/page", "DATA");
}
if (getprop("/MCDU[1]/page") == "INITA") {
setprop("/MCDU[1]/page", "INITB");
} else if (getprop("/MCDU[1]/page") == "INITB") {
setprop("/MCDU[1]/page", "INITA");
if (getprop("/MCDU[0]/page") == "INITA") {
setprop("/MCDU[0]/page", "INITB");
} else if (getprop("/MCDU[0]/page") == "INITB") {
setprop("/MCDU[0]/page", "INITA");
}
} else if (btn == "up") {
# Nothing for now
@ -450,163 +473,163 @@ var arrowbutton = func(btn) {
var pagebutton = func(btn) {
if (btn == "perf") {
if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) {
setprop("/MCDU[1]/page", "TO");
setprop("/MCDU[0]/page", "TO");
} else if (getprop("/FMGC/status/phase") == 2) {
setprop("/MCDU[1]/page", "CLB");
setprop("/MCDU[0]/page", "CLB");
} else if (getprop("/FMGC/status/phase") == 3) {
setprop("/MCDU[1]/page", "CRZ");
setprop("/MCDU[0]/page", "CRZ");
}
} else if (btn == "init") {
setprop("/MCDU[1]/page", "INITA");
setprop("/MCDU[0]/page", "INITA");
} else if (btn == "data") {
setprop("/MCDU[1]/page", "DATA");
setprop("/MCDU[0]/page", "DATA");
} else if (btn == "mcdu") {
setprop("/MCDU[1]/last-fmgc-page", getprop("/MCDU[1]/page"));
setprop("/MCDU[1]/page", "MCDU");
setprop("/MCDU[0]/last-fmgc-page", getprop("/MCDU[0]/page"));
setprop("/MCDU[0]/page", "MCDU");
}
}
var button = func(btn) {
var scratchpad = getprop("/MCDU[1]/scratchpad");
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (btn == "A") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "A");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "A");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "B") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "B");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "B");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "C") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "C");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "C");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "D") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "D");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "D");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "E") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "E");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "E");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "F") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "F");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "F");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "G") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "G");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "G");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "H") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "H");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "H");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "I") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "I");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "I");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "J") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "J");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "J");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "K") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "K");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "K");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "L") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "L");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "L");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "M") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "M");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "M");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "N") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "N");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "N");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "O") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "O");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "O");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "P") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "P");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "P");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "Q") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "Q");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "Q");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "R") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "R");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "R");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "S") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "S");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "S");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "T") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "T");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "T");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "U") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "U");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "U");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "V") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "V");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "V");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "W") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "W");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "W");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "X") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "X");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "X");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "Y") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "Y");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "Y");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "Z") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "Z");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "Z");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "SLASH") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "/");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "/");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "SP") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ " ");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ " ");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "CLR") {
var scratchpad = getprop("/MCDU[1]/scratchpad");
var scratchpad = getprop("/MCDU[0]/scratchpad");
if (size(scratchpad) == 0) {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "CLR");
} else if (getprop("/MCDU[1]/scratchpad-msg") == 1) {
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad-msg", "1");
setprop("/MCDU[0]/scratchpad", "CLR");
} else if (getprop("/MCDU[0]/scratchpad-msg") == 1) {
setprop("/MCDU[0]/scratchpad", "");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (size(scratchpad) > 0) {
setprop("/MCDU[1]/scratchpad", left(scratchpad, size(scratchpad)-1));
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", left(scratchpad, size(scratchpad)-1));
setprop("/MCDU[0]/scratchpad-msg", "0");
}
} else if (btn == "0") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "0");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "0");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "1") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "1");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "1");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "2") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "2");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "2");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "3") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "3");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "3");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "4") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "4");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "4");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "5") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "5");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "5");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "6") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "6");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "6");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "7") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "7");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "7");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "8") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "8");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "8");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "9") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "9");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "9");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "DOT") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ ".");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ ".");
setprop("/MCDU[0]/scratchpad-msg", "0");
} else if (btn == "PLUSMINUS") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "-");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[0]/scratchpad", scratchpad ~ "-");
setprop("/MCDU[0]/scratchpad-msg", "0");
}
}
var screenFlash = func(time) {
var page = getprop("/MCDU[1]/page");
setprop("/MCDU[1]/page", "NONE");
var page = getprop("/MCDU[0]/page");
setprop("/MCDU[0]/page", "NONE");
settimer(func {
setprop("/MCDU[1]/page", page);
setprop("/MCDU[0]/page", page);
}, time);
}