2020-04-30 19:26:36 +00:00
|
|
|
# Copyright (c) 2020 Matthew Maring (mattmaring)
|
2020-03-30 03:39:31 +00:00
|
|
|
|
|
|
|
var progDESInput = func(key, i) {
|
2020-05-23 00:40:01 +00:00
|
|
|
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
|
2020-04-10 18:38:58 +00:00
|
|
|
if (key == "L1") {
|
|
|
|
if (scratchpad == "CLR") {
|
2020-05-02 00:26:05 +00:00
|
|
|
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
|
|
|
|
if (getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
|
|
|
|
setprop("/FMGC/status/phase", 3);
|
|
|
|
setprop("/FMGC/internal/activate-once", 0);
|
|
|
|
setprop("/FMGC/internal/activate-twice", 0);
|
|
|
|
setprop("/FMGC/internal/decel", 0);
|
2020-04-10 18:38:58 +00:00
|
|
|
}
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-04-10 18:38:58 +00:00
|
|
|
} else if (int(scratchpad) != nil) {
|
|
|
|
var crzs = size(scratchpad);
|
|
|
|
if (crzs >= 1 and crzs <= 3 and scratchpad > 0 and scratchpad <= 430 and altSet.getValue() <= scratchpad * 100) {
|
2020-05-02 00:26:05 +00:00
|
|
|
setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_scratchpad.scratchpads[i].empty();
|
2020-05-02 00:26:05 +00:00
|
|
|
if (getprop("/FMGC/status/phase") == 4 or getprop("/FMGC/status/phase") == 5 or getprop("/FMGC/status/phase") == 6) {
|
|
|
|
setprop("/FMGC/status/phase", 3);
|
|
|
|
setprop("/FMGC/internal/activate-once", 0);
|
|
|
|
setprop("/FMGC/internal/activate-twice", 0);
|
|
|
|
setprop("/FMGC/internal/decel", 0);
|
2020-04-10 18:38:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-04-10 18:38:58 +00:00
|
|
|
}
|
|
|
|
} else {
|
2020-05-23 11:16:20 +00:00
|
|
|
mcdu_message(i, "NOT ALLOWED");
|
2020-04-10 18:38:58 +00:00
|
|
|
}
|
2020-03-30 03:39:31 +00:00
|
|
|
}
|
|
|
|
}
|