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