1
0
Fork 0

Merge branch 'dev' into wind

This commit is contained in:
legoboyvdlp R 2020-06-13 23:32:34 +01:00
commit 946c8ce3b2
9 changed files with 621 additions and 336 deletions

View file

@ -3760,7 +3760,6 @@ var canvas_MCDU_base = {
me["ArrowRight"].show(); me["ArrowRight"].show();
me["arrowsDepArr"].show(); me["arrowsDepArr"].show();
me["Simple_L1_Arrow"].hide(); me["Simple_L1_Arrow"].hide();
me["Simple_L2_Arrow"].hide();
me["Simple_L3_Arrow"].hide(); me["Simple_L3_Arrow"].hide();
me["Simple_L4_Arrow"].hide(); me["Simple_L4_Arrow"].hide();
me["Simple_L5_Arrow"].hide(); me["Simple_L5_Arrow"].hide();
@ -3787,6 +3786,12 @@ var canvas_MCDU_base = {
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
if (myArrival[i].arrowsMatrix[0][1]) {
me["Simple_L2_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][1] ~ "/r"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][1] ~ "/g"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][1] ~ "/b"));
me["Simple_L2_Arrow"].show();
} else {
me["Simple_L2_Arrow"].hide();
}
if (myArrival[i] != nil) { if (myArrival[i] != nil) {
me["Simple_Title"].setText(sprintf("%s", myArrival[i].title[0] ~ myArrival[i].title[1] ~ myArrival[i].title[2])); me["Simple_Title"].setText(sprintf("%s", myArrival[i].title[0] ~ myArrival[i].title[1] ~ myArrival[i].title[2]));
@ -3798,6 +3803,7 @@ var canvas_MCDU_base = {
var sign = "R"; var sign = "R";
} }
forindex (var item; myArrival[i].arrowsMatrix[matrixArrow]) { forindex (var item; myArrival[i].arrowsMatrix[matrixArrow]) {
if (item == 1) { continue; }
if (item == 5) { if (item == 5) {
me["Simple_L6_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/r"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/g"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/b")); me["Simple_L6_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/r"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/g"), getprop("/MCDUC/colors/" ~ myArrival[i].arrowsColour[0][5] ~ "/b"));
continue; continue;

View file

@ -7,7 +7,6 @@ var pos = nil;
var geoPosPrev = geo.Coord.new(); var geoPosPrev = geo.Coord.new();
var currentLegCourseDist = nil; var currentLegCourseDist = nil;
var courseDistanceFrom = nil; var courseDistanceFrom = nil;
var courseDistanceFromPrev = nil;
var sizeWP = nil; var sizeWP = nil;
var magTrueError = 0; var magTrueError = 0;
var storeCourse = nil; var storeCourse = nil;
@ -77,6 +76,11 @@ var flightPlanController = {
me.flightplans[n].cleanPlan(); me.flightplans[n].cleanPlan();
me.flightplans[n].departure = nil; me.flightplans[n].departure = nil;
me.flightplans[n].destination = nil; me.flightplans[n].destination = nil;
mcdu.isNoTransArr[n] = 0;
mcdu.isNoTransDep[n] = 0;
mcdu.isNoSid[n] = 0;
mcdu.isNoStar[n] = 0;
mcdu.isNoVia[n] = 0;
}, },
createTemporaryFlightPlan: func(n) { createTemporaryFlightPlan: func(n) {
@ -112,6 +116,37 @@ var flightPlanController = {
flightPlanTimer.stop(); flightPlanTimer.stop();
me.resetFlightplan(2); me.resetFlightplan(2);
me.flightplans[2] = me.flightplans[n].clone(); me.flightplans[2] = me.flightplans[n].clone();
if (mcdu.isNoSid[n] == 1) {
mcdu.isNoSid[2] = 1;
} else {
mcdu.isNoSid[2] = 0;
}
if (mcdu.isNoStar[n] == 1) {
mcdu.isNoStar[2] = 1;
} else {
mcdu.isNoStar[2] = 0;
}
if (mcdu.isNoVia[n] == 1) {
mcdu.isNoVia[2] = 1;
} else {
mcdu.isNoVia[2] = 0;
}
if (mcdu.isNoTransDep[n] == 1) {
mcdu.isNoTransDep[2] = 1;
} else {
mcdu.isNoTransDep[2] = 0;
}
if (mcdu.isNoTransArr[n] == 1) {
mcdu.isNoTransArr[2] = 1;
} else {
mcdu.isNoTransArr[2] = 0;
}
me.flightPlanChanged(2); me.flightPlanChanged(2);
flightPlanTimer.start(); flightPlanTimer.start();
} }
@ -225,19 +260,26 @@ var flightPlanController = {
if (DEBUG_DISCONT) { return; } if (DEBUG_DISCONT) { return; }
if (force) { if (force) {
me.flightplans[plan].insertWP(createDiscontinuity(), index); me.flightplans[plan].insertWP(createDiscontinuity(), index);
fmgc.windController.insertWind(plan, index, 0, "DISCONTINUITY");
} }
if (index > 0) {
if (me.flightplans[plan].getWP(index) != nil) { # index is not nil
if (me.flightplans[plan].getWP(index - 1) != nil) { # index -1 is also not nil
if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") { if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") {
me.flightplans[plan].insertWP(createDiscontinuity(), index); me.flightplans[plan].insertWP(createDiscontinuity(), index);
fmgc.windController.insertWind(plan, index, 0, "DISCONTINUITY");
} }
} else { } else { # -1 is nil
if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") { if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") {
me.flightplans[plan].insertWP(createDiscontinuity(), index); me.flightplans[plan].insertWP(createDiscontinuity(), index);
fmgc.windController.insertWind(plan, index, 0, "DISCONTINUITY");
} }
} }
} elsif (me.flightplans[plan].getWP(index - 1) != nil) { # index is nil, -1 is not
if (me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") {
me.flightplans[plan].insertWP(createDiscontinuity(), index);
}
} else { # both are nil??
print("Possible error in discontinuities!");
me.flightplans[plan].insertWP(createDiscontinuity(), index);
}
}, },
# insertTP - insert PPOS waypoint denoted "T-P" at specified index # insertTP - insert PPOS waypoint denoted "T-P" at specified index
@ -757,17 +799,13 @@ var flightPlanController = {
} }
if (wpt > 0) { if (wpt > 0) {
geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon); wpCoursePrev[n][wpt].setValue(me.flightplans[n].getWP(wpt).leg_bearing);
wpDistancePrev[n][wpt].setValue(me.flightplans[n].getWP(wpt).leg_distance);
courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev); #if (wpt > 1) {
wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]); # if (me.flightplans[n].getWP(wpt - 1).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt - 1).wp_type != "vectors" and me.flightplans[n].getWP(wpt - 1).wp_type != "hdgToAlt" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) {
wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]); # me._arrivalDist += courseDistanceFromPrev[1];
if (wpt > 1) { # }
if (me.flightplans[n].getWP(wpt - 1).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt - 1).wp_type != "vectors" and me.flightplans[n].getWP(wpt - 1).wp_type != "hdgToAlt" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) { #}
# print("Adding " ~ courseDistanceFromPrev[1] ~ " miles for waypoint " ~ me.flightplans[n].getWP(wpt).wp_name);
me._arrivalDist += courseDistanceFromPrev[1];
}
}
} else { } else {
# use PPOS for the first waypoint # use PPOS for the first waypoint
wpCoursePrev[n][wpt].setValue(courseDistanceFrom[0]); wpCoursePrev[n][wpt].setValue(courseDistanceFrom[0]);
@ -786,8 +824,7 @@ var flightPlanController = {
} }
} }
} }
# print("Total: " ~ me._arrivalDist); me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist;
me.arrivalDist = me._arrivalDist;
me.updateMCDUDriver(n); me.updateMCDUDriver(n);
}, },

View file

@ -174,9 +174,12 @@ var MessageController = {
]), ]),
typeIIMessages: std.Vector.new([ typeIIMessages: std.Vector.new([
TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"),
TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0), TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0),
TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0),
]), ]),
# to speed to low - new on a320, margin against vmcg / vs1g
getTypeIMsgByText: func(text) { getTypeIMsgByText: func(text) {
return me.getMsgByText(text, me.typeIMessages.vector); return me.getMsgByText(text, me.typeIMessages.vector);
}, },

View file

@ -1,4 +1,6 @@
var isNoStar = [0, 0]; var isNoStar = [0, 0, 0];
var isNoTransArr = [0, 0, 0];
var isNoVia = [0, 0, 0];
var arrivalPage = { var arrivalPage = {
title: [nil, nil, nil], title: [nil, nil, nil],
@ -31,17 +33,20 @@ var arrivalPage = {
selectedVIA: nil, selectedVIA: nil,
selectedSTAR: nil, selectedSTAR: nil,
selectedTransition: nil, selectedTransition: nil,
stars: nil, stars: [],
transitions: nil, transitions: [],
vias: nil, vias: [],
computer: nil, computer: nil,
enableScrollApproach: 0, enableScrollApproach: 0,
enableScrollStars: 0, enableScrollStars: 0,
enableScrollVias: 0,
scrollApproach: 0, scrollApproach: 0,
scrollStars: 0, scrollStars: 0,
activePage: 0, # runways, stars, trans scrollVias: 0,
hasPressNoTrans: 0, # temporary activePage: 0, # runways, stars, vias
oldPage: 0,
_approaches: nil, _approaches: nil,
_vias: nil,
_stars: nil, _stars: nil,
_transitions: nil, _transitions: nil,
new: func(icao, computer) { new: func(icao, computer) {
@ -56,39 +61,75 @@ var arrivalPage = {
return nil; return nil;
}, },
reset: func() { reset: func() {
isNoStar[me.computer] = 0; me.selectedApproach = nil;
me.selectedSTAR = nil; me.selectedSTAR = nil;
me.hasPressNoTrans = 0; me.selectedTransition = nil;
me.selectedVIA = nil;
isNoStar[me.computer] = 0;
isNoTransArr[me.computer] = 0;
isNoVia[me.computer] = 0;
}, },
_setupFirstTime: func() { _setupFirstTime: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[2].approach != nil) { if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0") {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
} elsif (isNoVia[2] == 1) {
me.selectedVIA = "NO VIA";
} }
}
}
if (fmgc.flightPlanController.flightplans[2].star != nil) { if (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
isNoStar[me.computer] = 0; isNoStar[2] = 0;
} elsif (isNoStar[me.computer] == 1) { } elsif (isNoStar[2] == 1) {
me.selectedSTAR = "NO STAR"; me.selectedSTAR = "NO STAR";
me.hasPressNoTrans = 1; }
if (isNoTransArr[2]) {
me.selectedTransition = "NO TRANS";
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans;
} }
} else { } else {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0") {
if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans;
} elsif (isNoVia[me.computer] == 1) {
me.selectedVIA = "NO VIA";
}
}
} elsif (fmgc.flightPlanController.flightplans[2].approach != nil) { } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0") {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
}
}
} }
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star; me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star;
me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].star_trans;
isNoStar[me.computer] = 0; isNoStar[me.computer] = 0;
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) { } elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star;
me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans;
isNoStar[me.computer] = 0; isNoStar[me.computer] = 0;
isNoStar[2] = 0;
} elsif (isNoStar[me.computer] == 1) { } elsif (isNoStar[me.computer] == 1) {
me.selectedSTAR = "NO STAR"; me.selectedSTAR = "NO STAR";
me.hasPressNoTrans = 1; }
if (isNoTransArr[me.computer] or isNoTransArr[2]) {
me.selectedTransition = "NO TRANS";
} elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].star_trans;
} elsif (fmgc.flightPlanController.flightplans[2].star != nil) {
me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans;
} }
} }
}, },
@ -99,8 +140,8 @@ var arrivalPage = {
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer] or me.activePage == 2) {
me.L6 = [" RETURN END", nil, "wht"]; me.L6 = [" RETURN", nil, "wht"];
} else { } else {
me.L6 = [" F-PLN", " TMPY", "yel"]; me.L6 = [" F-PLN", " TMPY", "yel"];
me.arrowsColour[0][5] = "yel"; me.arrowsColour[0][5] = "yel";
@ -108,11 +149,17 @@ var arrivalPage = {
if (me.activePage == 0) { if (me.activePage == 0) {
me.updateApproaches(); me.updateApproaches();
} else { } elsif (me.activePage == 1) {
me.updateSTARs(); me.updateSTARs();
me.updateTransitions();
} else {
me.updateVIAs();
} }
me.checkPageType();
me.updateActiveApproach(); me.updateActiveApproach();
me.updateActiveVIAs();
me.updateActiveSTARs(); me.updateActiveSTARs();
me.updateActiveTransitions(); me.updateActiveTransitions();
}, },
@ -143,101 +190,147 @@ var arrivalPage = {
me._clearPage(); me._clearPage();
me._setupPageWithData(); me._setupPageWithData();
}, },
# Functions to populate top row
updateActiveApproach: func() { updateActiveApproach: func() {
if (me.apprIsRwyFlag) { if (me.apprIsRwyFlag) {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"]; me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil) { } elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil and fmgc.flightPlanController.flightplans[2].destination_runway.id == me.selectedApproach.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"]; me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "yel"];
} else { } else {
me.L1 = ["---", " APPR", "wht"]; me.L1 = ["-----", " APPR", "wht"];
} }
} else { } else {
if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"]; me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"];
} else { } else {
me.L1 = ["---", " APPR", "wht"]; me.L1 = ["-----", " APPR", "wht"];
} }
} }
} elsif (me.selectedApproach != nil) { } elsif (me.selectedApproach != nil) {
if (fmgc.flightPlanController.flightplans[2].approach != nil) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"]; me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].approach.id == me.selectedApproach.id) { } elsif (fmgc.flightPlanController.flightplans[2].approach != nil and fmgc.flightPlanController.flightplans[2].approach.id == me.selectedApproach.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "yel"];
} else {
me.L1 = ["-----", " APPR", "wht"];
}
} else {
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"]; me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"];
} else { } else {
me.L1 = ["---", " APPR", "wht"]; me.L1 = ["-----", " APPR", "wht"];
} }
} elsif (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"];
} else {
me.L1 = ["---", " APPR", "wht"];
} }
} else { } else {
me.L1 = ["---", " APPR", "wht"]; me.L1 = ["-----", " APPR", "wht"];
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateActiveVIAs: func() {
if (getprop("/sim/version/flightgear") != "2020.2.0") { return; }
if (me.selectedVIA == "NO VIA") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.C1 = ["NONE", "VIA", "grn"];
} else {
me.C1 = ["NONE", "VIA", "yel"];
}
} elsif (me.selectedVIA != nil) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].approach_trans.id, "VIA", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].approach_trans != nil and fmgc.flightPlanController.flightplans[2].approach_trans.id == me.selectedVIA.id) {
me.C1 = [fmgc.flightPlanController.flightplans[2].approach_trans.id, "VIA", "yel"];
} else {
me.C1 = ["-------", "VIA", "wht"];
}
} else {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[2].approach_trans.id, "VIA", "grn"];
} else {
me.C1 = ["-------", "VIA", "wht"];
}
}
} else {
me.C1 = ["-------", "VIA", "wht"];
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
updateActiveSTARs: func() { updateActiveSTARs: func() {
if (me.selectedSTAR == "NO STAR") { if (me.selectedSTAR == "NO STAR") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.C1 = ["NONE", "STAR", "grn"]; me.R1 = ["NONE", "STAR ", "grn"];
} else { } else {
me.C1 = ["NONE", "STAR", "yel"]; me.R1 = ["NONE", "STAR ", "yel"];
} }
} elsif (me.selectedSTAR != nil) { } elsif (me.selectedSTAR != nil) {
if (fmgc.flightPlanController.flightplans[2].star != nil) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { if (fmgc.flightPlanController.flightplans[me.computer].star != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR", "yel"]; me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].star.id == me.selectedSTAR.id) { } elsif (fmgc.flightPlanController.flightplans[2].star != nil and fmgc.flightPlanController.flightplans[2].star.id == me.selectedSTAR.id) {
me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR", "grn"]; me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "yel"];
} else { } else {
me.C1 = ["------- ", "STAR", "wht"]; me.R1 = ["-------", "STAR ", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].star.id != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR", "yel"];
} else {
me.C1 = ["------- ", "STAR", "wht"];
} }
} else { } else {
me.C1 = ["------- ", "STAR", "wht"]; if (fmgc.flightPlanController.flightplans[2].star != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "grn"];
} else {
me.R1 = ["-------", "STAR ", "wht"];
}
}
} else {
me.R1 = ["-------", "STAR ", "wht"];
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateActiveTransitions: func() { updateActiveTransitions: func() {
if (!me.hasPressNoTrans) { if (me.selectedTransition == "NO TRANS") {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.flightplans[2].star_trans != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].star_trans.id == me.selectedTransition.id) {
me.R1 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS", "grn"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "STAR", "yel"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.R1 = ["NONE", "TRANS ", "grn"]; me.R2 = ["NONE", "TRANS ", "grn"];
} else { } else {
me.R1 = ["NONE", "TRANS ", "yel"]; me.R2 = ["NONE", "TRANS ", "yel"];
}
} else {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) {
me.R2 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS ", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].star_trans != nil and fmgc.flightPlanController.flightplans[2].star_trans.id == me.selectedTransition.id) {
me.R2 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS ", "yel"];
} else {
me.R2 = ["-------", "TRANS ", "wht"];
}
} else {
if (fmgc.flightPlanController.flightplans[2].star_trans != nil) {
me.R2 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS ", "grn"];
} else {
me.R2 = ["-------", "TRANS ", "wht"];
}
}
} else {
me.R2 = ["-------", "TRANS ", "wht"];
} }
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateApproaches: func() { updateApproaches: func() {
me.apprIsRwyFlag = 0; me.apprIsRwyFlag = 0;
if (me.arrAirport == nil) { if (me.arrAirport == nil) {
me.arrAirport = findAirportsByICAO(left(me.id, 4)); me.arrAirport = findAirportsByICAO(left(me.id, 4));
} }
me.approaches = [];
me._approaches = nil;
me._approaches = me.arrAirport[0].getApproachList(); me._approaches = me.arrAirport[0].getApproachList();
me.approaches = sort(me._approaches,func(a,b) cmp(a,b)); me.approaches = sort(me._approaches,func(a,b) cmp(a,b));
if (me.approaches == nil or size(me.approaches) == 0) { if (me.approaches == nil or size(me.approaches) == 0) {
@ -353,6 +446,10 @@ var arrivalPage = {
if (me.arrAirport == nil) { if (me.arrAirport == nil) {
me.arrAirport = findAirportsByICAO(left(me.id, 4)); me.arrAirport = findAirportsByICAO(left(me.id, 4));
} }
me.stars = [];
me._stars = nil;
if (me.selectedApproach != nil) { if (me.selectedApproach != nil) {
me._stars = me.arrAirport[0].stars(me.selectedApproach.runways[0]); me._stars = me.arrAirport[0].stars(me.selectedApproach.runways[0]);
} else { } else {
@ -367,18 +464,8 @@ var arrivalPage = {
} }
if (size(me.stars) >= 1) { if (size(me.stars) >= 1) {
me.L2 = [" " ~ me.stars[0 + me.scrollStars], "STARS", "blu"]; me.L3 = [" " ~ me.stars[0 + me.scrollStars], "STARS", "blu"];
if (me.stars[0 + me.scrollStars] != me.selectedSTAR) { if (me.stars[0 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "blu";
} else {
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "ack";
}
}
if (size(me.stars) >= 2) {
me.L3 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"];
if (me.stars[1 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][2] = 1; me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu"; me.arrowsColour[0][2] = "blu";
} else { } else {
@ -386,9 +473,9 @@ var arrivalPage = {
me.arrowsColour[0][2] = "ack"; me.arrowsColour[0][2] = "ack";
} }
} }
if (size(me.stars) >= 3) { if (size(me.stars) >= 2) {
me.L4 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"]; me.L4 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"];
if (me.stars[2 + me.scrollStars] != me.selectedSTAR) { if (me.stars[1 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][3] = 1; me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu"; me.arrowsColour[0][3] = "blu";
} else { } else {
@ -396,9 +483,9 @@ var arrivalPage = {
me.arrowsColour[0][3] = "ack"; me.arrowsColour[0][3] = "ack";
} }
} }
if (size(me.stars) >= 4) { if (size(me.stars) >= 3) {
me.L5 = [" " ~ me.stars[3 + me.scrollStars], nil, "blu"]; me.L5 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"];
if (me.stars[3 + me.scrollStars] != me.selectedSTAR) { if (me.stars[2 + me.scrollStars] != me.selectedSTAR) {
me.arrowsMatrix[0][4] = 1; me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu"; me.arrowsColour[0][4] = "blu";
} else { } else {
@ -407,21 +494,75 @@ var arrivalPage = {
} }
} }
me.C2 = [nil, "AVAILABLE", "wht"]; me.C3[1] = "AVAILABLE";
me.R2 = [nil, "TRANS ", "wht"]; me.R3[1] = "TRANS ";
if (size(me.stars) > 4) { if (size(me.stars) > 3) {
me.enableScrollStars = 1; me.enableScrollStars = 1;
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateVIAs: func() {
if (getprop("/sim/version/flightgear") != "2020.2.0") { return; }
if (me.selectedApproach == nil or me.activePage != 2) {
me.clearVias();
return;
}
me.vias = [];
me._vias = nil;
me._vias = me.selectedApproach.transitions;
me.vias = sort(me._vias, func(a,b) cmp(a,b));
append(me.vias, "NO VIA");
if (size(me.vias) >= 1) {
me.L2 = [" " ~ me.vias[0 + me.scrollVias], " APP VIAS", "blu"];
if (me.vias[0 + me.scrollVias] != me.selectedVIA) {
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "blu";
} else {
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "ack";
}
}
if (size(me.vias) >= 2) {
me.L3 = [" " ~ me.vias[1 + me.scrollVias], nil, "blu"];
if (me.vias[1 + me.scrollVias] != me.selectedVIA) {
me.arrowsMatrix[0][2] = 1;
me.arrowsColour[0][2] = "blu";
} else {
me.arrowsMatrix[0][2] = 0;
me.arrowsColour[0][2] = "ack";
}
}
if (size(me.vias) >= 3) {
me.L4 = [" " ~ me.vias[2 + me.scrollVias], nil, "blu"];
if (me.vias[2 + me.scrollVias] != me.selectedVIA) {
me.arrowsMatrix[0][3] = 1;
me.arrowsColour[0][3] = "blu";
} else {
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
}
}
if (size(me.vias) >= 4) {
me.L5 = [" " ~ me.vias[3 + me.scrollVias], nil, "blu"];
if (me.vias[3 + me.scrollVias] != me.selectedVIA) {
me.arrowsMatrix[0][4] = 1;
me.arrowsColour[0][4] = "blu";
} else {
me.arrowsMatrix[0][4] = 0;
me.arrowsColour[0][4] = "ack";
}
}
if (size(me.vias) > 3) {
me.enableScrollVias = 1;
}
},
clearTransitions: func() { clearTransitions: func() {
me.R2 = [nil, "TRANS", "wht"]; me.R3 = [nil, nil, "wht"];
me.R3 = [nil, "TRANS", "wht"]; me.R4 = [nil, nil, "wht"];
me.R4 = [nil, "TRANS", "wht"]; me.R5 = [nil, nil, "wht"];
me.R5 = [nil, "TRANS", "wht"];
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
me.arrowsMatrix[1][2] = 0; me.arrowsMatrix[1][2] = 0;
me.arrowsColour[1][2] = "ack"; me.arrowsColour[1][2] = "ack";
me.arrowsMatrix[1][3] = 0; me.arrowsMatrix[1][3] = 0;
@ -429,67 +570,68 @@ var arrivalPage = {
me.arrowsMatrix[1][4] = 0; me.arrowsMatrix[1][4] = 0;
me.arrowsColour[1][4] = "ack"; me.arrowsColour[1][4] = "ack";
}, },
clearVias: func() {
me.L2 = [nil, nil, "wht"];
me.L3 = [nil, nil, "wht"];
me.L4 = [nil, nil, "wht"];
me.L5 = [nil, nil, "wht"];
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "ack";
me.arrowsMatrix[0][2] = 0;
me.arrowsColour[0][2] = "ack";
me.arrowsMatrix[0][3] = 0;
me.arrowsColour[0][3] = "ack";
me.arrowsMatrix[0][4] = 0;
me.arrowsColour[0][4] = "ack";
if (me.activePage == 2) {
me.activePage = me.oldPage;
}
},
updateTransitions: func() { updateTransitions: func() {
if (me.arrAirport == nil) { if (me.arrAirport == nil) {
me.arrAirport = findAirportsByICAO(left(me.id, 4)); me.arrAirport = findAirportsByICAO(left(me.id, 4));
} }
if (me.selectedSTAR == nil) {
me.R2 = ["NO TRANS ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
return;
}
if (me.selectedSTAR == "NO STAR") {
me.transitions = [];
me._transitions = nil;
me.clearTransitions();
if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") {
append(me.transitions, "NO TRANS");
return; return;
} }
if (isghost(me.selectedSTAR)) {
me._transitions = me.arrAirport[0].getStar(me.selectedSTAR.id).transitions;
} else {
me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions; me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions;
}
me.transitions = sort(me._transitions,func(a,b) cmp(a,b)); me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
append(me.transitions, "NO TRANS");
if (size(me.transitions) == 0) { if (size(me.transitions) >= 1) {
me.R2 = ["NO TRANS ", "TRANS", "blu"]; me.R3 = [me.transitions[0] ~ " ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 1) {
me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
if (me.transitions[0] != me.selectedTransition) { if (me.transitions[0] != me.selectedTransition) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 2) {
me.R3 = [me.transitions[1] ~ " ", nil, "blu"];
if (me.transitions[1] != me.selectedTransition) {
me.arrowsMatrix[1][2] = 1; me.arrowsMatrix[1][2] = 1;
me.arrowsColour[1][2] = "blu"; me.arrowsColour[1][2] = "blu";
} else { } else {
me.arrowsMatrix[1][2] = 0; me.arrowsMatrix[1][2] = 0;
me.arrowsColour[1][2] = "ack"; me.arrowsColour[1][2] = "ack";
} }
} elsif (size(me.transitions) >= 3) { }
me.R4 = [me.transitions[2] ~ " ", nil, "blu"]; if (size(me.transitions) >= 2) {
if (me.transitions[2] != me.selectedTransition) { me.R4 = [me.transitions[1] ~ " ", nil, "blu"];
if (me.transitions[1] != me.selectedTransition) {
me.arrowsMatrix[1][3] = 1; me.arrowsMatrix[1][3] = 1;
me.arrowsColour[1][3] = "blu"; me.arrowsColour[1][3] = "blu";
} else { } else {
me.arrowsMatrix[1][3] = 0; me.arrowsMatrix[1][3] = 0;
me.arrowsColour[1][3] = "ack"; me.arrowsColour[1][3] = "ack";
} }
} elsif (size(me.transitions) >= 4) { }
me.R5 = [me.transitions[3] ~ " ", nil, "blu"]; if (size(me.transitions) >= 3) {
if (me.transitions[3] != me.selectedTransition) { me.R5 = [me.transitions[2] ~ " ", nil, "blu"];
if (me.transitions[2] != me.selectedTransition) {
me.arrowsMatrix[1][4] = 1; me.arrowsMatrix[1][4] = 1;
me.arrowsColour[1][4] = "blu"; me.arrowsColour[1][4] = "blu";
} else { } else {
@ -497,6 +639,9 @@ var arrivalPage = {
me.arrowsColour[1][4] = "ack"; me.arrowsColour[1][4] = "ack";
} }
} }
# no indication it is scrollable...
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
@ -510,6 +655,17 @@ var arrivalPage = {
} }
} }
}, },
checkPageType: func() {
if (me.activePage == 0) {
me.L2 = [nil, nil, "wht"];
me.arrowsMatrix[0][1] = 0;
me.arrowsColour[0][1] = "wht";
} elsif (me.activePage == 1) {
me.L2 = [" VIAS", " APPR", "wht"];
me.arrowsMatrix[0][1] = 1;
me.arrowsColour[0][1] = "wht";
}
},
scrollUp: func() { scrollUp: func() {
if (me.activePage == 0) { if (me.activePage == 0) {
if (me.enableScrollApproach) { if (me.enableScrollApproach) {
@ -519,10 +675,10 @@ var arrivalPage = {
} }
me.updateApproaches(); me.updateApproaches();
} }
} else { } elsif (me.activePage == 1) {
if (me.enableScrollStars) { if (me.enableScrollStars) {
me.scrollStars += 1; me.scrollStars += 1;
if (me.scrollStars > size(me.stars) - 4) { if (me.scrollStars > size(me.stars) - 3) {
me.scrollStars = 0; me.scrollStars = 0;
} }
me.updateSTARs(); me.updateSTARs();
@ -531,7 +687,15 @@ var arrivalPage = {
} else { } else {
me.updateTransitions(); me.updateTransitions();
} }
me.hasPressNoTrans = 0; }
} elsif (me.activePage == 2) {
if (me.enableScrollVias) {
me.scrollVias += 1;
if (me.scrollVias > size(me.vias) - 4) {
me.scrollVias = 0;
}
me.updateActiveVIAs();
me.updateVIAs();
} }
} }
}, },
@ -544,11 +708,11 @@ var arrivalPage = {
} }
me.updateApproaches(); me.updateApproaches();
} }
} else { } elsif (me.activePage == 1) {
if (me.enableScrollStars) { if (me.enableScrollStars) {
me.scrollStars -= 1; me.scrollStars -= 1;
if (me.scrollStars < 0) { if (me.scrollStars < 0) {
me.scrollStars = size(me.stars) - 4; me.scrollStars = size(me.stars) - 3;
} }
me.updateSTARs(); me.updateSTARs();
if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") { if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") {
@ -556,24 +720,52 @@ var arrivalPage = {
} else { } else {
me.updateTransitions(); me.updateTransitions();
} }
me.hasPressNoTrans = 0; }
} elsif (me.activePage == 2) {
if (me.enableScrollVias) {
me.scrollVias -= 1;
if (me.scrollVias < 0) {
me.scrollVias = size(me.vias) - 4;
}
me.updateActiveVIAs();
me.updateVIAs();
} }
} }
}, },
scrollLeft: func() { scrollLeft: func() {
if (me.activePage == 2) { return; }
me.activePage = !me.activePage; me.activePage = !me.activePage;
me.checkPageType();
me.updatePage(); me.updatePage();
}, },
scrollRight: func() { scrollRight: func() {
if (me.activePage == 2) { return; }
me.activePage = !me.activePage; me.activePage = !me.activePage;
me.checkPageType();
me.updatePage(); me.updatePage();
}, },
arrPushbuttonLeft: func(index) { arrPushbuttonLeft: func(index) {
if (me.activePage == 0) { if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) {
if (size(me.approaches) >= (index - 2) and index != 2) { if (getprop("/sim/version/flightgear") != "2020.2.0") { return; }
me.oldPage = me.activePage;
me.activePage = 2;
me.updatePage();
me.updateVIAs();
} elsif (index == 6 and me.activePage == 2) {
me.activePage = me.oldPage;
me.oldPage = 0;
me.updatePage();
} elsif (index == 6 and me.activePage != 2) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA");
} else {
setprop("/MCDU[" ~ me.computer ~ "]/page", "LATREV");
}
} elsif (me.activePage == 0 and index != 6) {
if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1
if (!dirToFlag) { if (!dirToFlag) {
me.selectedSTAR = nil; me.selectedVIA = nil;
me.hasPressNoTrans = 0; isNoTransArr[me.computer] = 0;
isNoStar[me.computer] = 0; isNoStar[me.computer] = 0;
me.makeTmpy(); me.makeTmpy();
if (!me.apprIsRwyFlag) { if (!me.apprIsRwyFlag) {
@ -587,20 +779,22 @@ var arrivalPage = {
setprop("FMGC/internal/baro", 99999); setprop("FMGC/internal/baro", 99999);
setprop("FMGC/internal/radio", 99999); setprop("FMGC/internal/radio", 99999);
setprop("FMGC/internal/radio-no", 0); setprop("FMGC/internal/radio-no", 0);
me.updateActiveApproach();
me.updateApproaches(); me.updateApproaches();
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight(); me.scrollRight();
me.checkPageType();
} else { } else {
mcdu_message(me.computer, "DIR TO IN PROGRESS"); mcdu_message(me.computer, "DIR TO IN PROGRESS");
} }
} else { } else {
mcdu_message(me.computer, "NOT ALLOWED"); mcdu_message(me.computer, "NOT ALLOWED");
} }
} else { } elsif (me.activePage == 1 and index != 6) {
if (size(me.stars) >= (index - 2)) { if (size(me.stars) >= (index - 2) and index != 2) {
if (!dirToFlag) { if (!dirToFlag) {
me.selectedSTAR = me.stars[index - 2 + me.scrollStars]; me.selectedTransition = nil;
me.selectedSTAR = me.stars[index - 3 + me.scrollStars];
me.makeTmpy(); me.makeTmpy();
if (me.selectedSTAR != "NO STAR") { if (me.selectedSTAR != "NO STAR") {
isNoStar[me.computer] = 0; isNoStar[me.computer] = 0;
@ -612,15 +806,14 @@ var arrivalPage = {
fmgc.flightPlanController.insertNOSTAR(me.computer); fmgc.flightPlanController.insertNOSTAR(me.computer);
} }
} }
me.updateActiveSTARs();
me.updateSTARs(); me.updateSTARs();
if (me.selectedSTAR != "NO STAR") { if (me.selectedSTAR != "NO STAR") {
me.hasPressNoTrans = 0; isNoTransArr[me.computer] = 0;
me.updateTransitions();
} else { } else {
me.hasPressNoTrans = 1; isNoTransArr[me.computer] = 1;
me.selectedTransition = "NO TRANS";
} }
me.updateActiveTransitions(); me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
mcdu_message(me.computer, "DIR TO IN PROGRESS"); mcdu_message(me.computer, "DIR TO IN PROGRESS");
@ -628,24 +821,44 @@ var arrivalPage = {
} else { } else {
mcdu_message(me.computer, "NOT ALLOWED"); mcdu_message(me.computer, "NOT ALLOWED");
} }
} } elsif (me.activePage == 2 and index != 6) {
}, if (size(me.vias) >= (index - 1)) { # different!!
arrPushbuttonRight: func(index) {
if (index == 2 and size(me.transitions) == 0) {
if (!dirToFlag) { if (!dirToFlag) {
me.hasPressNoTrans = 1; me.selectedVIA = me.vias[index - 2 + me.scrollVias];
me.updateActiveTransitions(); me.makeTmpy();
me.updateTransitions(); if (me.selectedVIA != "NO VIA") {
isNoVia[me.computer] = 0;
fmgc.flightPlanController.flightplans[me.computer].approach_trans = me.selectedVIA;
} else {
isNoVia[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].approach_trans = nil;
}
me.updateVIAs();
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
mcdu_message(me.computer, "DIR TO IN PROGRESS"); mcdu_message(me.computer, "DIR TO IN PROGRESS");
} }
} elsif (size(me.transitions) >= (index - 1)) { } else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
arrPushbuttonRight: func(index) {
if (size(me.transitions) >= (index - 2)) {
if (!dirToFlag) { if (!dirToFlag) {
me.selectedTransition = me.transitions[index - 2]; me.selectedTransition = me.transitions[index - 3];
me.makeTmpy(); me.makeTmpy();
if (me.selectedTransition != "NO TRANS") {
isNoTransArr[me.computer] = 0;
fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition;
me.updateActiveTransitions(); } else {
me.updateTransitions(); isNoTransArr[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].star_trans = nil;
}
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
mcdu_message(me.computer, "DIR TO IN PROGRESS"); mcdu_message(me.computer, "DIR TO IN PROGRESS");

View file

@ -1,4 +1,5 @@
var isNoSid = [0, 0]; var isNoSid = [0, 0, 0];
var isNoTransDep = [0, 0, 0];
var departurePage = { var departurePage = {
title: [nil, nil, nil], title: [nil, nil, nil],
@ -29,18 +30,18 @@ var departurePage = {
selectedRunway: nil, selectedRunway: nil,
selectedSID: nil, selectedSID: nil,
selectedTransition: nil, selectedTransition: nil,
sids: nil,
transitions: nil,
computer: nil, computer: nil,
enableScrollRwy: 0, enableScrollRwy: 0,
enableScrollSids: 0, enableScrollSids: 0,
scrollRwy: 0, scrollRwy: 0,
scrollSids: 0, scrollSids: 0,
activePage: 0, # runways, sids, trans activePage: 0, # runways, sids, trans
hasPressNoTrans: 0, # temporary
_runways: nil, _runways: nil,
_sids: nil, _sids: nil,
_transitions: nil, _transitions: nil,
runways: [],
sids: [],
transitions: [],
new: func(icao, computer) { new: func(icao, computer) {
var page = {parents:[departurePage]}; var page = {parents:[departurePage]};
page.id = icao; page.id = icao;
@ -54,8 +55,9 @@ var departurePage = {
}, },
reset: func() { reset: func() {
isNoSid[me.computer] = 0; isNoSid[me.computer] = 0;
isNoTransDep[me.computer] = 0;
me.selectedSID = nil; me.selectedSID = nil;
me.hasPressNoTrans = 0; me.selectedTransition = nil;
}, },
_setupFirstTime: func() { _setupFirstTime: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
@ -65,9 +67,14 @@ var departurePage = {
if (fmgc.flightPlanController.flightplans[2].sid != nil) { if (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid; me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
isNoSid[me.computer] = 0; isNoSid[me.computer] = 0;
} elsif (isNoSid[me.computer] == 1) { } elsif (isNoSid[2] == 1) {
me.selectedSID = "NO SID"; me.selectedSID = "NO SID";
me.hasPressNoTrans = 1; }
if (isNoTransDep[2]) {
me.selectedTransition = "NO TRANS";
} elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedTransition = fmgc.flightPlanController.flightplans[2].sid_trans;
} }
} else { } else {
if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) { if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
@ -77,15 +84,20 @@ var departurePage = {
} }
if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) { if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid; me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid;
me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].sid_trans;
isNoSid[me.computer] = 0; isNoSid[me.computer] = 0;
} elsif (fmgc.flightPlanController.flightplans[2].sid != nil) { } elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedSID = fmgc.flightPlanController.flightplans[2].sid; me.selectedSID = fmgc.flightPlanController.flightplans[2].sid;
me.selectedTransition = fmgc.flightPlanController.flightplans[2].sid_trans;
isNoSid[me.computer] = 0; isNoSid[me.computer] = 0;
} elsif (isNoSid[me.computer] == 1) { } elsif (isNoSid[me.computer] == 1) {
me.selectedSID = "NO SID"; me.selectedSID = "NO SID";
me.hasPressNoTrans = 1; }
if (isNoTransDep[me.computer] or isNoTransDep[2]) {
me.selectedTransition = "NO TRANS";
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].sid_trans;
} elsif (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.selectedTransition = fmgc.flightPlanController.flightplans[2].sid_trans;
} }
} }
}, },
@ -107,6 +119,7 @@ var departurePage = {
me.updateRunways(); me.updateRunways();
} else { } else {
me.updateSIDs(); me.updateSIDs();
me.updateTransitions();
} }
me.updateActiveRunway(); me.updateActiveRunway();
@ -142,18 +155,20 @@ var departurePage = {
}, },
updateActiveRunway: func() { updateActiveRunway: func() {
if (me.selectedRunway != nil) { if (me.selectedRunway != nil) {
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) { if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"]; me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) { } elsif (fmgc.flightPlanController.flightplans[2].departure_runway != nil and fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) {
me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "yel"];
} else {
me.L1 = ["---", " RWY", "wht"];
}
} else {
if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"]; me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"];
} else { } else {
me.L1 = ["---", " RWY", "wht"]; me.L1 = ["---", " RWY", "wht"];
} }
} elsif (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) {
me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"];
} else {
me.L1 = ["---", " RWY", "wht"];
} }
} else { } else {
me.L1 = ["---", " RWY", "wht"]; me.L1 = ["---", " RWY", "wht"];
@ -168,18 +183,20 @@ var departurePage = {
me.C1 = ["NONE", "SID", "yel"]; me.C1 = ["NONE", "SID", "yel"];
} }
} elsif (me.selectedSID != nil) { } elsif (me.selectedSID != nil) {
if (fmgc.flightPlanController.flightplans[2].sid != nil) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) { if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"]; me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].sid.id == me.selectedSID.id) { } elsif (fmgc.flightPlanController.flightplans[2].sid != nil and fmgc.flightPlanController.flightplans[2].sid.id == me.selectedSID.id) {
me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "SID", "wht"];
}
} else {
if (fmgc.flightPlanController.flightplans[2].sid != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"]; me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"];
} else { } else {
me.C1 = ["------- ", "SID", "wht"]; me.C1 = ["------- ", "SID", "wht"];
} }
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) {
me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"];
} else {
me.C1 = ["------- ", "SID", "wht"];
} }
} else { } else {
me.C1 = ["------- ", "SID", "wht"]; me.C1 = ["------- ", "SID", "wht"];
@ -187,30 +204,32 @@ var departurePage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateActiveTransitions: func() { updateActiveTransitions: func() {
if (!me.hasPressNoTrans) { if (me.selectedTransition == "NO TRANS") {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.flightplans[2].sid_trans != nil) {
if (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "TRANS", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].sid_trans.id == me.selectedTransition.id) {
me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "TRANS", "grn"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} elsif (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "SID", "yel"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.R1 = ["NONE", "TRANS ", "grn"]; me.R1 = ["NONE", "TRANS ", "grn"];
} else { } else {
me.R1 = ["NONE", "TRANS ", "yel"]; me.R1 = ["NONE", "TRANS ", "yel"];
} }
} else {
if (me.selectedTransition != nil) {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (fmgc.flightPlanController.flightplans[me.computer].sid_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[me.computer].sid_trans.id, "TRANS", "yel"];
} elsif (fmgc.flightPlanController.flightplans[2].sid_trans != nil and fmgc.flightPlanController.flightplans[2].sid_trans.id == me.selectedTransition.id) {
me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "TRANS", "yel"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} else {
if (fmgc.flightPlanController.flightplans[2].sid_trans != nil) {
me.R1 = [fmgc.flightPlanController.flightplans[2].sid_trans.id, "SID", "grn"];
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
}
} else {
me.R1 = ["-------", "TRANS ", "wht"];
}
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
@ -218,6 +237,10 @@ var departurePage = {
if (me.depAirport == nil) { if (me.depAirport == nil) {
me.depAirport = findAirportsByICAO(left(me.id, 4)); me.depAirport = findAirportsByICAO(left(me.id, 4));
} }
me.runways = [];
me._runways = nil;
me._runways = keys(me.depAirport[0].runways); me._runways = keys(me.depAirport[0].runways);
me.runways = sort(me._runways,func(a,b) cmp(a,b)); me.runways = sort(me._runways,func(a,b) cmp(a,b));
@ -279,6 +302,10 @@ var departurePage = {
if (me.depAirport == nil) { if (me.depAirport == nil) {
me.depAirport = findAirportsByICAO(left(me.id, 4)); me.depAirport = findAirportsByICAO(left(me.id, 4));
} }
me.sids = [];
me._sids = nil;
if (me.selectedRunway != nil) { if (me.selectedRunway != nil) {
me._sids = me.depAirport[0].sids(me.selectedRunway.id); me._sids = me.depAirport[0].sids(me.selectedRunway.id);
} else { } else {
@ -334,8 +361,8 @@ var departurePage = {
} }
} }
me.C2 = [nil, "AVAILABLE", "wht"]; me.C2[1] = "AVAILABLE";
me.R2 = [nil, "TRANS ", "wht"]; me.R2[1] = "TRANS ";
if (size(me.sids) > 4) { if (size(me.sids) > 4) {
me.enableScrollSids = 1; me.enableScrollSids = 1;
@ -361,30 +388,22 @@ var departurePage = {
me.depAirport = findAirportsByICAO(left(me.id, 4)); me.depAirport = findAirportsByICAO(left(me.id, 4));
} }
if (me.selectedSID == nil) { me.clearTransitions();
me.R2 = ["NO TRANS ", "TRANS", "blu"]; if (me.selectedSID == nil or me.selectedSID == "NO SID") {
if (!me.hasPressNoTrans) { append(me.transitions, "NO TRANS");
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
return; return;
} }
if (isghost(me.selectedSID)) {
me._transitions = me.depAirport[0].getSid(me.selectedSID.id).transitions;
} else {
me._transitions = me.depAirport[0].getSid(me.selectedSID).transitions;
}
me._transitions = me.depAirport[0].getSid(me.selectedSID).transitions; me._transitions = me.depAirport[0].getSid(me.selectedSID).transitions;
me.transitions = sort(me._transitions,func(a,b) cmp(a,b)); me.transitions = sort(me._transitions,func(a,b) cmp(a,b));
append(me.transitions, "NO TRANS");
if (size(me.transitions) == 0) { if (size(me.transitions) >= 1) {
me.R2 = ["NO TRANS ", "TRANS", "blu"];
if (!me.hasPressNoTrans) {
me.arrowsMatrix[1][1] = 1;
me.arrowsColour[1][1] = "blu";
} else {
me.arrowsMatrix[1][1] = 0;
me.arrowsColour[1][1] = "ack";
}
} elsif (size(me.transitions) >= 1) {
me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"]; me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"];
if (me.transitions[0] != me.selectedTransition) { if (me.transitions[0] != me.selectedTransition) {
me.arrowsMatrix[1][1] = 1; me.arrowsMatrix[1][1] = 1;
@ -421,6 +440,7 @@ var departurePage = {
me.arrowsColour[1][4] = "ack"; me.arrowsColour[1][4] = "ack";
} }
} }
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
@ -455,7 +475,6 @@ var departurePage = {
} else { } else {
me.updateTransitions(); me.updateTransitions();
} }
me.hasPressNoTrans = 0;
} }
} }
}, },
@ -480,7 +499,6 @@ var departurePage = {
} else { } else {
me.updateTransitions(); me.updateTransitions();
} }
me.hasPressNoTrans = 0;
} }
} }
}, },
@ -498,12 +516,12 @@ var departurePage = {
if (!dirToFlag) { if (!dirToFlag) {
me.selectedSID = nil; me.selectedSID = nil;
isNoSid[me.computer] = 0; isNoSid[me.computer] = 0;
me.hasPressNoTrans = 0; isNoTransDep[me.computer] = 0;
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]); me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]);
me.makeTmpy(); me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway; fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway;
me.updateActiveRunway();
me.updateRunways(); me.updateRunways();
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight(); me.scrollRight();
} else { } else {
@ -519,21 +537,20 @@ var departurePage = {
me.makeTmpy(); me.makeTmpy();
if (me.selectedSID != "NO SID") { if (me.selectedSID != "NO SID") {
isNoSid[me.computer] = 0; isNoSid[me.computer] = 0;
fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID; fmgc.flightPlanController.flightplans[me.computer].sid = me.depAirport[0].getSid(me.selectedSID);
} else { } else {
isNoSid[me.computer] = 1; isNoSid[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].sid = nil; fmgc.flightPlanController.flightplans[me.computer].sid = nil;
fmgc.flightPlanController.insertNOSID(me.computer); fmgc.flightPlanController.insertNOSID(me.computer);
} }
me.updateActiveSIDs();
me.updateSIDs(); me.updateSIDs();
if (me.selectedSID != "NO SID") { if (me.selectedSID != "NO SID") {
me.hasPressNoTrans = 0; isNoTransDep[me.computer] = 0;
me.updateTransitions();
} else { } else {
me.hasPressNoTrans = 1; isNoTransDep[me.computer] = 1;
me.selectedTransition = "NO TRANS";
} }
me.updateActiveTransitions(); me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
mcdu_message(me.computer, "DIR TO IN PROGRESS"); mcdu_message(me.computer, "DIR TO IN PROGRESS");
@ -544,21 +561,18 @@ var departurePage = {
} }
}, },
depPushbuttonRight: func(index) { depPushbuttonRight: func(index) {
if (index == 2 and size(me.transitions) == 0) { if (size(me.transitions) >= (index - 1)) {
if (!dirToFlag) {
me.hasPressNoTrans = 1;
me.updateActiveTransitions();
me.updateTransitions();
} else {
mcdu_message(me.computer, "DIR TO IN PROGRESS");
}
} elsif (size(me.transitions) >= (index - 1)) {
if (!dirToFlag) { if (!dirToFlag) {
me.selectedTransition = me.transitions[index - 2]; me.selectedTransition = me.transitions[index - 2];
me.makeTmpy(); me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].sid_trans = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition); if (me.selectedTransition != "NO TRANS") {
me.updateActiveTransitions(); isNoTransDep[me.computer] = 0;
me.updateTransitions(); fmgc.flightPlanController.flightplans[me.computer].sid_trans = me.selectedTransition;
} else {
isNoTransDep[me.computer] = 1;
fmgc.flightPlanController.flightplans[me.computer].sid_trans = nil;
}
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);
} else { } else {
mcdu_message(me.computer, "DIR TO IN PROGRESS"); mcdu_message(me.computer, "DIR TO IN PROGRESS");

View file

@ -7,6 +7,7 @@ var fplnItem = {
fI.computer = computer; fI.computer = computer;
fI.colour = colour; fI.colour = colour;
fI.assembledStr = [nil, nil, colour]; fI.assembledStr = [nil, nil, colour];
fI._colour = "wht";
return fI; return fI;
}, },
updateLeftText: func() { updateLeftText: func() {
@ -39,8 +40,10 @@ var fplnItem = {
if (me.wp.wp_name != "DISCONTINUITY") { if (me.wp.wp_name != "DISCONTINUITY") {
if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue() - 1 and fmgc.flightPlanController.fromWptTime != nil) { if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue() - 1 and fmgc.flightPlanController.fromWptTime != nil) {
me.assembledStr[0] = fmgc.flightPlanController.fromWptTime ~ " "; me.assembledStr[0] = fmgc.flightPlanController.fromWptTime ~ " ";
me.assembledStr[2] = "grn";
} else { } else {
me.assembledStr[0] = "---- "; me.assembledStr[0] = "---- ";
me.assembledStr[2] = "wht";
} }
if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue()) { if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue()) {
@ -65,7 +68,11 @@ var fplnItem = {
me.spd = me.getSpd(); me.spd = me.getSpd();
me.alt = me.getAlt(); me.alt = me.getAlt();
me.dist = me.getDist(); me.dist = me.getDist();
return [me.spd ~ "/" ~ me.alt, " " ~ me.dist ~ "NM ", me.colour]; me._colour = "wht";
if (me.spd[1] != "wht" or me.alt[1] != "wht") {
me._colour = "mag";
}
return [me.spd[0] ~ "/" ~ me.alt[0], " " ~ me.dist ~ "NM ", me._colour];
} else { } else {
return [nil, nil, "ack"]; return [nil, nil, "ack"];
} }
@ -88,18 +95,26 @@ var fplnItem = {
}, },
getSpd: func() { getSpd: func() {
if (me.index == 0 and getprop("FMGC/internal/v1-set")) { if (me.index == 0 and getprop("FMGC/internal/v1-set")) {
return sprintf("%3.0f", math.round(getprop("FMGC/internal/v1"))); return [sprintf("%3.0f", math.round(getprop("FMGC/internal/v1"))), "mag"];
} elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr != 0) {
return [sprintf("%3.0f", me.wp.speed_cstr), "mag"];
} else { } else {
return "---"; return ["---", "wht"];
} }
}, },
getAlt: func() { getAlt: func() {
if (me.index == 0 and left(me.wp.wp_name, 4) == getprop("/FMGC/internal/dep-arpt") and fmgc.flightPlanController.flightplans[me.plan].departure != nil) { if (me.index == 0 and left(me.wp.wp_name, 4) == getprop("/FMGC/internal/dep-arpt") and fmgc.flightPlanController.flightplans[me.plan].departure != nil) {
return sprintf("%6.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)); return [" " ~ sprintf("%-5.0f", math.round(fmgc.flightPlanController.flightplans[me.plan].departure.elevation * M2FT)), "mag"];
} elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) { } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1) and fmgc.flightPlanController.fromWptAlt != nil) {
return " " ~ fmgc.flightPlanController.fromWptAlt; return [" " ~ fmgc.flightPlanController.fromWptAlt, "mag"];
} elsif (me.wp.alt_cstr != nil and me.wp.alt_cstr != 0) {
if (me.wp.alt_cstr > fmgc.FMGCInternal.transAlt) {
return [" " ~ sprintf("%-5s", "FL" ~ math.round(num(me.wp.alt_cstr) / 100)), "mag"];
} else { } else {
return "------"; return [" " ~ sprintf("%-5.0f", me.wp.alt_cstr), "mag"];
}
} else {
return ["------", "wht"];
} }
}, },
getDist: func() { getDist: func() {
@ -216,17 +231,6 @@ var fplnPage = { # this one is only created once, and then updated - remember th
R5: [nil, nil, "ack"], R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"], R6: [nil, nil, "ack"],
# init conditions
# line 1 = FROM
# line 2 = TO
# line 6 = DEST
# neither pseudo nor markers may be FROM waypoint
# bearing between FROM and TO waypoints
# track between line 2 and line 3 waypoints
# name of LEG above TO waypoint - is airway identifier, or waypoint name
# DEST in LINE 6 time prediction, distance along flightplan, and EFOB
# dashes if no predictions
planList: [], planList: [],
outputList: [], outputList: [],
scroll: 0, scroll: 0,

View file

@ -33,7 +33,9 @@ var fuelPredInput = func(key, i) {
if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) { if (key == "L3" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating")) {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel"))); setprop("/FMGC/internal/rte-rsv", 0.05 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", 5.0); setprop("/FMGC/internal/rte-percent", 5.0);
setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else if (getprop("/FMGC/internal/trip-fuel") != 0) { } else if (getprop("/FMGC/internal/trip-fuel") != 0) {
@ -43,17 +45,21 @@ var fuelPredInput = func(key, i) {
var perc = num(split("/", scratchpad)[1]); var perc = num(split("/", scratchpad)[1]);
if (perc != nil and perc >= 0.0 and perc <= 15.0) { if (perc != nil and perc >= 0.0 and perc <= 15.0) {
setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel"))); setprop("/FMGC/internal/rte-rsv", num(perc) / 100 * num(getprop("/FMGC/internal/trip-fuel")));
setprop("/FMGC/internal/rte-rsv-set", 0);
setprop("/FMGC/internal/rte-percent", perc); setprop("/FMGC/internal/rte-percent", perc);
setprop("/FMGC/internal/rte-percent-set", 1);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} }
} else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) { } else if (tfs >= 1 and tfs <= 4 and tf != nil and tf >= 0 and tf <= 21.7) {
setprop("/FMGC/internal/rte-rsv", scratchpad); setprop("/FMGC/internal/rte-rsv", scratchpad);
setprop("/FMGC/internal/rte-rsv-set", 1);
if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) { if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) {
setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100); setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100);
} else { } else {
setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value setprop("/FMGC/internal/rte-percent", 15.0); # need reasearch on this value
} }
setprop("/FMGC/internal/rte-percent-set", 0);
setprop("/FMGC/internal/fuel-calculating", 1); setprop("/FMGC/internal/fuel-calculating", 1);
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {

View file

@ -471,7 +471,9 @@ var lskbutton = func(btn, i) {
canvas_mcdu.myFpln[i].pushButtonLeft(6); canvas_mcdu.myFpln[i].pushButtonLeft(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV" or getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV" or getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV" or getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV" or getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") {
setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE" or getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL" or getprop("/MCDU[" ~ i ~ "]/page") == "HOLD") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonLeft(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE" or getprop("/MCDU[" ~ i ~ "]/page") == "HOLD") {
if (fmgc.flightPlanController.temporaryFlag[i]) { if (fmgc.flightPlanController.temporaryFlag[i]) {
setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA");
} else { } else {

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!-- IT-GUI --> <!-- IT-GUI (Airbus) -->
<!-- Copyright (c) 2020 Josh Davidson (Octal450) --> <!-- Copyright (c) 2020 Josh Davidson (Octal450) -->
@ -10,21 +10,21 @@
<colors n="0"> <colors n="0">
<background n="0"> <background n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.213</blue> <blue>0.17</blue>
<green>0.199</green> <green>0.17</green>
<red>0.191</red> <red>0.17</red>
</background> </background>
<button n="0"> <button n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.13</blue>
<green>0.2</green> <green>0.13</green>
<red>0.2</red> <red>0.13</red>
</button> </button>
<checkbox-foreground n="0"> <checkbox-foreground n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.173</blue> <blue>0.19</blue>
<green>0.169</green> <green>0.19</green>
<red>0.161</red> <red>0.19</red>
</checkbox-foreground> </checkbox-foreground>
<checkbox-highlight n="0"> <checkbox-highlight n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -40,9 +40,9 @@
</checkbox-misc> </checkbox-misc>
<combo-editfield n="0"> <combo-editfield n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</combo-editfield> </combo-editfield>
<dial-misc n="0"> <dial-misc n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -58,9 +58,9 @@
</hrule> </hrule>
<input n="0"> <input n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</input> </input>
<input-legend n="0"> <input-legend n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -82,21 +82,21 @@
</radio-foreground> </radio-foreground>
<select-editfield n="0"> <select-editfield n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</select-editfield> </select-editfield>
<slider n="0"> <slider n="0">
<alpha>1.0</alpha> <alpha>1.0</alpha>
<blue>0.4</blue> <blue>0.33</blue>
<green>0.4</green> <green>0.33</green>
<red>0.4</red> <red>0.33</red>
</slider> </slider>
<textbox-editable n="0"> <textbox-editable n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</textbox-editable> </textbox-editable>
<vrule n="0"> <vrule n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -111,21 +111,21 @@
<colors n="0"> <colors n="0">
<background n="0"> <background n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.213</blue> <blue>0.17</blue>
<green>0.199</green> <green>0.17</green>
<red>0.191</red> <red>0.17</red>
</background> </background>
<button n="0"> <button n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.13</blue>
<green>0.2</green> <green>0.13</green>
<red>0.2</red> <red>0.13</red>
</button> </button>
<checkbox-foreground n="0"> <checkbox-foreground n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.173</blue> <blue>0.19</blue>
<green>0.169</green> <green>0.19</green>
<red>0.161</red> <red>0.19</red>
</checkbox-foreground> </checkbox-foreground>
<checkbox-highlight n="0"> <checkbox-highlight n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -135,15 +135,15 @@
</checkbox-highlight> </checkbox-highlight>
<checkbox-misc n="0"> <checkbox-misc n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.9</blue> <blue>0.8</blue>
<green>0.9</green> <green>0.58</green>
<red>0.9</red> <red>0.44</red>
</checkbox-misc> </checkbox-misc>
<combo-editfield n="0"> <combo-editfield n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</combo-editfield> </combo-editfield>
<dial-misc n="0"> <dial-misc n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -159,9 +159,9 @@
</hrule> </hrule>
<input n="0"> <input n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</input> </input>
<input-legend n="0"> <input-legend n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
@ -183,21 +183,21 @@
</radio-foreground> </radio-foreground>
<select-editfield n="0"> <select-editfield n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</select-editfield> </select-editfield>
<slider n="0"> <slider n="0">
<alpha>1.0</alpha> <alpha>1.0</alpha>
<blue>0.4</blue> <blue>0.33</blue>
<green>0.4</green> <green>0.33</green>
<red>0.4</red> <red>0.33</red>
</slider> </slider>
<textbox-editable n="0"> <textbox-editable n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>
<blue>0.2</blue> <blue>0.33</blue>
<green>0.2</green> <green>0.33</green>
<red>0.2</red> <red>0.33</red>
</textbox-editable> </textbox-editable>
<vrule n="0"> <vrule n="0">
<alpha>0.95</alpha> <alpha>0.95</alpha>