1
0
Fork 0

Add ALTN to the end of the FPLN (Doesn't do anything yet)

This commit is contained in:
Jonathan Redpath 2022-01-12 14:06:20 +00:00
parent 126b071303
commit 047cbda274
2 changed files with 48 additions and 12 deletions

View file

@ -99,8 +99,11 @@ var fplnItem = {
return sprintf("%03.0f", math.round(me.brg));
},
getTrack: func() {
var wp = fmgc.flightPlanController.flightplans[me.plan].getWP(me.index);
me.trk = fmgc.wpCoursePrev[me.plan][me.index].getValue() - magvar(wp.lat, wp.lon);
if (me.index > (size(fmgc.wpCoursePrev[me.plan]) - 1)) {
me.trk = me.wp.leg_bearing - magvar(me.wp.lat, me.wp.lon);
} else {
me.trk = fmgc.wpCoursePrev[me.plan][me.index].getValue() - magvar(me.wp.lat, me.wp.lon);
}
if (me.trk < 0) { me.trk += 360; }
if (me.trk > 360) { me.trk -= 360; }
return sprintf("%03.0f", math.round(me.trk));
@ -138,10 +141,14 @@ var fplnItem = {
}
},
getDist: func() {
if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue()) {
return math.round(fmgc.wpDistance[me.plan][me.index].getValue());
if (me.index > size(fmgc.wpDistancePrev[me.plan]) - 1) {
return math.round(me.wp.leg_distance);
} else {
return math.round(fmgc.wpDistancePrev[me.plan][me.index].getValue());
if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue()) {
return math.round(fmgc.wpDistance[me.plan][me.index].getValue());
} else {
return math.round(fmgc.wpDistancePrev[me.plan][me.index].getValue());
}
}
},
pushButtonLeft: func() {
@ -359,7 +366,25 @@ var fplnPage = { # this one is only created once, and then updated - remember th
}
}
append(me.planList, staticText.new(me.computer, me.getText("fplnEnd")));
append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
if (!fmgc.FMGCInternal.altAirportSet) {
append(me.planList, staticText.new(me.computer, me.getText("noAltnFpln")));
} else {
var altnApt = findAirportsByICAO(fmgc.FMGCInternal.altAirport)[0];
append(me.planList, fplnItem.new({
alt_cstr: nil,
alt_cstr_type: nil,
fly_type: "flyBy",
lat: altnApt.lat,
leg_bearing: courseAndDistance(findAirportsByICAO(fmgc.FMGCInternal.arrApt)[0], altnApt)[0],
leg_distance: courseAndDistance(findAirportsByICAO(fmgc.FMGCInternal.arrApt)[0], altnApt)[1],
lon: altnApt.lon,
speed_cstr: nil,
speed_cstr_type: nil,
wp_name: fmgc.FMGCInternal.altAirport,
}, i, me.planIndex, me.computer, "blu"));
append(me.planList, staticText.new(me.computer, me.getText("altnFplnEnd")));
}
me.basePage();
},
basePage: func() {

View file

@ -85,6 +85,8 @@ var latRev = {
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0]];
} elsif (me.type == 1) {
me.title = ["LAT REV", " FROM ", left(me.wpt.wp_name, 4)];
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
if (size(me.wpt.wp_name) > 4) {
me.arrAirport = findAirportsByICAO(left(me.wpt.wp_name, 4));
} else {
@ -92,27 +94,36 @@ var latRev = {
}
me.subtitle = [dmsToString(sprintf(me.arrAirport[0].lat), "lat"), dmsToString(sprintf(me.arrAirport[0].lon), "lon")];
me.L3 = [" ALTN", nil, "wht"];
me.L4 = [" ALTN", " ENABLE", "blu"];
if (fmgc.FMGCInternal.altAirportSet) {
me.L4 = [" ALTN", " ENABLE", "blu"];
me.arrowsMatrix[0][3] = 1;
} else {
me.arrowsMatrix[0][3] = 0;
}
me.L6 = [" RETURN", nil, "wht"];
me.R1 = ["ARRIVAL ", nil, "wht"];
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]];
} elsif (me.type == 3) {
me.title = ["LAT REV", " FROM ", me.wpt.wp_name];
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]];
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
if (me.wpt != nil) {
me.subtitle = [dmsToString(sprintf(me.wpt.lat), "lat"), dmsToString(sprintf(me.wpt.lon), "lon")];
}
me.L3 = [" HOLD", nil, "wht"];
me.L4 = [" ALTN", " ENABLE", "blu"];
if (fmgc.FMGCInternal.altAirportSet) {
me.L4 = [" ALTN", " ENABLE", "blu"];
me.arrowsMatrix[0][3] = 1;
} else {
me.arrowsMatrix[0][3] = 0;
}
me.L6 = [" RETURN", nil, "wht"];
me.R1 = ["FIX INFO ", nil, "wht"];
me.R3 = ["[ ]", "NEXT WPT ", "blu"];
me.R4 = ["[ ]", "NEW DEST", "blu"];
me.R5 = ["AIRWAYS ", nil, "wht"];
me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]];
me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]];
}
}