This repository has been archived on 2021-09-26. You can view files and clone it, but cannot push or open issues or pull requests.
IDG-A32X/Nasal/MCDU2/MCDU.nas

569 lines
20 KiB
Text
Raw Normal View History

2017-07-14 15:57:14 +00:00
# A3XX mCDU by Joshua Davidson (it0uchpods) and Jonathan Redpath
2017-11-16 19:29:08 +00:00
##############################################
# Copyright (c) Joshua Davidson (it0uchpods) #
##############################################
2017-06-30 15:45:41 +00:00
var MCDU_init = func {
setprop("/MCDU[1]/brightness", "1.0");
MCDU_reset(); # Reset MCDU, clears data
}
var MCDU_reset = func {
2017-07-31 19:37:11 +00:00
setprop("/MCDU[1]/active", 0);
2017-06-30 15:45:41 +00:00
setprop("/it-autoflight/settings/togaspd", 157);
setprop("/MCDU[1]/last-scratchpad", "");
setprop("/MCDU[1]/last-fmgc-page", "STATUS");
setprop("/MCDU[1]/page", "MCDU");
setprop("/MCDU[1]/scratchpad", "SELECT DESIRED SYSTEM");
setprop("/MCDU[1]/scratchpad-msg", 0);
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", "");
setprop("/FMGC/internal/arr-arpt", "");
setprop("/FMGC/internal/cruise-ft", 10000);
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);
setprop("/FMGC/internal/block", 0.0);
setprop("/FMGC/internal/zfw", 0);
setprop("/FMGC/internal/zfwcg", 55.1); # 25KG default
2017-06-30 15:45:41 +00:00
setprop("/FMGC/internal/v1-set", 0);
setprop("/FMGC/internal/vr-set", 0);
setprop("/FMGC/internal/v2-set", 0);
setprop("/FMGC/internal/block-set", 0);
setprop("/FMGC/internal/zfw-set", 0);
setprop("/FMGC/internal/zfwcg-set", 0);
2017-06-30 15:45:41 +00:00
setprop("/FMGC/internal/to-flap", 0);
setprop("/FMGC/internal/to-ths", "0.0");
setprop("/FMGC/internal/tofrom-set", 0);
setprop("/FMGC/internal/cost-index-set", 0);
setprop("/FMGC/internal/cruise-lvl-set", 0);
setprop("/FMGC/internal/flap-ths-set", 0);
setprop("/FMGC/internal/flex-set", 0);
setprop("/FMGC/internal/ils1freq-set", 0);
setprop("/FMGC/internal/ils1crs-set", 0);
2017-06-30 15:45:41 +00:00
setprop("/FMGC/internal/vor1freq-set", 0);
setprop("/FMGC/internal/vor1crs-set", 0);
setprop("/FMGC/internal/vor2freq-set", 0);
setprop("/FMGC/internal/vor2crs-set", 0);
setprop("/FMGC/internal/adf1freq-set", 0);
setprop("/FMGC/internal/adf2freq-set", 0);
2017-07-28 16:21:48 +00:00
setprop("/FMGC/internal/navdatabase", "01JAN-28JAN");
setprop("/FMGC/internal/navdatabase2", "29JAN-26FEB");
setprop("/FMGC/internal/navdatabasecode", "AB20170101");
setprop("/FMGC/internal/navdatabasecode2", "AB20170102");
2017-07-31 13:43:13 +00:00
setprop("/FMGC/print/mcdu/page1/L1auto", 0);
setprop("/FMGC/print/mcdu/page1/L2auto", 0);
setprop("/FMGC/print/mcdu/page1/L3auto", 0);
setprop("/FMGC/print/mcdu/page1/R1req", 0);
setprop("/FMGC/print/mcdu/page1/R2req", 0);
setprop("/FMGC/print/mcdu/page1/R3req", 0);
setprop("/FMGC/print/mcdu/page2/L1auto", 0);
setprop("/FMGC/print/mcdu/page2/L2auto", 0);
setprop("/FMGC/print/mcdu/page2/L3auto", 0);
setprop("/FMGC/print/mcdu/page2/L4auto", 0);
setprop("/FMGC/print/mcdu/page2/R1req", 0);
setprop("/FMGC/print/mcdu/page2/R2req", 0);
setprop("/FMGC/print/mcdu/page2/R3req", 0);
setprop("/FMGC/print/mcdu/page2/R4req", 0);
2017-08-01 14:02:36 +00:00
setprop("/FMGC/internal/tropo", 36090);
setprop("/FMGC/internal/tropo-set", 0);
2017-06-30 15:45:41 +00:00
}
var lskbutton = func(btn) {
if (btn == "1") {
if (getprop("/MCDU[1]/page") == "MCDU") {
if (getprop("/MCDU[1]/active") != 2) {
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "WAIT FOR SYSTEM RESPONSE");
setprop("/MCDU[1]/active", 1);
settimer(func(){
setprop("/MCDU[1]/page", getprop("/MCDU[1]/last-fmgc-page"));
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[1]/scratchpad-msg", "0");
setprop("/MCDU[1]/active", 2);
}, 2);
} else {
2017-07-31 19:37:11 +00:00
setprop("/MCDU[1]/page", getprop("/MCDU[1]/last-fmgc-page"));
setprop("/MCDU[1]/scratchpad", "");
setprop("/MCDU[1]/scratchpad-msg", "0");
}
2017-06-30 15:45:41 +00:00
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("L1");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("L1");
2017-07-28 14:59:23 +00:00
} else if (getprop("/MCDU[1]/page") == "DATA") {
dataInput("L1");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
2017-07-31 13:43:13 +00:00
printInput("L1");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L1");
} else {
2017-06-30 15:45:41 +00:00
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "2") {
if (getprop("/MCDU[1]/page") == "INITA") {
PerfInput("L2");
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("L2");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("L2");
} else if (getprop("/MCDU[1]/page") == "CLB") {
initInputA("L5"); # Does the same thing as on the INIT page
} else if (getprop("/MCDU[1]/page") == "CRZ") {
initInputA("L5");
} else if (getprop("/MCDU[1]/page") == "DES") {
initInputA("L5");
2017-07-28 16:21:48 +00:00
} else if (getprop("/MCDU[1]/page") == "DATA") {
dataInput("L2");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("L2");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L2");
} else {
2017-06-30 15:45:41 +00:00
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "3") {
if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("L3");
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("L3");
2017-07-28 16:21:48 +00:00
} else if (getprop("/MCDU[1]/page") == "STATUS") {
statusInput("L3");
2017-06-30 15:45:41 +00:00
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("L3");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("L3");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L3");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "4") {
if (getprop("/MCDU[1]/page") == "DATA") {
setprop("/MCDU[1]/page", "STATUS");
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("L4");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("L4");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L4");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "5") {
if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("L5");
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("L5");
} else if (getprop("/MCDU[1]/page") == "CLB") {
perfCLBInput("L5");
} else if (getprop("/MCDU[1]/page") == "CRZ") {
perfCRZInput("L5");
} else if (getprop("/MCDU[1]/page") == "DES") {
perfDESInput("L5");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("L5");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("L5");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L5");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "6") {
if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("L6");
} else if (getprop("/MCDU[1]/page") == "CLB") {
perfCLBInput("L6");
} else if (getprop("/MCDU[1]/page") == "CRZ") {
perfCRZInput("L6");
} else if (getprop("/MCDU[1]/page") == "DES") {
perfDESInput("L6");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("L6");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
}
}
var lskbutton_b = func(btn) {
# Special Middle Click Functions
}
var rskbutton = func(btn) {
if (btn == "1") {
if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("R1");
} else if (getprop("/MCDU[1]/page") == "INITB") {
initInputB("R1");
2017-06-30 15:45:41 +00:00
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("R1");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("R1");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("R1");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "2") {
if (getprop("/MCDU[1]/page") == "INITB") {
initInputB("R2");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("R2");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("R2");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("R2");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "3") {
if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("R3");
} else if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("R3");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
printInput("R3");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("R3");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "4") {
if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("R4");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("R4");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
printInput2("R4");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "5") {
if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("R5");
} else if (getprop("/MCDU[1]/page") == "RADNAV") {
radnavInput("R5");
2017-07-31 13:43:13 +00:00
} else if (getprop("/MCDU[1]/page") == "DATA") {
dataInput("R5");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
} else if (btn == "6") {
if (getprop("/MCDU[1]/page") == "TO") {
perfTOInput("R6");
} else if (getprop("/MCDU[1]/page") == "CLB") {
perfCLBInput("R6");
} else if (getprop("/MCDU[1]/page") == "CRZ") {
perfCRZInput("R6");
} else if ((getprop("/MCDU[1]/page") == "DATA") or (getprop("/MCDU[1]/page") == "PRINTFUNC") or (getprop("/MCDU[1]/page") == "PRINTFUNC2")) {
if (getprop("/MCDU[1]/scratchpad") != "AOC DISABLED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "AOC DISABLED");
2017-08-01 14:02:36 +00:00
} else if (getprop("/MCDU[1]/page") == "INITA") {
initInputA("R6");
2017-06-30 15:45:41 +00:00
} else {
if (getprop("/MCDU[1]/scratchpad") != "NOT ALLOWED") {
setprop("/MCDU[1]/last-scratchpad", getprop("/MCDU[1]/scratchpad"));
}
setprop("/MCDU[1]/scratchpad-msg", "1");
setprop("/MCDU[1]/scratchpad", "NOT ALLOWED");
}
}
}
var rskbutton_b = func(btn) {
# Special Middle Click Functions
}
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[1]/page") == "INITA") {
if (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") != 3) {
setprop("/MCDU[1]/page", "INITB");
}
2017-06-30 15:45:41 +00:00
} else if (getprop("/MCDU[1]/page") == "INITB") {
setprop("/MCDU[1]/page", "INITA");
}
2017-07-31 13:43:13 +00:00
if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
setprop("/MCDU[1]/page", "PRINTFUNC2");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
setprop("/MCDU[1]/page", "PRINTFUNC");
}
2017-06-30 15:45:41 +00:00
} 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[1]/page") == "INITA") {
if (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") != 3) {
setprop("/MCDU[1]/page", "INITB");
}
2017-06-30 15:45:41 +00:00
} else if (getprop("/MCDU[1]/page") == "INITB") {
setprop("/MCDU[1]/page", "INITA");
}
2017-07-31 13:43:13 +00:00
if (getprop("/MCDU[1]/page") == "PRINTFUNC") {
setprop("/MCDU[1]/page", "PRINTFUNC2");
} else if (getprop("/MCDU[1]/page") == "PRINTFUNC2") {
setprop("/MCDU[1]/page", "PRINTFUNC");
}
2017-06-30 15:45:41 +00:00
} else if (btn == "up") {
# Nothing for now
} else if (btn == "down") {
# Nothing for now
}
}
var pagebutton = func(btn) {
if (getprop("/MCDU[1]/page") != "MCDU") {
if (btn == "radnav") {
setprop("/MCDU[1]/page", "RADNAV");
} else if (btn == "perf") {
if (getprop("/FMGC/status/phase") == 0 or getprop("/FMGC/status/phase") == 1) {
setprop("/MCDU[1]/page", "TO");
} else if (getprop("/FMGC/status/phase") == 2) {
setprop("/MCDU[1]/page", "CLB");
} else if (getprop("/FMGC/status/phase") == 3) {
setprop("/MCDU[1]/page", "CRZ");
} else if (getprop("/FMGC/status/phase") == 4) {
2017-07-21 21:33:14 +00:00
setprop("/MCDU[1]/page", "DES");
2017-06-30 15:45:41 +00:00
}
} else if (btn == "init") {
setprop("/MCDU[1]/page", "INITA");
} else if (btn == "data") {
setprop("/MCDU[1]/page", "DATA");
} else if (btn == "mcdu") {
setprop("/MCDU[1]/last-fmgc-page", getprop("/MCDU[1]/page"));
setprop("/MCDU[1]/scratchpad", "SELECT DESIRED SYSTEM");
setprop("/MCDU[1]/page", "MCDU");
} else if (btn == "f-pln") {
setprop("/MCDU[1]/page", "F-PLNA");
2018-01-16 20:21:32 +00:00
} else if (btn == "fuel-pred") {
setprop("/MCDU[1]/page", "FUELPRED");
2017-06-30 15:45:41 +00:00
}
}
}
var button = func(btn) {
if (getprop("/MCDU[1]/scratchpad-msg") == 0 and getprop("/MCDU[1]/page") != "MCDU") {
var scratchpad = getprop("/MCDU[1]/scratchpad");
if (btn == "A") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "A");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "B") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "B");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "C") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "C");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "D") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "D");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "E") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "E");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "F") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "F");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "G") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "G");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "H") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "H");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "I") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "I");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "J") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "J");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "K") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "K");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "L") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "L");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "M") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "M");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "N") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "N");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "O") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "O");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "P") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "P");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "Q") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "Q");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "R") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "R");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "S") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "S");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "T") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "T");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "U") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "U");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "V") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "V");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "W") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "W");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "X") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "X");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "Y") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "Y");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "Z") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "Z");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "SLASH") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "/");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "SP") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ " ");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "CLR") {
var scratchpad = getprop("/MCDU[1]/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");
} else if (size(scratchpad) > 0) {
setprop("/MCDU[1]/last-scratchpad", "");
setprop("/MCDU[1]/scratchpad", left(scratchpad, size(scratchpad)-1));
setprop("/MCDU[1]/scratchpad-msg", "0");
}
} else if (btn == "0") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "0");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "1") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "1");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "2") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "2");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "3") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "3");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "4") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "4");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "5") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "5");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "6") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "6");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "7") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "7");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "8") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "8");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "9") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "9");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "DOT") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ ".");
setprop("/MCDU[1]/scratchpad-msg", "0");
} else if (btn == "PLUSMINUS") {
setprop("/MCDU[1]/scratchpad", scratchpad ~ "-");
setprop("/MCDU[1]/scratchpad-msg", "0");
}
} else {
if (btn == "CLR") {
var scratchpad = getprop("/MCDU[1]/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", getprop("/MCDU[1]/last-scratchpad"));
setprop("/MCDU[1]/last-scratchpad", "");
setprop("/MCDU[1]/scratchpad-msg", "0");
}
}
}
}
var screenFlash = func(time) {
var page = getprop("/MCDU[1]/page");
setprop("/MCDU[1]/page", "NONE");
settimer(func {
setprop("/MCDU[1]/page", page);
}, time);
}