1
0
Fork 0

Show flightplan altitudes in MCDU

This commit is contained in:
legoboyvdlp R 2020-06-12 17:14:02 +01:00
parent 99f914a8d6
commit 06065f953d

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 {
return [" " ~ sprintf("%-5.0f", me.wp.alt_cstr), "mag"];
}
} else { } else {
return "------"; return ["------", "wht"];
} }
}, },
getDist: func() { getDist: func() {