1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
Jonathan Redpath 2021-10-30 16:02:13 +01:00
commit 4f77deb971
3 changed files with 84 additions and 16 deletions

View file

@ -270,7 +270,7 @@ var SimbriefParser = {
fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue(); fmgc.FMGCInternal.costIndex = me.OFP.getNode("general/costindex").getValue();
fmgc.FMGCInternal.costIndexSet = 1; fmgc.FMGCInternal.costIndexSet = 1;
fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex); fmgc.FMGCNodes.costIndex.setValue(fmgc.FMGCInternal.costIndex);
fmgc.FMGCInternal.tropo = me.OFP.getNode("general/avg_tropopause").getValue(); fmgc.FMGCInternal.tropo = math.round(me.OFP.getNode("general/avg_tropopause").getValue(), 10);
fmgc.FMGCInternal.tropoSet = 1; fmgc.FMGCInternal.tropoSet = 1;
# Set cruise altitude # Set cruise altitude

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");
} }

View file

@ -340,6 +340,7 @@ var ATIS = {
print("Failed to parse ATIS for " ~ airport); print("Failed to parse ATIS for " ~ airport);
debug.dump(r.response); debug.dump(r.response);
debug.printerror(errs); debug.printerror(errs);
me.sent = 0;
mcdu.mcdu_message(i, "BAD SERVER RESPONSE"); mcdu.mcdu_message(i, "BAD SERVER RESPONSE");
} }
}); });
@ -391,6 +392,14 @@ var ATIS = {
code = split(".", code)[0]; code = split(".", code)[0];
} }
if (find(",", code) != -1) {
code = split(",", code)[0];
}
if (size(code) > 1) {
code = left(code, 1);
}
me.receivedCode = code; me.receivedCode = code;
var time = ""; var time = "";
@ -403,26 +412,47 @@ var ATIS = {
} else if (find("TIME ", raw) != -1) { } else if (find("TIME ", raw) != -1) {
time = split("TIME ", raw)[1]; time = split("TIME ", raw)[1];
time = split(" ", time)[0]; time = split(" ", time)[0];
} else if (find("WEATHER AT ", raw) != -1) {
time = split("WEATHER AT ", raw)[1];
time = left(split(" ", time)[0], 4);
} else if (find(" UTC", raw) != -1) {
time = split(" UTC", raw)[0];
time = right(time, 4);
} else if (find("Z.", raw) != -1) { } else if (find("Z.", raw) != -1) {
time = split("Z.", raw)[0]; time = split("Z.", raw)[0];
time = right(time, 4); time = right(time, 4);
} else if (find("Z SPECIAL", raw) != -1) { } else if (find("Z SPECIAL", raw) != -1) {
time = split("Z SPECIAL", raw)[0]; time = split("Z SPECIAL", raw)[0];
time = right(time, 4); time = right(time, 4);
} else if (find("Z EXPECT", raw) != -1) {
time = split("Z EXPECT", raw)[0];
time = right(time, 4);
} else if (find("metreport", raw) != -1) { } else if (find("metreport", raw) != -1) {
time = split("metreport", raw)[0]; time = split("metreport", raw)[0];
time = right(time, 4); time = right(time, 4);
} else if (find("METREPORT ", raw) != -1) {
time = split("METREPORT ", raw)[1];
time = left(time, 4);
} else if (find("INFORMATION " ~ code ~ " AT ", raw) != -1) {
time = split("INFORMATION " ~ code ~ " AT ", raw)[1];
time = left(time, 4);
} else if (find((code ~ " "), raw) != -1) { } else if (find((code ~ " "), raw) != -1) {
if (size(split(" ",split(code ~ " ", raw)[1])[0]) == 4) { if (size(split(" ",split(code ~ " ", raw)[1])[0]) == 4) {
time = split(" ",split(code ~ " ", raw)[1])[0]; time = split(" ",split(code ~ " ", raw)[1])[0];
} }
} else if (size(split(" ",split(code, raw)[1])[0]) == 4) {
time = split(" ",split(code, raw)[1])[0];
} else { } else {
print("Failed to find a valid ATIS time for " ~ me.station); print("Failed to find a valid ATIS time for " ~ me.station);
debug.dump(raw); debug.dump(raw);
} }
# Handle UK airport issue
# Limitation: always ends in 0
if (size(time) == 3) { if (size(time) == 3) {
time ~= " "; time ~= "0";
} else if (size(time) > 4) {
time = left(time, 4);
} }
raw = string.uc(raw); raw = string.uc(raw);