2020-04-30 15:26:36 -04:00
|
|
|
# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring)
|
2019-10-14 12:48:35 -04:00
|
|
|
|
2020-04-30 15:26:36 -04:00
|
|
|
# Copyright (c) 2020 Matthew Maring (mattmaring)
|
2019-10-14 12:48:35 -04:00
|
|
|
|
|
|
|
var perfDESInput = func(key, i) {
|
2020-05-23 01:40:01 +01:00
|
|
|
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
|
2020-03-25 10:54:39 -04:00
|
|
|
if (key == "L2") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-07-10 22:15:37 +01:00
|
|
|
fmgc.FMGCInternal.costIndex = 0;
|
|
|
|
fmgc.FMGCInternal.costIndexSet = 0;
|
|
|
|
fmgc.FMGCNodes.costIndex.setValue(0);
|
2020-05-23 12:16:20 +01:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-03-25 10:54:39 -04:00
|
|
|
} else {
|
|
|
|
var ci = int(scratchpad);
|
|
|
|
var cis = size(scratchpad);
|
|
|
|
if (cis >= 1 and cis <= 3) {
|
2020-03-29 21:27:18 -04:00
|
|
|
if (ci != nil and ci >= 0 and ci <= 999) {
|
2020-07-10 22:15:37 +01:00
|
|
|
fmgc.FMGCInternal.costIndex = ci;
|
|
|
|
fmgc.FMGCInternal.costIndexSet = 1;
|
|
|
|
fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex);
|
2020-05-23 12:16:20 +01:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-03-25 10:54:39 -04:00
|
|
|
} else {
|
2020-05-23 12:16:20 +01:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-03-25 10:54:39 -04:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 12:16:20 +01:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-03-25 10:54:39 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (key == "L6") {
|
2020-07-10 22:15:37 +01:00
|
|
|
if (fmgc.FMGCInternal.phase == 4) {
|
2020-05-01 20:26:05 -04:00
|
|
|
if (getprop("/FMGC/internal/activate-once") == 1) {
|
|
|
|
if (getprop("/FMGC/internal/activate-twice") == 0) {
|
|
|
|
setprop("/FMGC/internal/activate-twice", 1);
|
2020-07-11 14:03:30 +01:00
|
|
|
fmgc.FMGCInternal.phase = 5;
|
2022-01-16 14:15:35 +00:00
|
|
|
fmgc.FMGCInternal.decel = 1;
|
2022-05-13 15:33:27 +01:00
|
|
|
setprop("/instrumentation/nd/symbols/decel/show", 0);
|
2020-04-10 14:38:58 -04:00
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
|
|
|
|
} else {
|
2020-05-23 12:16:20 +01:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-04-10 14:38:58 -04:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-01 20:26:05 -04:00
|
|
|
setprop("/FMGC/internal/activate-once", 1);
|
2020-04-10 14:38:58 -04:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "PERFCRZ");
|
|
|
|
}
|
2020-02-24 15:54:10 -05:00
|
|
|
} else if (key == "R6") {
|
2020-03-29 23:39:31 -04:00
|
|
|
setprop("MCDU[" ~ i ~ "]/page", "PERFAPPR");
|
2019-10-14 12:48:35 -04:00
|
|
|
}
|
|
|
|
}
|