2020-03-24 00:14:12 +00:00
|
|
|
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (hayden2000)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
# Copyright (c) 2019 Joshua Davidson (Octal450)
|
2020-03-24 00:14:12 +00:00
|
|
|
# Copyright (c) 2020 Matthew Maring (hayden2000)
|
2019-10-14 16:48:35 +00:00
|
|
|
|
|
|
|
var perfTOInput = func(key, i) {
|
2020-02-07 16:10:54 +00:00
|
|
|
var scratchpad = getprop("MCDU[" ~ i ~ "]/scratchpad");
|
2019-10-14 16:48:35 +00:00
|
|
|
if (key == "L1") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/v1", 0);
|
|
|
|
setprop("FMGC/internal/v1-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 3) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 200) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/v1", scratchpad);
|
|
|
|
setprop("FMGC/internal/v1-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L2") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/vr", 0);
|
|
|
|
setprop("FMGC/internal/vr-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 3) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 200) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/vr", scratchpad);
|
|
|
|
setprop("FMGC/internal/vr-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L3") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/v2", 0);
|
|
|
|
setprop("FMGC/internal/v2-set", 0);
|
|
|
|
setprop("it-autoflight/settings/togaspd", 157);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 3) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 200) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/v2", scratchpad);
|
|
|
|
setprop("FMGC/internal/v2-set", 1);
|
2020-03-22 00:58:28 +00:00
|
|
|
setprop("it-autoflight/settings/togaspd", scratchpad);
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L4") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-03-24 00:14:12 +00:00
|
|
|
setprop("FMGC/internal/trans-alt", 18000);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 4 or tfs == 5) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and scratchpad >= 1000 and scratchpad <= 18000) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/trans-alt", scratchpad);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L5") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("systems/thrust/clbreduc-ft", "1500");
|
2020-03-22 01:10:55 +00:00
|
|
|
setprop("FMGC/internal/reduc-agl-ft", "1500");
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDUC/thracc-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs >= 7 and tfs <= 9 and find("/", scratchpad) != -1) {
|
|
|
|
var thracc = split("/", scratchpad);
|
|
|
|
var thrred = size(thracc[0]);
|
|
|
|
var acc = size(thracc[1]);
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(thrred) != nil and int(acc) != nil and (thrred >= 3 and thrred <= 5) and (acc >= 3 and acc <= 5)) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("systems/thrust/clbreduc-ft", thracc[0]);
|
|
|
|
setprop("FMGC/internal/reduc-agl-ft", thracc[1]);
|
|
|
|
setprop("MCDUC/thracc-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "R3") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/to-flap", 0);
|
|
|
|
setprop("FMGC/internal/to-ths", "0.0");
|
|
|
|
setprop("FMGC/internal/flap-ths-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
2020-03-30 01:27:18 +00:00
|
|
|
if (tfs == 7 and find("/UP", scratchpad) != -1) {
|
2019-10-14 16:48:35 +00:00
|
|
|
var flapths = split("/UP", scratchpad);
|
2020-03-30 01:27:18 +00:00
|
|
|
var flap = int(flapths[0]);
|
|
|
|
var trim = num(flapths[1]);
|
|
|
|
if (flap != nil and trim != nil and (flap >= 1 and flap <= 4) and (trim >= 0.0 and trim <= 2.5)) {
|
|
|
|
setprop("FMGC/internal/to-flap", flap);
|
|
|
|
setprop("FMGC/internal/to-ths", trim);
|
|
|
|
setprop("FMGC/internal/flap-ths-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else if (tfs == 7 and find("/DN", scratchpad) != -1) {
|
|
|
|
var flapths = split("/DN", scratchpad);
|
|
|
|
var flap = int(flapths[0]);
|
|
|
|
var trim = num(flapths[1]);
|
|
|
|
if (flap != nil and trim != nil and (flap >= 1 and flap <= 4) and (trim > 0 and trim <= 2.5)) {
|
|
|
|
setprop("FMGC/internal/to-flap", flap);
|
|
|
|
setprop("FMGC/internal/to-ths", -1 * trim);
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/flap-ths-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
2020-02-29 18:44:54 +00:00
|
|
|
} else if (tfs == 1) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and scratchpad >= 1 and scratchpad <= 4) {
|
2020-02-29 18:44:54 +00:00
|
|
|
setprop("FMGC/internal/to-flap", scratchpad);
|
|
|
|
setprop("FMGC/internal/flap-ths-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "R4") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/flex", 0);
|
|
|
|
setprop("FMGC/internal/flex-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
|
|
|
if (tfs == 1 or tfs == 2) {
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 70) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/flex", scratchpad);
|
|
|
|
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[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "R5") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-03-22 01:10:55 +00:00
|
|
|
setprop("FMGC/internal/eng-out-reduc", "1500");
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("MCDUC/reducacc-set", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 0);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
var tfs = size(scratchpad);
|
2020-03-30 01:27:18 +00:00
|
|
|
if (int(scratchpad) != nil and tfs >= 3 and tfs <= 5) {
|
2020-02-07 16:10:54 +00:00
|
|
|
setprop("FMGC/internal/eng-out-reduc", scratchpad);
|
|
|
|
setprop("MCDUC/reducacc-set", 1);
|
|
|
|
setprop("MCDU[" ~ i ~ "]/scratchpad", "");
|
2019-10-14 16:48:35 +00:00
|
|
|
} else {
|
|
|
|
notAllowed(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "R6") {
|
2020-03-30 03:39:31 +00:00
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "PERFCLB");
|
2019-10-14 16:48:35 +00:00
|
|
|
}
|
|
|
|
}
|