1
0
Fork 0

Improve INIT A validation of tropopause and GND TEMP

This commit is contained in:
Jonathan Redpath 2021-10-30 15:45:04 +01:00
parent 3e1184a4df
commit 4b02640e88

View file

@ -310,27 +310,65 @@ var initInputA = func(key, i) {
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
fmgc.FMGCInternal.tropo = 36090; if (fmgc.FMGCInternal.tropoSet) {
fmgc.FMGCInternal.tropoSet = 0; fmgc.FMGCInternal.tropo = 36090;
mcdu_scratchpad.scratchpads[i].empty(); fmgc.FMGCInternal.tropoSet = 0;
} else {
var tropo = size(scratchpad);
if (tropo == 5 and scratchpad <= 99990) {
fmgc.FMGCInternal.tropo = scratchpad;
fmgc.FMGCInternal.tropoSet = 1;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }
} else {
if (num(scratchpad) == nil) {
if (find("FL", scratchpad) != -1) {
var tropos = size(split("FL", scratchpad)[1]);
var tropon = num(split("FL", scratchpad)[1]);
if (tropon != nil) {
if ((tropos == 2 or tropos == 3) and tropon >= 10 and tropon <= 999) {
fmgc.FMGCInternal.tropo = tropon * 100;
fmgc.FMGCInternal.tropoSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else {
var tropos = size(scratchpad);
var tropon = num(scratchpad);
if ((tropos == 4 or tropos == 5) and tropon >= 1000 and tropon <= 99990) {
fmgc.FMGCInternal.tropo = math.round(tropon, 10);
fmgc.FMGCInternal.tropoSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else if ((tropos == 2 or tropos == 3) and tropon >= 10 and tropon <= 999) {
fmgc.FMGCInternal.tropo = num(scratchpad) * 100;
fmgc.FMGCInternal.tropoSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
}
} }
} else if (key == "R6") { } else if (key == "R6") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
fmgc.FMGCInternal.gndTempSet = 0; if (fmgc.FMGCInternal.gndTempSet) {
mcdu_scratchpad.scratchpads[i].empty(); fmgc.FMGCInternal.gndTempSet = 0;
} else if (int(scratchpad) != nil and fmgc.FMGCInternal.phase == 0 and size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) { fmgc.FMGCInternal.gndTemp = 15;
fmgc.FMGCInternal.gndTemp = scratchpad; mcdu_scratchpad.scratchpads[i].empty();
fmgc.FMGCInternal.gndTempSet = 1; } else {
mcdu_scratchpad.scratchpads[i].empty(); mcdu_message(i, "NOT ALLOWED");
}
} else if (isnum(scratchpad) and fmgc.FMGCInternal.phase == 0) {
if (size(scratchpad) >= 1 and size(scratchpad) <= 3 and scratchpad >= -99 and scratchpad <= 99) {
fmgc.FMGCInternal.gndTemp = scratchpad;
fmgc.FMGCInternal.gndTempSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "ENTRY OUT OF RANGE");
}
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }