1
0
Fork 0
A320-family/Nasal/MCDU/PROGTO.nas

24 lines
828 B
Text
Raw Normal View History

2020-04-30 19:26:36 +00:00
# Copyright (c) 2020 Matthew Maring (mattmaring)
var altSet = props.globals.getNode("it-autoflight/input/alt", 1);
var progTOInput = func(key, i) {
2020-05-23 00:40:01 +00:00
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
if (key == "L1") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cruise-fl-prog", getprop("/FMGC/internal/cruise-fl"));
2020-05-23 11:16:20 +00:00
mcdu_scratchpad.scratchpads[i].empty();
} 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 and getprop("/FMGC/internal/cruise-lvl-set")) {
setprop("/FMGC/internal/cruise-fl-prog", scratchpad);
2020-05-23 11:16:20 +00:00
mcdu_scratchpad.scratchpads[i].empty();
} else {
2020-05-23 11:16:20 +00:00
mcdu_message(i, "NOT ALLOWED");
}
} else {
2020-05-23 11:16:20 +00:00
mcdu_message(i, "NOT ALLOWED");
}
}
}