1
0
Fork 0

DIRTO improved - added tmpy conflict with dirto error messages

This commit is contained in:
legoboyvdlp R 2020-03-28 15:53:50 +00:00
parent fa5eaa2a7a
commit 6bc4169e89
8 changed files with 296 additions and 97 deletions

View file

@ -3609,8 +3609,20 @@ var canvas_MCDU_base = {
me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].setText("X/X");
me["Simple_PageNum"].hide(); me["Simple_PageNum"].hide();
me["Simple_Title"].show(); me["Simple_Title"].show();
me["ArrowLeft"].hide(); me["ArrowLeft"].show();
me["ArrowRight"].hide(); me["ArrowRight"].show();
me["Simple_L1_Arrow"].hide();
me["Simple_L2_Arrow"].hide();
me["Simple_L3_Arrow"].hide();
me["Simple_L4_Arrow"].hide();
me["Simple_L5_Arrow"].hide();
me["Simple_L6_Arrow"].show();
me["Simple_R1_Arrow"].hide();
me["Simple_R2_Arrow"].hide();
me["Simple_R3_Arrow"].hide();
me["Simple_R4_Arrow"].hide();
me["Simple_R5_Arrow"].hide();
me["Simple_R6_Arrow"].hide();
me.fontLeft(default, default, default, default, default, default); me.fontLeft(default, default, default, default, default, default);
me.fontLeftS(default, default, default, default, default, default); me.fontLeftS(default, default, default, default, default, default);
@ -3621,13 +3633,13 @@ var canvas_MCDU_base = {
me.fontSizeRight(normal, normal, normal, normal, normal, normal); me.fontSizeRight(normal, normal, normal, normal, normal, normal);
me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
if (myDirTo[i] != nil) { if (myDirTo[i] != nil) {
me["Simple_Title"].setText(sprintf("%s", myDirTo[i].title)); me["Simple_Title"].setText(sprintf("%s", myDirTo[i].title[0]));
me["Simple_Title"].setColor(getprop("MCDUC/colors/" ~ myDirTo[i].titleColour ~ "/r"), getprop("MCDUC/colors/" ~ myDirTo[i].titleColour ~ "/g"), getprop("MCDUC/colors/" ~ myDirTo[i].titleColour ~ "/b"));
forindex (var matrixArrow; myDirTo[i].arrowsMatrix) { forindex (var matrixArrow; myDirTo[i].arrowsMatrix) {
if (matrixArrow == 0) { if (matrixArrow == 0) {
var sign = "L"; var sign = "L";
@ -3635,14 +3647,19 @@ var canvas_MCDU_base = {
var sign = "R"; var sign = "R";
} }
forindex (var item; myDirTo[i].arrowsMatrix[matrixArrow]) { forindex (var item; myDirTo[i].arrowsMatrix[matrixArrow]) {
if (item == 5) {
me["Simple_L6_Arrow"].setColor(getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[0][5] ~ "/r"), getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[0][5] ~ "/g"), getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[0][5] ~ "/b"));
continue;
}
if (myDirTo[i].arrowsMatrix[matrixArrow][item] == 1) { if (myDirTo[i].arrowsMatrix[matrixArrow][item] == 1) {
me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show(); me["arrow" ~ (item + 1) ~ sign].show();
me["arrow" ~ (item + 1) ~ sign].setColor(getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[matrixArrow][item] ~ "/r"), getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[matrixArrow][item] ~ "/g"), getprop("MCDUC/colors/" ~ myDirTo[i].arrowsColour[matrixArrow][item] ~ "/b"));
} else { } else {
me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide(); me["arrow" ~ (item + 1) ~ sign].hide();
} }
} }
} }
me.colorLeftArrow(myDirTo[i].arrowsColour[0][0],myDirTo[i].arrowsColour[0][1],myDirTo[i].arrowsColour[0][2],myDirTo[i].arrowsColour[0][3],myDirTo[i].arrowsColour[0][4],myDirTo[i].arrowsColour[0][5]);
forindex (var matrixFont; myDirTo[i].fontMatrix) { forindex (var matrixFont; myDirTo[i].fontMatrix) {

View file

@ -69,6 +69,9 @@ var flightPlanController = {
me.resetFlightplan(n); me.resetFlightplan(n);
me.flightplans[n] = me.flightplans[2].clone(); me.flightplans[n] = me.flightplans[2].clone();
me.temporaryFlag[n] = 1; me.temporaryFlag[n] = 1;
if (canvas_mcdu.myDirTo[n] != nil) {
canvas_mcdu.myDirTo[n].updateTmpy();
}
me.flightPlanChanged(n); me.flightPlanChanged(n);
}, },
@ -82,6 +85,9 @@ var flightPlanController = {
} }
me.resetFlightplan(n); me.resetFlightplan(n);
me.temporaryFlag[n] = 0; me.temporaryFlag[n] = 0;
if (canvas_mcdu.myDirTo[n] != nil) {
canvas_mcdu.myDirTo[n].updateTmpy();
}
}, },
updateAirports: func(dep, arr, plan) { updateAirports: func(dep, arr, plan) {
@ -336,6 +342,12 @@ var flightPlanController = {
}, },
scratchpad: func(text, index, plan) { # return 0 not in database, 1 not allowed, 2 success scratchpad: func(text, index, plan) { # return 0 not in database, 1 not allowed, 2 success
if (mcdu.dirToFlag) {
setprop("MCDU[" ~ plan ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ plan ~ "]/scratchpad", "DIR TO IN PROGRESS");
return;
}
if (!fmgc.flightPlanController.temporaryFlag[plan]) { if (!fmgc.flightPlanController.temporaryFlag[plan]) {
if (text == "CLR" and me.flightplans[2].getWP(index).wp_name == "DISCONTINUITY") { if (text == "CLR" and me.flightplans[2].getWP(index).wp_name == "DISCONTINUITY") {
var thePlan = 2; var thePlan = 2;
@ -394,7 +406,9 @@ var flightPlanController = {
wpDistance[n][wpt].setValue(waypointHashStore.courseAndDistanceFrom(curAircraftPos)[1]); wpDistance[n][wpt].setValue(waypointHashStore.courseAndDistanceFrom(curAircraftPos)[1]);
if (wpt == 1) { if (wpt == 1) {
me._arrivalDist += courseDistanceFrom[1]; # distance to next waypoint, therafter to end of flightplan if (me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) {
me._arrivalDist += courseDistanceFrom[1]; # distance to next waypoint, therafter to end of flightplan
}
} }
if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) { if (left(wpID[n][wpt].getValue(), 4) == FMGCarr.getValue() and wpt != 0) {
@ -404,27 +418,13 @@ var flightPlanController = {
} }
if (wpt > 0) { if (wpt > 0) {
if (me.flightplans[n].getWP(wpt).id == "DISCONTINUITY") { geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon);
if (me.flightplans[n].getWP(wpt - 1).id == "DISCONTINUITY") {
if (wpt >= 2) {
geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 2).lat, me.flightplans[n].getWP(wpt - 2).lon);
}
} else {
geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon);
}
} elsif (me.flightplans[n].getWP(wpt - 1).id == "DISCONTINUITY") {
if (wpt >= 2) {
geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 2).lat, me.flightplans[n].getWP(wpt - 2).lon);
}
} else {
geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon);
}
courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev); courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev);
wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]); wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]);
wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]); wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]);
if (wpt > 1) { if (wpt > 1) {
if (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]) { 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]) {
me._arrivalDist += courseDistanceFromPrev[1]; # todo - buggy. Neglect discontinuity me._arrivalDist += courseDistanceFromPrev[1]; # todo - buggy. Neglect discontinuity
} }
} }
@ -502,6 +502,9 @@ var flightPlanController = {
if (canvas_mcdu.myFpln[i] != nil) { if (canvas_mcdu.myFpln[i] != nil) {
canvas_mcdu.myFpln[i].updatePlan(); canvas_mcdu.myFpln[i].updatePlan();
} }
if (canvas_mcdu.myDirTo[i] != nil) {
canvas_mcdu.myDirTo[i].updateFromFpln();
}
} }
}, },
}; };

View file

@ -388,10 +388,15 @@ var arrivalPage = {
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); if (!dirToFlag) {
me.L6 = [" F-PLN", " TMPY", "yel"]; fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
me.arrowsColour[0][5] = "yel"; me.L6 = [" F-PLN", " TMPY", "yel"];
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} }
}, },
scrollUp: func() { scrollUp: func() {
@ -455,28 +460,38 @@ var arrivalPage = {
arrPushbuttonLeft: func(index) { arrPushbuttonLeft: func(index) {
if (me.activePage == 0) { if (me.activePage == 0) {
if (size(me.approaches) >= (index - 1) and index != 2) { if (size(me.approaches) >= (index - 1) and index != 2) {
me.selectedApproach = me.arrAirport[0].getIAP(me.approaches[index - 3 + me.scrollApproach]); if (!dirToFlag) {
me.makeTmpy(); me.selectedApproach = me.arrAirport[0].getIAP(me.approaches[index - 3 + me.scrollApproach]);
fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.arrAirport[0].runways[me.selectedApproach.runways[0]]; me.makeTmpy();
fmgc.flightPlanController.flightplans[me.computer].approach = me.selectedApproach; fmgc.flightPlanController.flightplans[me.computer].destination_runway = me.arrAirport[0].runways[me.selectedApproach.runways[0]];
me.updateActiveApproach(); fmgc.flightPlanController.flightplans[me.computer].approach = me.selectedApproach;
me.updateApproaches(); me.updateActiveApproach();
fmgc.flightPlanController.flightPlanChanged(me.computer); me.updateApproaches();
me.scrollRight(); fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }
} else { } else {
if (size(me.stars) >= (index - 1)) { if (size(me.stars) >= (index - 1)) {
me.selectedSTAR = me.stars[index - 2 + me.scrollStars]; if (!dirToFlag) {
me.makeTmpy(); me.selectedSTAR = me.stars[index - 2 + me.scrollStars];
fmgc.flightPlanController.flightplans[me.computer].star = me.arrAirport[0].getStar(me.selectedSTAR); me.makeTmpy();
me.updateActiveSTARs(); fmgc.flightPlanController.flightplans[me.computer].star = me.arrAirport[0].getStar(me.selectedSTAR);
me.updateSTARs(); me.updateActiveSTARs();
me.hasPressNoTrans = 0; me.updateSTARs();
me.updateTransitions(); me.hasPressNoTrans = 0;
me.updateActiveTransitions(); me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }
@ -484,16 +499,26 @@ var arrivalPage = {
}, },
arrPushbuttonRight: func(index) { arrPushbuttonRight: func(index) {
if (index == 2 and size(me.transitions) == 0) { if (index == 2 and size(me.transitions) == 0) {
me.hasPressNoTrans = 1; if (!dirToFlag) {
me.updateActiveTransitions(); me.hasPressNoTrans = 1;
me.updateTransitions(); me.updateActiveTransitions();
me.updateTransitions();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} elsif (size(me.transitions) >= (index - 1)) { } elsif (size(me.transitions) >= (index - 1)) {
me.selectedTransition = me.transitions[index - 2]; if (!dirToFlag) {
me.makeTmpy(); me.selectedTransition = me.transitions[index - 2];
fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; me.makeTmpy();
me.updateActiveTransitions(); fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition;
me.updateTransitions(); me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }

View file

@ -391,10 +391,15 @@ var departurePage = {
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); if (!dirToFlag) {
me.L6 = [" F-PLN", " TMPY", "yel"]; fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
me.arrowsColour[0][5] = "yel"; me.L6 = [" F-PLN", " TMPY", "yel"];
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); me.arrowsColour[0][5] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} }
}, },
scrollUp: func() { scrollUp: func() {
@ -458,27 +463,37 @@ var departurePage = {
depPushbuttonLeft: func(index) { depPushbuttonLeft: func(index) {
if (me.activePage == 0) { if (me.activePage == 0) {
if (size(me.runways) >= (index - 1)) { if (size(me.runways) >= (index - 1)) {
me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]); if (!dirToFlag) {
me.makeTmpy(); me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]);
fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway; me.makeTmpy();
me.updateActiveRunway(); fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway;
me.updateRunways(); me.updateActiveRunway();
fmgc.flightPlanController.flightPlanChanged(me.computer); me.updateRunways();
me.scrollRight(); fmgc.flightPlanController.flightPlanChanged(me.computer);
me.scrollRight();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }
} else { } else {
if (size(me.sids) >= (index - 1)) { if (size(me.sids) >= (index - 1)) {
me.selectedSID = me.sids[index - 2 + me.scrollSids]; if (!dirToFlag) {
me.makeTmpy(); me.selectedSID = me.sids[index - 2 + me.scrollSids];
fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID; me.makeTmpy();
me.updateActiveSIDs(); fmgc.flightPlanController.flightplans[me.computer].sid = me.selectedSID;
me.updateSIDs(); me.updateActiveSIDs();
me.hasPressNoTrans = 0; me.updateSIDs();
me.updateTransitions(); me.hasPressNoTrans = 0;
me.updateActiveTransitions(); me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }
@ -486,16 +501,26 @@ var departurePage = {
}, },
depPushbuttonRight: func(index) { depPushbuttonRight: func(index) {
if (index == 2 and size(me.transitions) == 0) { if (index == 2 and size(me.transitions) == 0) {
me.hasPressNoTrans = 1; if (!dirToFlag) {
me.updateActiveTransitions(); me.hasPressNoTrans = 1;
me.updateTransitions(); me.updateActiveTransitions();
me.updateTransitions();
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} elsif (size(me.transitions) >= (index - 1)) { } elsif (size(me.transitions) >= (index - 1)) {
me.selectedTransition = me.transitions[index - 2]; if (!dirToFlag) {
me.makeTmpy(); me.selectedTransition = me.transitions[index - 2];
fmgc.flightPlanController.flightplans[me.computer].sid = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition); me.makeTmpy();
me.updateActiveTransitions(); fmgc.flightPlanController.flightplans[me.computer].sid = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition);
me.updateTransitions(); me.updateActiveTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer); me.updateTransitions();
fmgc.flightPlanController.flightPlanChanged(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
} else { } else {
notAllowed(me.computer); notAllowed(me.computer);
} }

View file

@ -1,3 +1,5 @@
var dirToFlag = 0;
var dirTo = { var dirTo = {
title: [nil], title: [nil],
subtitle: [nil, nil], subtitle: [nil, nil],
@ -16,6 +18,8 @@ var dirTo = {
R4: [nil, nil, "ack"], R4: [nil, nil, "ack"],
R5: [nil, nil, "ack"], R5: [nil, nil, "ack"],
R6: [nil, nil, "ack"], R6: [nil, nil, "ack"],
scroll: 0,
vector: [],
index: nil, index: nil,
computer: nil, computer: nil,
new: func(computer) { new: func(computer) {
@ -29,22 +33,122 @@ var dirTo = {
}, },
_setupPageWithData: func() { _setupPageWithData: func() {
me.title = ["DIR TO"]; me.title = ["DIR TO"];
me.titleColour = "wht";
me.L1 = [" [ ]", " WAYPOINT", "blu"]; me.L1 = [" [ ]", " WAYPOINT", "blu"];
me.L2 = [nil, " F-PLN WPTS", "blu"]; me.L2 = [nil, " F-PLN WPTS", "blu"];
me.L6 = [" ERASE", " DIR TO", "yel"]; me.L3 = [nil, nil, "blu"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"]; me.L4 = [nil, nil, "blu"];
me.L5 = [nil, nil, "blu"];
me.L6 = [" ERASE", " DIR TO", "yel"];
me.R1 = ["---- --- ", "UTC DIST ", "wht"];
me.R2 = ["DIRECT TO ", nil, "blu"]; me.R2 = ["DIRECT TO ", nil, "blu"];
me.R3 = ["ABEAM PTS ", "WITH ", "blu"]; me.R3 = ["ABEAM PTS ", "WITH ", "blu"];
me.R4 = ["[ ] ", "RADIAL IN ", "blu"]; me.R4 = ["[ ] ", "RADIAL IN ", "blu"];
me.R5 = ["[ ] ", "RADIAL OUT ", "blu"]; me.R5 = ["[ ] ", "RADIAL OUT ", "blu"];
me.arrowsMatrix = [[0, 1, 1, 1, 1, 1], [0, 1, 0, 1, 0, 0]]; me.R6 = ["INSERT* ", "DIR TO ", "yel"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 0, 0]];
me.arrowsColour = [["ack", "blu", "blu", "blu", "blu", "yel"], ["ack", "blu", "ack", "blu", "ack", "ack"]]; me.arrowsColour = [["ack", "blu", "blu", "blu", "blu", "yel"], ["ack", "blu", "ack", "blu", "ack", "ack"]];
me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]];
me.updateFromFpln();
me.updateTmpy();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} }
dirToFlag = 1;
},
insertDirTo: func() {
dirToFlag = 0;
},
updateTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L6 = [" ERASE", " DIR TO", "yel"];
me.R6 = ["INSERT ", "DIR TO ", "yel"];
me.arrowsMatrix[0][5] = 1;
me.L1[2] = "yel";
me.R2[2] = "yel";
me.titleColour = "yel";
} else {
me.L6 = [nil, nil, "yel"];
me.R6 = [nil, nil, "yel"];
me.arrowsMatrix[0][5] = 0;
me.L1[2] = "blu";
me.R2[2] = "blu";
me.titleColour = "wht";
}
},
updateFromFpln: func() {
if (canvas_mcdu.myFpln[me.computer] == nil) {
canvas_mcdu.myFpln[i] = fplnPage.new(2, me.computer);
}
var x = 0;
me.vector = [];
for (var i = 1 + (me.scroll - 1); i < size(canvas_mcdu.myFpln[me.computer].planList) - 2; i = i + 1) {
if (canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name == "DISCONTINUITY" or canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_type == "hdgToAlt") { continue; }
if (fmgc.flightPlanController.temporaryFlag[me.computer] and canvas_mcdu.myFpln[me.computer].planList[i].index > fmgc.flightPlanController.arrivalIndex[me.computer]) {
continue;
} elsif (!fmgc.flightPlanController.temporaryFlag[me.computer] and canvas_mcdu.myFpln[me.computer].planList[i].index > fmgc.flightPlanController.arrivalIndex[2]) {
continue;
}
append(me.vector, " " ~ canvas_mcdu.myFpln[me.computer].planList[i].wp.wp_name);
x += 1;
if (x == 4) { break; }
}
if (size(me.vector) > 0) {
me.L2[0] = me.vector[0];
me.arrowsMatrix[0][1] = 1;
} else {
me.L2[0] = nil;
me.arrowsMatrix[0][1] = 0;
}
if (size(me.vector) > 1) {
me.L3[0] = me.vector[1];
me.arrowsMatrix[0][2] = 1;
} else {
me.L3[0] = nil;
me.arrowsMatrix[0][2] = 0;
}
if (size(me.vector) > 2) {
me.L4[0] = me.vector[2];
me.arrowsMatrix[0][3] = 1;
} else {
me.L4[0] = nil;
me.arrowsMatrix[0][3] = 0;
}
if (size(me.vector) > 3) {
me.L5[0] = me.vector[3];
me.arrowsMatrix[0][4] = 1;
} else {
me.L5[0] = nil;
me.arrowsMatrix[0][4] = 0;
}
me.updateTmpy();
},
scrollUp: func() {
if (size(canvas_mcdu.myFpln[me.computer].planList) > 4) {
me.scroll += 1;
if (me.scroll > size(canvas_mcdu.myFpln[me.computer].planList) - 6) {
me.scroll = 0;
}
} else {
me.scroll = 0;
}
me.updateFromFpln();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
scrollDn: func() {
if (size(canvas_mcdu.myFpln[me.computer].planList) > 4) {
me.scroll -= 1;
if (me.scroll < 0) {
me.scroll = size(canvas_mcdu.myFpln[me.computer].planList) - 6;
}
} else {
me.scroll = 0;
}
me.updateFromFpln();
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
}; };

View file

@ -105,7 +105,9 @@ var latRev = {
} elsif (size(me.id) == 5) { } elsif (size(me.id) == 5) {
me.wpt = findFixesByID(me.id); me.wpt = findFixesByID(me.id);
} }
me.subtitle = [dmsToString(sprintf(me.wpt[0].lat), "lat"), dmsToString(sprintf(me.wpt[0].lon), "lon")]; if (me.wpt[0] != nil) {
me.subtitle = [dmsToString(sprintf(me.wpt[0].lat), "lat"), dmsToString(sprintf(me.wpt[0].lon), "lon")];
}
me.L3 = [" HOLD", nil, "wht"]; me.L3 = [" HOLD", nil, "wht"];
me.L4 = [" ALTN", " ENABLE", "blu"]; me.L4 = [" ALTN", " ENABLE", "blu"];
me.L6 = [" RETURN", nil, "wht"]; me.L6 = [" RETURN", nil, "wht"];
@ -121,7 +123,12 @@ var latRev = {
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
me._checkTmpy(); me._checkTmpy();
} }
}, },

View file

@ -474,6 +474,8 @@ var arrowbutton = func(btn, i) {
canvas_mcdu.myDeparture[i].scrollUp(); canvas_mcdu.myDeparture[i].scrollUp();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].scrollUp(); canvas_mcdu.myArrival[i].scrollUp();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].scrollUp();
} }
} else if (btn == "down") { } else if (btn == "down") {
if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") { if (getprop("MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("MCDU[" ~ i ~ "]/page") == "F-PLNB") {
@ -482,6 +484,8 @@ var arrowbutton = func(btn, i) {
canvas_mcdu.myDeparture[i].scrollDn(); canvas_mcdu.myDeparture[i].scrollDn();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "ARRIVAL") {
canvas_mcdu.myArrival[i].scrollDn(); canvas_mcdu.myArrival[i].scrollDn();
} else if (getprop("MCDU[" ~ i ~ "]/page") == "DIRTO") {
canvas_mcdu.myDirTo[i].scrollDn();
} }
} }
} }
@ -526,10 +530,19 @@ var pagebutton = func(btn, i) {
} else if (btn == "fuel-pred") { } else if (btn == "fuel-pred") {
setprop("MCDU[" ~ i ~ "]/page", "FUELPRED"); setprop("MCDU[" ~ i ~ "]/page", "FUELPRED");
} else if (btn == "dirto") { } else if (btn == "dirto") {
if (canvas_mcdu.myDirTo[i] == nil) { if (fmgc.flightPlanController.active.getBoolValue()) {
canvas_mcdu.myDirTo[i] = dirTo.new(i); if (fmgc.flightPlanController.temporaryFlag[i] and !dirToFlag) {
} setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/page", "DIRTO"); setprop("MCDU[" ~ i ~ "]/scratchpad", "INSRT / ERASE TMPY FIRST");
return;
} elsif (canvas_mcdu.myDirTo[i] == nil) {
canvas_mcdu.myDirTo[i] = dirTo.new(i);
}
setprop("MCDU[" ~ i ~ "]/page", "DIRTO");
} else {
setprop("MCDU[" ~ i ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ i ~ "]/scratchpad", "ERROR. INITIALIZE ROUTE"); # Should be ERROR:, but the : character doesn't show in our MCDU font right now...
}
} }
} }
} }

View file

@ -98,7 +98,12 @@ var vertRev = {
}, },
makeTmpy: func() { makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); if (!dirToFlag) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
} else {
setprop("MCDU[" ~ me.computer ~ "]/scratchpad-msg", 1);
setprop("MCDU[" ~ me.computer ~ "]/scratchpad", "DIR TO IN PROGRESS");
}
me._checkTmpy(); me._checkTmpy();
} }
}, },