Improve INIT A validation of tropopause and GND TEMP
This commit is contained in:
parent
3e1184a4df
commit
4b02640e88
1 changed files with 52 additions and 14 deletions
|
@ -310,27 +310,65 @@ var initInputA = func(key, i) {
|
|||
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
|
||||
} else if (key == "R5") {
|
||||
if (scratchpad == "CLR") {
|
||||
fmgc.FMGCInternal.tropo = 36090;
|
||||
fmgc.FMGCInternal.tropoSet = 0;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
var tropo = size(scratchpad);
|
||||
if (tropo == 5 and scratchpad <= 99990) {
|
||||
fmgc.FMGCInternal.tropo = scratchpad;
|
||||
fmgc.FMGCInternal.tropoSet = 1;
|
||||
if (fmgc.FMGCInternal.tropoSet) {
|
||||
fmgc.FMGCInternal.tropo = 36090;
|
||||
fmgc.FMGCInternal.tropoSet = 0;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
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") {
|
||||
if (scratchpad == "CLR") {
|
||||
fmgc.FMGCInternal.gndTempSet = 0;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} 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 = scratchpad;
|
||||
fmgc.FMGCInternal.gndTempSet = 1;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
if (fmgc.FMGCInternal.gndTempSet) {
|
||||
fmgc.FMGCInternal.gndTempSet = 0;
|
||||
fmgc.FMGCInternal.gndTemp = 15;
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
} else {
|
||||
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 {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue