From 06065f953d26ac6f040638201fc2a92c7ac699bb Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 12 Jun 2020 17:14:02 +0100 Subject: [PATCH] Show flightplan altitudes in MCDU --- Nasal/MCDU/F-PLN.nas | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 5484bd80..1bb45b2f 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -7,6 +7,7 @@ var fplnItem = { fI.computer = computer; fI.colour = colour; fI.assembledStr = [nil, nil, colour]; + fI._colour = "wht"; return fI; }, updateLeftText: func() { @@ -39,8 +40,10 @@ var fplnItem = { if (me.wp.wp_name != "DISCONTINUITY") { if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue() - 1 and fmgc.flightPlanController.fromWptTime != nil) { me.assembledStr[0] = fmgc.flightPlanController.fromWptTime ~ " "; + me.assembledStr[2] = "grn"; } else { me.assembledStr[0] = "---- "; + me.assembledStr[2] = "wht"; } if (me.index == fmgc.flightPlanController.currentToWptIndex.getValue()) { @@ -65,7 +68,11 @@ var fplnItem = { me.spd = me.getSpd(); me.alt = me.getAlt(); 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 { return [nil, nil, "ack"]; } @@ -88,18 +95,26 @@ var fplnItem = { }, getSpd: func() { 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 { - return "---"; + return ["---", "wht"]; } }, 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) { - 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) { - 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 { - return "------"; + return ["------", "wht"]; } }, getDist: func() {