From 98163eb712fd4a5980c15ffd6da16c450b705f5b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 31 May 2020 21:23:22 +0100 Subject: [PATCH 01/23] Add initial placeholder for approach vias --- Nasal/MCDU/ARRIVAL.nas | 55 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 1ad92187..93ce84e7 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -1,4 +1,5 @@ var isNoStar = [0, 0]; +var isNoVia = [0, 0]; var arrivalPage = { title: [nil, nil, nil], @@ -39,9 +40,10 @@ var arrivalPage = { enableScrollStars: 0, scrollApproach: 0, scrollStars: 0, - activePage: 0, # runways, stars, trans + activePage: 0, # runways, stars, vias hasPressNoTrans: 0, # temporary _approaches: nil, + _vias; nil, _stars: nil, _transitions: nil, new: func(icao, computer) { @@ -415,6 +417,12 @@ var arrivalPage = { } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, + updateActiveVIAs: func() { + + }, + updateVIAs: func() { + #placeholder + }, clearTransitions: func() { me.R2 = [nil, "TRANS", "wht"]; me.R3 = [nil, "TRANS", "wht"]; @@ -519,7 +527,7 @@ var arrivalPage = { } me.updateApproaches(); } - } else { + } elsif (me.activePage == 1) { if (me.enableScrollStars) { me.scrollStars += 1; if (me.scrollStars > size(me.stars) - 4) { @@ -533,6 +541,14 @@ var arrivalPage = { } me.hasPressNoTrans = 0; } + } elsif (me.activePage == 2) { + if (me.enableScrollVias) { + me.scrollVias += 1; + if (me.scrollVias > size(me.vias) - 4) { + me.scrollVias = 0; + } + me.updateVIAs(); + } } }, scrollDn: func() { @@ -544,7 +560,7 @@ var arrivalPage = { } me.updateApproaches(); } - } else { + } elsif (me.activePage == 1) { if (me.enableScrollStars) { me.scrollStars -= 1; if (me.scrollStars < 0) { @@ -558,13 +574,23 @@ var arrivalPage = { } me.hasPressNoTrans = 0; } + } elsif (me.activePage == 2) { + if (me.enableScrollVias) { + me.scrollVias -= 1; + if (me.scrollVias < 0) { + me.scrollVias = size(me.vias) - 4; + } + me.updateVIAs(); + } } }, scrollLeft: func() { + if (me.activePage == 2) { return; } me.activePage = !me.activePage; me.updatePage(); }, scrollRight: func() { + if (me.activePage == 2) { return; } me.activePage = !me.activePage; me.updatePage(); }, @@ -597,7 +623,7 @@ var arrivalPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } - } else { + } elsif (me.activePage == 1) { if (size(me.stars) >= (index - 2)) { if (!dirToFlag) { me.selectedSTAR = me.stars[index - 2 + me.scrollStars]; @@ -628,6 +654,27 @@ var arrivalPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else { + if (size(me.vias) >= (index - 2)) { + if (!dirToFlag) { + my.selectedVIA = me.vias[index - 2 + me.scrollVias]; + me.makeTmpy(); + if (my.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.updateActiveVIAs(); + me.updateVIAs(); + fmgc.flightPlanController.flightPlanChanged(me.computer); + } else { + mcdu_message(me.computer, "DIR TO IN PROGRESS"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }, arrPushbuttonRight: func(index) { From 78b78487b1eb724fc1138dea1fcc3a384c633cd6 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 31 May 2020 23:39:09 +0100 Subject: [PATCH 02/23] Re-format ARRIVAL page for approach VIAS --- Models/Instruments/MCDU/MCDU.nas | 8 +- Nasal/MCDU/ARRIVAL.nas | 228 +++++++++++++++++-------------- 2 files changed, 135 insertions(+), 101 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 845e3f98..9cedc744 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3603,7 +3603,6 @@ var canvas_MCDU_base = { me["ArrowRight"].show(); me["arrowsDepArr"].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(); @@ -3630,6 +3629,12 @@ var canvas_MCDU_base = { me.colorLeftS("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) { me["Simple_Title"].setText(sprintf("%s", myArrival[i].title[0] ~ myArrival[i].title[1] ~ myArrival[i].title[2])); @@ -3641,6 +3646,7 @@ var canvas_MCDU_base = { var sign = "R"; } forindex (var item; myArrival[i].arrowsMatrix[matrixArrow]) { + if (item == 1) { continue; } 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")); continue; diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 93ce84e7..64266b01 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -38,12 +38,13 @@ var arrivalPage = { computer: nil, enableScrollApproach: 0, enableScrollStars: 0, + enableScrollVias: 0, scrollApproach: 0, scrollStars: 0, activePage: 0, # runways, stars, vias hasPressNoTrans: 0, # temporary _approaches: nil, - _vias; nil, + _vias: nil, _stars: nil, _transitions: nil, new: func(icao, computer) { @@ -66,6 +67,9 @@ var arrivalPage = { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.flightplans[2].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; + if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { + me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; + } } if (fmgc.flightPlanController.flightplans[2].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; @@ -77,8 +81,14 @@ var arrivalPage = { } else { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; + if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { + me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans; + } } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; + if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { + me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; + } } if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star; @@ -113,8 +123,10 @@ var arrivalPage = { } else { me.updateSTARs(); } + me.checkPageType(); me.updateActiveApproach(); + me.updateActiveVIAs(); me.updateActiveSTARs(); me.updateActiveTransitions(); }, @@ -153,13 +165,13 @@ var arrivalPage = { } elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil) { me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"]; } else { - me.L1 = ["---", " APPR", "wht"]; + me.L1 = ["-----", " APPR", "wht"]; } } else { if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"]; } else { - me.L1 = ["---", " APPR", "wht"]; + me.L1 = ["-----", " APPR", "wht"]; } } } elsif (me.selectedApproach != nil) { @@ -169,41 +181,41 @@ var arrivalPage = { } elsif (fmgc.flightPlanController.flightplans[2].approach.id == me.selectedApproach.id) { me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"]; } 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"]; + me.L1 = ["-----", " APPR", "wht"]; } } else { - me.L1 = ["---", " APPR", "wht"]; + me.L1 = ["-----", " APPR", "wht"]; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateActiveSTARs: func() { if (me.selectedSTAR == "NO STAR") { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.C1 = ["NONE", "STAR", "grn"]; + me.R1 = ["NONE", "STAR ", "grn"]; } else { - me.C1 = ["NONE", "STAR", "yel"]; + me.R1 = ["NONE", "STAR ", "yel"]; } } elsif (me.selectedSTAR != nil) { if (fmgc.flightPlanController.flightplans[2].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) { - me.C1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR", "grn"]; + me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "grn"]; } 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"]; + } elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) { + me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"]; } else { - me.C1 = ["------- ", "STAR", "wht"]; + me.R1 = ["-------", "STAR ", "wht"]; } } else { - me.C1 = ["------- ", "STAR", "wht"]; + me.R1 = ["-------", "STAR ", "wht"]; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, @@ -212,25 +224,25 @@ var arrivalPage = { 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"]; + me.R2 = [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"]; + me.R2 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS ", "grn"]; } else { - me.R1 = ["-------", "TRANS ", "wht"]; + me.R2 = ["-------", "TRANS ", "wht"]; } } elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) { - me.C1 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "STAR", "yel"]; + me.R2 = [fmgc.flightPlanController.flightplans[me.computer].star_trans.id, "TRANS ", "yel"]; } else { - me.R1 = ["-------", "TRANS ", "wht"]; + me.R2 = ["-------", "TRANS ", "wht"]; } } else { - me.R1 = ["-------", "TRANS ", "wht"]; + me.R2 = ["-------", "TRANS ", "wht"]; } } else { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.R1 = ["NONE", "TRANS ", "grn"]; + me.R2 = ["NONE", "TRANS ", "grn"]; } else { - me.R1 = ["NONE", "TRANS ", "yel"]; + me.R2 = ["NONE", "TRANS ", "yel"]; } } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); @@ -369,18 +381,8 @@ var arrivalPage = { } 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) { - 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.arrowsColour[0][2] = "blu"; } else { @@ -388,9 +390,9 @@ var arrivalPage = { me.arrowsColour[0][2] = "ack"; } } - if (size(me.stars) >= 3) { - me.L4 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"]; - if (me.stars[2 + me.scrollStars] != me.selectedSTAR) { + if (size(me.stars) >= 2) { + me.L4 = [" " ~ me.stars[1 + me.scrollStars], nil, "blu"]; + if (me.stars[1 + me.scrollStars] != me.selectedSTAR) { me.arrowsMatrix[0][3] = 1; me.arrowsColour[0][3] = "blu"; } else { @@ -398,9 +400,9 @@ var arrivalPage = { me.arrowsColour[0][3] = "ack"; } } - if (size(me.stars) >= 4) { - me.L5 = [" " ~ me.stars[3 + me.scrollStars], nil, "blu"]; - if (me.stars[3 + me.scrollStars] != me.selectedSTAR) { + if (size(me.stars) >= 3) { + me.L5 = [" " ~ me.stars[2 + me.scrollStars], nil, "blu"]; + if (me.stars[2 + me.scrollStars] != me.selectedSTAR) { me.arrowsMatrix[0][4] = 1; me.arrowsColour[0][4] = "blu"; } else { @@ -409,27 +411,47 @@ var arrivalPage = { } } - me.C2 = [nil, "AVAILABLE", "wht"]; - me.R2 = [nil, "TRANS ", "wht"]; + me.C3[1] = "AVAILABLE"; + me.R3[1] = "TRANS "; - if (size(me.stars) > 4) { + if (size(me.stars) > 3) { me.enableScrollStars = 1; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateActiveVIAs: func() { - + 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.flightplans[2].approach_trans != nil) { + 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.id == me.selectedVIA.id) { + me.C1 = [fmgc.flightPlanController.flightplans[2].approach_trans.id, "VIA", "grn"]; + } else { + me.C1 = ["-------", "VIA", "wht"]; + } + } elsif (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { + me.C1 = [fmgc.flightPlanController.flightplans[me.computer].approach_trans.id, "VIA", "yel"]; + } else { + me.C1 = ["-------", "VIA", "wht"]; + } + } else { + me.C1 = ["-------", "VIA", "wht"]; + } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateVIAs: func() { #placeholder }, clearTransitions: func() { - me.R2 = [nil, "TRANS", "wht"]; - me.R3 = [nil, "TRANS", "wht"]; - me.R4 = [nil, "TRANS", "wht"]; - me.R5 = [nil, "TRANS", "wht"]; - me.arrowsMatrix[1][1] = 0; - me.arrowsColour[1][1] = "ack"; + me.R3 = [nil, nil, "wht"]; + me.R4 = [nil, nil, "wht"]; + me.R5 = [nil, nil, "wht"]; me.arrowsMatrix[1][2] = 0; me.arrowsColour[1][2] = "ack"; me.arrowsMatrix[1][3] = 0; @@ -442,62 +464,52 @@ var arrivalPage = { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } if (me.selectedSTAR == nil) { - me.R2 = ["NO TRANS ", "TRANS", "blu"]; + me.R3 = ["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") { - - return; - } - me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions; - me.transitions = sort(me._transitions,func(a,b) cmp(a,b)); - - if (size(me.transitions) == 0) { - 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"]; - 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.arrowsColour[1][2] = "blu"; } else { me.arrowsMatrix[1][2] = 0; me.arrowsColour[1][2] = "ack"; } - } elsif (size(me.transitions) >= 3) { - me.R4 = [me.transitions[2] ~ " ", nil, "blu"]; - if (me.transitions[2] != me.selectedTransition) { + return; + } + if (me.selectedSTAR == "NO STAR") { + return; + } + me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions; + me.transitions = sort(me._transitions,func(a,b) cmp(a,b)); + + if (size(me.transitions) == 0) { + me.R3 = ["NO TRANS ", "TRANS", "blu"]; + if (!me.hasPressNoTrans) { + me.arrowsMatrix[1][2] = 1; + me.arrowsColour[1][2] = "blu"; + } else { + me.arrowsMatrix[1][2] = 0; + me.arrowsColour[1][2] = "ack"; + } + } elsif (size(me.transitions) >= 1) { + me.R3 = [me.transitions[0] ~ " ", "TRANS", "blu"]; + if (me.transitions[0] != me.selectedTransition) { + me.arrowsMatrix[1][2] = 1; + me.arrowsColour[1][2] = "blu"; + } else { + me.arrowsMatrix[1][2] = 0; + me.arrowsColour[1][2] = "ack"; + } + } elsif (size(me.transitions) >= 2) { + me.R4 = [me.transitions[1] ~ " ", nil, "blu"]; + if (me.transitions[1] != me.selectedTransition) { me.arrowsMatrix[1][3] = 1; me.arrowsColour[1][3] = "blu"; } else { me.arrowsMatrix[1][3] = 0; me.arrowsColour[1][3] = "ack"; } - } elsif (size(me.transitions) >= 4) { - me.R5 = [me.transitions[3] ~ " ", nil, "blu"]; - if (me.transitions[3] != me.selectedTransition) { + } elsif (size(me.transitions) >= 3) { + me.R5 = [me.transitions[2] ~ " ", nil, "blu"]; + if (me.transitions[2] != me.selectedTransition) { me.arrowsMatrix[1][4] = 1; me.arrowsColour[1][4] = "blu"; } else { @@ -505,6 +517,8 @@ var arrivalPage = { me.arrowsColour[1][4] = "ack"; } } + + # no indication it is scrollable... }, makeTmpy: func() { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -518,6 +532,17 @@ var arrivalPage = { } } }, + checkPageType: func() { + if (me.activePage == 0) { + me.L2 = [nil, nil, "wht"]; + me.arrowsMatrix[0][1] = 0; + me.arrowsColour[0][1] = "wht"; + } else { + me.L2 = [" VIAS", " APPR", "wht"]; + me.arrowsMatrix[0][1] = 1; + me.arrowsColour[0][1] = "wht"; + } + }, scrollUp: func() { if (me.activePage == 0) { if (me.enableScrollApproach) { @@ -587,16 +612,18 @@ var arrivalPage = { scrollLeft: func() { if (me.activePage == 2) { return; } me.activePage = !me.activePage; + me.checkPageType(); me.updatePage(); }, scrollRight: func() { if (me.activePage == 2) { return; } me.activePage = !me.activePage; + me.checkPageType(); me.updatePage(); }, arrPushbuttonLeft: func(index) { if (me.activePage == 0) { - if (size(me.approaches) >= (index - 2) and index != 2) { + if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { me.selectedSTAR = nil; me.hasPressNoTrans = 0; @@ -617,6 +644,7 @@ var arrivalPage = { me.updateApproaches(); fmgc.flightPlanController.flightPlanChanged(me.computer); me.scrollRight(); + me.checkPageType(); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } @@ -624,9 +652,9 @@ var arrivalPage = { mcdu_message(me.computer, "NOT ALLOWED"); } } elsif (me.activePage == 1) { - if (size(me.stars) >= (index - 2)) { + if (size(me.stars) >= (index - 2) and index != 2) { if (!dirToFlag) { - me.selectedSTAR = me.stars[index - 2 + me.scrollStars]; + me.selectedSTAR = me.stars[index - 3 + me.scrollStars]; me.makeTmpy(); if (me.selectedSTAR != "NO STAR") { isNoStar[me.computer] = 0; @@ -655,7 +683,7 @@ var arrivalPage = { mcdu_message(me.computer, "NOT ALLOWED"); } } else { - if (size(me.vias) >= (index - 2)) { + if (size(me.vias) >= (index - 1)) { # different!! if (!dirToFlag) { my.selectedVIA = me.vias[index - 2 + me.scrollVias]; me.makeTmpy(); @@ -678,7 +706,7 @@ var arrivalPage = { } }, arrPushbuttonRight: func(index) { - if (index == 2 and size(me.transitions) == 0) { + if (index == 3 and size(me.transitions) == 0) { if (!dirToFlag) { me.hasPressNoTrans = 1; me.updateActiveTransitions(); @@ -686,9 +714,9 @@ var arrivalPage = { } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } - } elsif (size(me.transitions) >= (index - 1)) { + } elsif (size(me.transitions) >= (index - 2)) { if (!dirToFlag) { - me.selectedTransition = me.transitions[index - 2]; + me.selectedTransition = me.transitions[index - 3]; me.makeTmpy(); fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; me.updateActiveTransitions(); From e033e0e2c0b41aa2f05e51222738761f8f7aecf7 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 1 Jun 2020 19:52:59 +0100 Subject: [PATCH 03/23] Add ability to show list of approach transitions --- Nasal/MCDU/ARRIVAL.nas | 76 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 70 insertions(+), 6 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 64266b01..5ba9e1de 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -1,5 +1,4 @@ var isNoStar = [0, 0]; -var isNoVia = [0, 0]; var arrivalPage = { title: [nil, nil, nil], @@ -42,7 +41,9 @@ var arrivalPage = { scrollApproach: 0, scrollStars: 0, activePage: 0, # runways, stars, vias + oldPage: 0, hasPressNoTrans: 0, # temporary + hasPressNoVia: 0, # temporary _approaches: nil, _vias: nil, _stars: nil, @@ -120,8 +121,10 @@ var arrivalPage = { if (me.activePage == 0) { me.updateApproaches(); - } else { + } elsif (me.activePage == 1) { me.updateSTARs(); + } else { + me.updateVIAs(); } me.checkPageType(); @@ -446,7 +449,60 @@ var arrivalPage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateVIAs: func() { - #placeholder + if (me.selectedApproach == nil) { + me.L3 = [" NO VIA ", " APP VIAS", "blu"]; + if (!me.hasPressNoVia) { + me.arrowsMatrix[1][2] = 1; + me.arrowsColour[1][2] = "blu"; + } else { + me.arrowsMatrix[1][2] = 0; + me.arrowsColour[1][2] = "ack"; + } + return; + } + me._vias = me.selectedApproach.transitions; + me.vias = sort(me._vias, func(a,b) cmp(a,b)); + debug.dump(me.vias); + debug.dump(me._vias); + if (size(me.vias) == 0) { + me.L3 = [" NO VIA", " APP VIAS", "blu"]; + if (!me.hasPressNoVia) { + me.arrowsMatrix[1][2] = 1; + me.arrowsColour[1][2] = "blu"; + } else { + me.arrowsMatrix[1][2] = 0; + me.arrowsColour[1][2] = "ack"; + } + } elsif (size(me.vias) >= 1) { + me.L3 = [" " ~ me.vias[0], " APP VIAS", "blu"]; + if (me.vias[0] != me.selectedVIA) { + me.arrowsMatrix[1][2] = 1; + me.arrowsColour[1][2] = "blu"; + } else { + me.arrowsMatrix[1][2] = 0; + me.arrowsColour[1][2] = "ack"; + } + } elsif (size(me.vias) >= 2) { + me.L4 = [" " ~ me.vias[1], nil, "blu"]; + if (me.vias[1] != me.selectedVIA) { + me.arrowsMatrix[1][3] = 1; + me.arrowsColour[1][3] = "blu"; + } else { + me.arrowsMatrix[1][3] = 0; + me.arrowsColour[1][3] = "ack"; + } + } elsif (size(me.vias) >= 3) { + me.L5 = [me.vias[2] ~ " ", nil, "blu"]; + if (me.vias[2] != me.selectedVIA) { + me.arrowsMatrix[1][4] = 1; + me.arrowsColour[1][4] = "blu"; + } else { + me.arrowsMatrix[1][4] = 0; + me.arrowsColour[1][4] = "ack"; + } + } + + # no indication it is scrollable... }, clearTransitions: func() { me.R3 = [nil, nil, "wht"]; @@ -622,7 +678,15 @@ var arrivalPage = { me.updatePage(); }, arrPushbuttonLeft: func(index) { - if (me.activePage == 0) { + if (index == 2 and me.activePage != 2) { + me.oldPage = me.activePage; + me.activePage = 2; + me.updatePage(); + } elsif (index == 6 and me.activePage == 2) { + me.activePage = me.oldPage; + me.oldPage = 0; + me.updatePage(); + } elsif (me.activePage == 0) { if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { me.selectedSTAR = nil; @@ -688,10 +752,10 @@ var arrivalPage = { my.selectedVIA = me.vias[index - 2 + me.scrollVias]; me.makeTmpy(); if (my.selectedVIA != "NO VIA") { - isNoVia[me.computer] = 0; + me.hasPressNoVia = 0; fmgc.flightPlanController.flightplans[me.computer].approach_trans = me.selectedVIA; } else { - isNoVia[me.computer] = 1; + me.hasPressNoVia = 1; fmgc.flightPlanController.flightplans[me.computer].approach_trans = nil; } me.updateActiveVIAs(); From 6e307654c119a802a3985df99d0191f0fd038062 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 1 Jun 2020 21:55:15 +0100 Subject: [PATCH 04/23] Finalize APP VIAS page, correct various problems, ability to load APP VIAS is working correctly --- Nasal/MCDU/ARRIVAL.nas | 113 ++++++++++++++++++++++++++--------------- Nasal/MCDU/MCDU.nas | 4 +- 2 files changed, 75 insertions(+), 42 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 5ba9e1de..f06d8bb7 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -40,6 +40,7 @@ var arrivalPage = { enableScrollVias: 0, scrollApproach: 0, scrollStars: 0, + scrollVias: 0, activePage: 0, # runways, stars, vias oldPage: 0, hasPressNoTrans: 0, # temporary @@ -112,8 +113,8 @@ var arrivalPage = { 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"]]; - if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.L6 = [" RETURN END", nil, "wht"]; + if (!fmgc.flightPlanController.temporaryFlag[me.computer] or me.activePage == 2) { + me.L6 = [" RETURN", nil, "wht"]; } else { me.L6 = [" F-PLN", " TMPY", "yel"]; me.arrowsColour[0][5] = "yel"; @@ -450,59 +451,75 @@ var arrivalPage = { }, updateVIAs: func() { if (me.selectedApproach == nil) { - me.L3 = [" NO VIA ", " APP VIAS", "blu"]; + me.L2 = [" NO VIA ", " APP VIAS", "blu"]; if (!me.hasPressNoVia) { - me.arrowsMatrix[1][2] = 1; - me.arrowsColour[1][2] = "blu"; + me.arrowsMatrix[0][2] = 1; + me.arrowsColour[0][2] = "blu"; } else { - me.arrowsMatrix[1][2] = 0; - me.arrowsColour[1][2] = "ack"; + me.arrowsMatrix[0][2] = 0; + me.arrowsColour[0][2] = "ack"; } return; } me._vias = me.selectedApproach.transitions; me.vias = sort(me._vias, func(a,b) cmp(a,b)); - debug.dump(me.vias); - debug.dump(me._vias); + if (size(me.vias) == 0) { - me.L3 = [" NO VIA", " APP VIAS", "blu"]; + me.L2 = [" NO VIA", " APP VIAS", "blu"]; if (!me.hasPressNoVia) { - me.arrowsMatrix[1][2] = 1; - me.arrowsColour[1][2] = "blu"; + me.arrowsMatrix[0][1] = 1; + me.arrowsColour[0][1] = "blu"; } else { - me.arrowsMatrix[1][2] = 0; - me.arrowsColour[1][2] = "ack"; + me.arrowsMatrix[0][1] = 0; + me.arrowsColour[0][1] = "ack"; } - } elsif (size(me.vias) >= 1) { - me.L3 = [" " ~ me.vias[0], " APP VIAS", "blu"]; + } else { + 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.selectedVIA) { - me.arrowsMatrix[1][2] = 1; - me.arrowsColour[1][2] = "blu"; + me.arrowsMatrix[0][1] = 1; + me.arrowsColour[0][1] = "blu"; } else { - me.arrowsMatrix[1][2] = 0; - me.arrowsColour[1][2] = "ack"; + me.arrowsMatrix[0][1] = 0; + me.arrowsColour[0][1] = "ack"; } - } elsif (size(me.vias) >= 2) { - me.L4 = [" " ~ me.vias[1], nil, "blu"]; + } + if (size(me.vias) >= 2) { + me.L3 = [" " ~ me.vias[1 + me.scrollVias], nil, "blu"]; if (me.vias[1] != me.selectedVIA) { - me.arrowsMatrix[1][3] = 1; - me.arrowsColour[1][3] = "blu"; + me.arrowsMatrix[0][2] = 1; + me.arrowsColour[0][2] = "blu"; } else { - me.arrowsMatrix[1][3] = 0; - me.arrowsColour[1][3] = "ack"; + me.arrowsMatrix[0][2] = 0; + me.arrowsColour[0][2] = "ack"; } - } elsif (size(me.vias) >= 3) { - me.L5 = [me.vias[2] ~ " ", nil, "blu"]; + } + if (size(me.vias) >= 3) { + me.L4 = [" " ~ me.vias[2 + me.scrollVias], nil, "blu"]; if (me.vias[2] != me.selectedVIA) { - me.arrowsMatrix[1][4] = 1; - me.arrowsColour[1][4] = "blu"; + me.arrowsMatrix[0][3] = 1; + me.arrowsColour[0][3] = "blu"; } else { - me.arrowsMatrix[1][4] = 0; - me.arrowsColour[1][4] = "ack"; + 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[2] != me.selectedVIA) { + me.arrowsMatrix[0][4] = 1; + me.arrowsColour[0][4] = "blu"; + } else { + me.arrowsMatrix[0][4] = 0; + me.arrowsColour[0][4] = "ack"; } } - # no indication it is scrollable... + if (size(me.vias) > 3) { + me.enableScrollVias = 1; + } }, clearTransitions: func() { me.R3 = [nil, nil, "wht"]; @@ -545,7 +562,8 @@ var arrivalPage = { me.arrowsMatrix[1][2] = 0; me.arrowsColour[1][2] = "ack"; } - } elsif (size(me.transitions) >= 1) { + } + if (size(me.transitions) >= 1) { me.R3 = [me.transitions[0] ~ " ", "TRANS", "blu"]; if (me.transitions[0] != me.selectedTransition) { me.arrowsMatrix[1][2] = 1; @@ -554,7 +572,8 @@ var arrivalPage = { me.arrowsMatrix[1][2] = 0; me.arrowsColour[1][2] = "ack"; } - } elsif (size(me.transitions) >= 2) { + } + if (size(me.transitions) >= 2) { me.R4 = [me.transitions[1] ~ " ", nil, "blu"]; if (me.transitions[1] != me.selectedTransition) { me.arrowsMatrix[1][3] = 1; @@ -563,7 +582,8 @@ var arrivalPage = { me.arrowsMatrix[1][3] = 0; me.arrowsColour[1][3] = "ack"; } - } elsif (size(me.transitions) >= 3) { + } + if (size(me.transitions) >= 3) { me.R5 = [me.transitions[2] ~ " ", nil, "blu"]; if (me.transitions[2] != me.selectedTransition) { me.arrowsMatrix[1][4] = 1; @@ -628,6 +648,7 @@ var arrivalPage = { if (me.scrollVias > size(me.vias) - 4) { me.scrollVias = 0; } + me.updateActiveVIAs(); me.updateVIAs(); } } @@ -661,6 +682,7 @@ var arrivalPage = { if (me.scrollVias < 0) { me.scrollVias = size(me.vias) - 4; } + me.updateActiveVIAs(); me.updateVIAs(); } } @@ -682,11 +704,18 @@ var arrivalPage = { 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 (me.activePage == 0) { + } elsif (index == 6 and me.activePage != 2) { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); + } else { + setprop("/MCDU[" ~ i ~ "]/page", "LATREV"); + } + } elsif (me.activePage == 0 and index != 6) { if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { me.selectedSTAR = nil; @@ -715,7 +744,7 @@ var arrivalPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } - } elsif (me.activePage == 1) { + } elsif (me.activePage == 1 and index != 6) { if (size(me.stars) >= (index - 2) and index != 2) { if (!dirToFlag) { me.selectedSTAR = me.stars[index - 3 + me.scrollStars]; @@ -746,12 +775,12 @@ var arrivalPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } - } else { + } elsif (me.activePage == 2 and index != 6) { if (size(me.vias) >= (index - 1)) { # different!! if (!dirToFlag) { - my.selectedVIA = me.vias[index - 2 + me.scrollVias]; + me.selectedVIA = me.vias[index - 2 + me.scrollVias]; me.makeTmpy(); - if (my.selectedVIA != "NO VIA") { + if (me.selectedVIA != "NO VIA") { me.hasPressNoVia = 0; fmgc.flightPlanController.flightplans[me.computer].approach_trans = me.selectedVIA; } else { @@ -767,6 +796,8 @@ var arrivalPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); } }, arrPushbuttonRight: func(index) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 8eaf94a8..92334a6a 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -422,7 +422,9 @@ var lskbutton = func(btn, i) { 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") { 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]) { setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); } else { From 539344f1be527bc938e2faa4701613457bd08a1a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 2 Jun 2020 16:37:30 +0100 Subject: [PATCH 05/23] Bugfix for discontinuities; arrival page index typo --- Nasal/FMGC/flightplan.nas | 22 ++++++++++++++++------ Nasal/MCDU/ARRIVAL.nas | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 4a584789..b5672f44 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -222,14 +222,24 @@ var flightPlanController = { if (force) { me.flightplans[plan].insertWP(createDiscontinuity(), index); } - if (index > 0) { - 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); - } - } else { - if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") { + + 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") { + me.flightplans[plan].insertWP(createDiscontinuity(), index); + } + } else { # -1 is nil + if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") { + me.flightplans[plan].insertWP(createDiscontinuity(), index); + } + } + } 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); } }, diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index f06d8bb7..807c6daf 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -711,9 +711,9 @@ var arrivalPage = { me.updatePage(); } elsif (index == 6 and me.activePage != 2) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { - setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); + setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); } else { - setprop("/MCDU[" ~ i ~ "]/page", "LATREV"); + 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 From 0e2f410f2bb85061a3d44c6eb0f879e957dc23a1 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 2 Jun 2020 18:27:02 +0100 Subject: [PATCH 06/23] Bugfixes for appr trans; arrows on appr via page --- Nasal/MCDU/ARRIVAL.nas | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 807c6daf..a11ca626 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -451,7 +451,7 @@ var arrivalPage = { }, updateVIAs: func() { if (me.selectedApproach == nil) { - me.L2 = [" NO VIA ", " APP VIAS", "blu"]; + me.L2 = [" NO VIA", " APP VIAS", "blu"]; if (!me.hasPressNoVia) { me.arrowsMatrix[0][2] = 1; me.arrowsColour[0][2] = "blu"; @@ -463,22 +463,11 @@ var arrivalPage = { } 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) == 0) { - me.L2 = [" NO VIA", " APP VIAS", "blu"]; - if (!me.hasPressNoVia) { - me.arrowsMatrix[0][1] = 1; - me.arrowsColour[0][1] = "blu"; - } else { - me.arrowsMatrix[0][1] = 0; - me.arrowsColour[0][1] = "ack"; - } - } else { - 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.selectedVIA) { + if (me.vias[0 + me.scrollVias] != me.selectedVIA) { me.arrowsMatrix[0][1] = 1; me.arrowsColour[0][1] = "blu"; } else { @@ -488,7 +477,7 @@ var arrivalPage = { } if (size(me.vias) >= 2) { me.L3 = [" " ~ me.vias[1 + me.scrollVias], nil, "blu"]; - if (me.vias[1] != me.selectedVIA) { + if (me.vias[1 + me.scrollVias] != me.selectedVIA) { me.arrowsMatrix[0][2] = 1; me.arrowsColour[0][2] = "blu"; } else { @@ -498,7 +487,7 @@ var arrivalPage = { } if (size(me.vias) >= 3) { me.L4 = [" " ~ me.vias[2 + me.scrollVias], nil, "blu"]; - if (me.vias[2] != me.selectedVIA) { + if (me.vias[2 + me.scrollVias] != me.selectedVIA) { me.arrowsMatrix[0][3] = 1; me.arrowsColour[0][3] = "blu"; } else { @@ -508,7 +497,7 @@ var arrivalPage = { } if (size(me.vias) >= 4) { me.L5 = [" " ~ me.vias[3 + me.scrollVias], nil, "blu"]; - if (me.vias[2] != me.selectedVIA) { + if (me.vias[3 + me.scrollVias] != me.selectedVIA) { me.arrowsMatrix[0][4] = 1; me.arrowsColour[0][4] = "blu"; } else { @@ -709,6 +698,9 @@ var arrivalPage = { me.activePage = me.oldPage; me.oldPage = 0; me.updatePage(); + if (me.selectedSTAR != nil) { + me.updateTransitions(); + } } elsif (index == 6 and me.activePage != 2) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); From 27e2438549442b84bbe0698a5760ee9e3de96e82 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 2 Jun 2020 18:59:02 +0100 Subject: [PATCH 07/23] Flightplan: new arrival distance calculation, experimental --- Nasal/FMGC/flightplan.nas | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index b5672f44..11858038 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -718,12 +718,12 @@ var flightPlanController = { courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev); wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]); wpDistancePrev[n][wpt].setValue(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]; - } - } + #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 { # use PPOS for the first waypoint wpCoursePrev[n][wpt].setValue(courseDistanceFrom[0]); @@ -742,8 +742,7 @@ var flightPlanController = { } } } - # print("Total: " ~ me._arrivalDist); - me.arrivalDist = me._arrivalDist; + me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist; me.updateMCDUDriver(n); }, From 20f8b1c513e68ec38e4176e02f6fa61b2a348bfc Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 2 Jun 2020 20:10:08 +0100 Subject: [PATCH 08/23] Distance calculation for waypoints --- Nasal/FMGC/flightplan.nas | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 11858038..185f88da 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -7,7 +7,6 @@ var pos = nil; var geoPosPrev = geo.Coord.new(); var currentLegCourseDist = nil; var courseDistanceFrom = nil; -var courseDistanceFromPrev = nil; var sizeWP = nil; var magTrueError = 0; var storeCourse = nil; @@ -713,14 +712,10 @@ var flightPlanController = { } if (wpt > 0) { - geoPosPrev.set_latlon(me.flightplans[n].getWP(wpt - 1).lat, me.flightplans[n].getWP(wpt - 1).lon); - - courseDistanceFromPrev = waypointHashStore.courseAndDistanceFrom(geoPosPrev); - wpCoursePrev[n][wpt].setValue(courseDistanceFromPrev[0]); - wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]); + wpCoursePrev[n][wpt].setValue(me.flightplans[n].getWP(wpt).leg_bearing); + wpDistancePrev[n][wpt].setValue(me.flightplans[n].getWP(wpt).leg_distance); #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]; # } #} From 6d586efe38d1b38c7e4c13484d80fa08c6dccda5 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 3 Jun 2020 14:20:39 +0100 Subject: [PATCH 09/23] Improvements - no via, no star, etc --- Nasal/FMGC/flightplan.nas | 13 +++ Nasal/FMGC/mcdu-messages.nas | 5 +- Nasal/MCDU/ARRIVAL.nas | 154 ++++++++++++++++++----------------- 3 files changed, 97 insertions(+), 75 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 185f88da..f0575ce3 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -110,6 +110,19 @@ var flightPlanController = { flightPlanTimer.stop(); me.resetFlightplan(2); me.flightplans[2] = me.flightplans[n].clone(); + + 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; + } + me.flightPlanChanged(2); flightPlanTimer.start(); } diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 88b573a0..4b1a247f 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -174,8 +174,11 @@ var MessageController = { ]), 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("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) { return me.getMsgByText(text, me.typeIMessages.vector); diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index a11ca626..c64aafe6 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -1,4 +1,6 @@ -var isNoStar = [0, 0]; +var isNoStar = [0, 0, 0]; +var isNoTrans = [0, 0, 0]; +var isNoVia = [0, 0, 0]; var arrivalPage = { title: [nil, nil, nil], @@ -31,9 +33,9 @@ var arrivalPage = { selectedVIA: nil, selectedSTAR: nil, selectedTransition: nil, - stars: nil, - transitions: nil, - vias: nil, + stars: [], + transitions: [], + vias: [], computer: nil, enableScrollApproach: 0, enableScrollStars: 0, @@ -43,8 +45,6 @@ var arrivalPage = { scrollVias: 0, activePage: 0, # runways, stars, vias oldPage: 0, - hasPressNoTrans: 0, # temporary - hasPressNoVia: 0, # temporary _approaches: nil, _vias: nil, _stars: nil, @@ -61,9 +61,12 @@ var arrivalPage = { return nil; }, reset: func() { - isNoStar[me.computer] = 0; me.selectedSTAR = nil; - me.hasPressNoTrans = 0; + me.selectedApproach = nil; + me.selectedVIA = nil; + isNoStar[me.computer] = 0; + isNoTrans[me.computer] = 0; + isNoVia[me.computer] = 0; }, _setupFirstTime: func() { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -71,14 +74,21 @@ var arrivalPage = { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; + debug.dump(me.selectedVIA); } } + if (fmgc.flightPlanController.flightplans[2].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; - isNoStar[me.computer] = 0; - } elsif (isNoStar[me.computer] == 1) { + isNoStar[2] = 0; + } elsif (isNoStar[2] == 1) { me.selectedSTAR = "NO STAR"; - me.hasPressNoTrans = 1; + } + + if (isNoTrans[2]) { + me.selectedTransition = "NO TRANS"; + } elsif (fmgc.flightPlanController.flightplans[2].star != nil) { + me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans; } } else { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { @@ -94,15 +104,22 @@ var arrivalPage = { } if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[me.computer].star; - me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].star_trans; isNoStar[me.computer] = 0; } elsif (fmgc.flightPlanController.flightplans[2].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans; isNoStar[me.computer] = 0; + isNoStar[2] = 0; } elsif (isNoStar[me.computer] == 1) { me.selectedSTAR = "NO STAR"; - me.hasPressNoTrans = 1; + } + + if (isNoTrans[me.computer] or isNoTrans[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; } } }, @@ -224,7 +241,13 @@ var arrivalPage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateActiveTransitions: func() { - if (!me.hasPressNoTrans) { + if (me.selectedTransition == "NO TRANS") { + if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + me.R2 = ["NONE", "TRANS ", "grn"]; + } else { + me.R2 = ["NONE", "TRANS ", "yel"]; + } + } else { if (me.selectedTransition != nil) { if (fmgc.flightPlanController.flightplans[2].star_trans != nil) { if (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) { @@ -242,12 +265,6 @@ var arrivalPage = { } else { me.R2 = ["-------", "TRANS ", "wht"]; } - } else { - if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { - me.R2 = ["NONE", "TRANS ", "grn"]; - } else { - me.R2 = ["NONE", "TRANS ", "yel"]; - } } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, @@ -450,15 +467,7 @@ var arrivalPage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateVIAs: func() { - if (me.selectedApproach == nil) { - me.L2 = [" NO VIA", " APP VIAS", "blu"]; - if (!me.hasPressNoVia) { - me.arrowsMatrix[0][2] = 1; - me.arrowsColour[0][2] = "blu"; - } else { - me.arrowsMatrix[0][2] = 0; - me.arrowsColour[0][2] = "ack"; - } + if (me.selectedApproach == nil or me.activePage != 2) { return; } me._vias = me.selectedApproach.transitions; @@ -521,37 +530,35 @@ var arrivalPage = { me.arrowsMatrix[1][4] = 0; 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() { if (me.arrAirport == nil) { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } - if (me.selectedSTAR == nil) { - me.R3 = ["NO TRANS ", "TRANS", "blu"]; - if (!me.hasPressNoTrans) { - me.arrowsMatrix[1][2] = 1; - me.arrowsColour[1][2] = "blu"; - } else { - me.arrowsMatrix[1][2] = 0; - me.arrowsColour[1][2] = "ack"; - } - return; - } - if (me.selectedSTAR == "NO STAR") { + if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") { + me.clearTransitions(); return; } me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions; me.transitions = sort(me._transitions,func(a,b) cmp(a,b)); + append(me.transitions, "NO TRANS"); - if (size(me.transitions) == 0) { - me.R3 = ["NO TRANS ", "TRANS", "blu"]; - if (!me.hasPressNoTrans) { - me.arrowsMatrix[1][2] = 1; - me.arrowsColour[1][2] = "blu"; - } else { - me.arrowsMatrix[1][2] = 0; - me.arrowsColour[1][2] = "ack"; - } - } if (size(me.transitions) >= 1) { me.R3 = [me.transitions[0] ~ " ", "TRANS", "blu"]; if (me.transitions[0] != me.selectedTransition) { @@ -629,7 +636,6 @@ var arrivalPage = { } else { me.updateTransitions(); } - me.hasPressNoTrans = 0; } } elsif (me.activePage == 2) { if (me.enableScrollVias) { @@ -663,7 +669,6 @@ var arrivalPage = { } else { me.updateTransitions(); } - me.hasPressNoTrans = 0; } } elsif (me.activePage == 2) { if (me.enableScrollVias) { @@ -689,7 +694,7 @@ var arrivalPage = { me.updatePage(); }, arrPushbuttonLeft: func(index) { - if (index == 2 and me.activePage != 2) { + if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) { me.oldPage = me.activePage; me.activePage = 2; me.updatePage(); @@ -711,7 +716,7 @@ var arrivalPage = { if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { me.selectedSTAR = nil; - me.hasPressNoTrans = 0; + isNoTrans[me.computer] = 0; isNoStar[me.computer] = 0; me.makeTmpy(); if (!me.apprIsRwyFlag) { @@ -754,10 +759,10 @@ var arrivalPage = { me.updateActiveSTARs(); me.updateSTARs(); if (me.selectedSTAR != "NO STAR") { - me.hasPressNoTrans = 0; + isNoTrans[me.computer] = 0; me.updateTransitions(); } else { - me.hasPressNoTrans = 1; + isNoTrans[me.computer] = 1; } me.updateActiveTransitions(); fmgc.flightPlanController.flightPlanChanged(me.computer); @@ -773,10 +778,10 @@ var arrivalPage = { me.selectedVIA = me.vias[index - 2 + me.scrollVias]; me.makeTmpy(); if (me.selectedVIA != "NO VIA") { - me.hasPressNoVia = 0; + isNoVia[me.computer] = 0; fmgc.flightPlanController.flightplans[me.computer].approach_trans = me.selectedVIA; } else { - me.hasPressNoVia = 1; + isNoVia[me.computer] = 1; fmgc.flightPlanController.flightplans[me.computer].approach_trans = nil; } me.updateActiveVIAs(); @@ -793,22 +798,23 @@ var arrivalPage = { } }, arrPushbuttonRight: func(index) { - if (index == 3 and size(me.transitions) == 0) { + if (size(me.transitions) >= (index - 2)) { if (!dirToFlag) { - me.hasPressNoTrans = 1; - me.updateActiveTransitions(); - me.updateTransitions(); - } else { - mcdu_message(me.computer, "DIR TO IN PROGRESS"); - } - } elsif (size(me.transitions) >= (index - 2)) { - if (!dirToFlag) { - me.selectedTransition = me.transitions[index - 3]; - me.makeTmpy(); - fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; - me.updateActiveTransitions(); - me.updateTransitions(); - fmgc.flightPlanController.flightPlanChanged(me.computer); + if (me.transitions[index - 3] == "NO TRANS") { + me.makeTmpy(); + fmgc.flightPlanController.flightplans[me.computer].star_trans = nil; + isNoTrans[me.computer] = 1; + me.updateActiveTransitions(); + me.updateTransitions(); + fmgc.flightPlanController.flightPlanChanged(me.computer); + } else { + me.selectedTransition = me.transitions[index - 3]; + me.makeTmpy(); + fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; + me.updateActiveTransitions(); + me.updateTransitions(); + fmgc.flightPlanController.flightPlanChanged(me.computer); + } } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } From ec8b2408b4cb8c03cbbc43a244de9c6cb6a6b0de Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 5 Jun 2020 15:55:52 +0100 Subject: [PATCH 10/23] Refactor top row of page a little --- Nasal/MCDU/ARRIVAL.nas | 117 +++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index c64aafe6..91d16aa1 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -74,7 +74,8 @@ var arrivalPage = { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; - debug.dump(me.selectedVIA); + } elsif (isNoVia[2] == 1) { + me.selectedVIA = "NO VIA"; } } @@ -95,6 +96,8 @@ var arrivalPage = { me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; 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) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; @@ -178,42 +181,76 @@ var arrivalPage = { me._clearPage(); me._setupPageWithData(); }, + + # Functions to populate top row updateActiveApproach: func() { if (me.apprIsRwyFlag) { - if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"]; } elsif (fmgc.flightPlanController.flightplans[2].destination_runway != nil) { - me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"]; + me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "yel"]; } else { me.L1 = ["-----", " APPR", "wht"]; } } else { - if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { - me.L1 = [fmgc.flightPlanController.flightplans[me.computer].destination_runway.id, " APPR", "yel"]; + if (fmgc.flightPlanController.flightplans[2].destination_runway != nil) { + me.L1 = [fmgc.flightPlanController.flightplans[2].destination_runway.id, " APPR", "grn"]; } else { me.L1 = ["-----", " APPR", "wht"]; } } } 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) { me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"]; - } elsif (fmgc.flightPlanController.flightplans[2].approach.id == me.selectedApproach.id) { - me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"]; + } elsif (fmgc.flightPlanController.flightplans[2].approach != nil and fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) { + me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "yel"]; } else { 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"]; + if (fmgc.flightPlanController.flightplans[2].approach != nil and fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) { + me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"]; + } else { + me.L1 = ["-----", " APPR", "wht"]; + } } } else { me.L1 = ["-----", " APPR", "wht"]; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, + + updateActiveVIAs: func() { + 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 == me.selectedVIA) { + 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 and fmgc.flightPlanController.flightplans[2].approach_trans == me.selectedVIA) { + 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() { if (me.selectedSTAR == "NO STAR") { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -222,24 +259,27 @@ var arrivalPage = { me.R1 = ["NONE", "STAR ", "yel"]; } } 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) { me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"]; - } elsif (fmgc.flightPlanController.flightplans[2].star.id == me.selectedSTAR.id) { - me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "grn"]; + } elsif (fmgc.flightPlanController.flightplans[2].star != nil and fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) { + me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "yel"]; } else { me.R1 = ["-------", "STAR ", "wht"]; } - } elsif (fmgc.flightPlanController.flightplans[me.computer].star != nil) { - me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"]; } else { - me.R1 = ["-------", "STAR ", "wht"]; + if (fmgc.flightPlanController.flightplans[2].star != nil and fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) { + 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); }, + updateActiveTransitions: func() { if (me.selectedTransition == "NO TRANS") { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -249,18 +289,20 @@ var arrivalPage = { } } else { if (me.selectedTransition != nil) { - if (fmgc.flightPlanController.flightplans[2].star_trans != 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.id == me.selectedTransition.id) { - me.R2 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS ", "grn"]; + } elsif (fmgc.flightPlanController.flightplans[2].star_trans != nil and fmgc.flightPlanController.flightplans[2].star_trans == me.selectedTransition) { + me.R2 = [fmgc.flightPlanController.flightplans[2].star_trans.id, "TRANS ", "yel"]; } else { me.R2 = ["-------", "TRANS ", "wht"]; } - } elsif (fmgc.flightPlanController.flightplans[me.computer].star_trans != nil) { - me.R2 = [fmgc.flightPlanController.flightplans[me.computer].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"]; @@ -268,6 +310,7 @@ var arrivalPage = { } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, + updateApproaches: func() { me.apprIsRwyFlag = 0; if (me.arrAirport == nil) { @@ -440,32 +483,6 @@ var arrivalPage = { } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, - updateActiveVIAs: func() { - 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.flightplans[2].approach_trans != nil) { - 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.id == me.selectedVIA.id) { - me.C1 = [fmgc.flightPlanController.flightplans[2].approach_trans.id, "VIA", "grn"]; - } else { - me.C1 = ["-------", "VIA", "wht"]; - } - } elsif (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { - me.C1 = [fmgc.flightPlanController.flightplans[me.computer].approach_trans.id, "VIA", "yel"]; - } else { - me.C1 = ["-------", "VIA", "wht"]; - } - } else { - me.C1 = ["-------", "VIA", "wht"]; - } - canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); - }, updateVIAs: func() { if (me.selectedApproach == nil or me.activePage != 2) { return; From 96788e63ccc9b5c3c997e83f3a3870d5b3a8be7f Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 7 Jun 2020 13:29:56 +0100 Subject: [PATCH 11/23] Approach vias - add version check; restore functionality to top row --- Nasal/FMGC/flightplan.nas | 6 +++++ Nasal/MCDU/ARRIVAL.nas | 47 ++++++++++++++++++++++++--------------- Nasal/MCDU/F-PLN.nas | 11 --------- 3 files changed, 35 insertions(+), 29 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index f0575ce3..329c24d8 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -123,6 +123,12 @@ var flightPlanController = { mcdu.isNoVia[2] = 0; } + if (mcdu.isNoTrans[n] == 1) { + mcdu.isNoTrans[2] = 1; + } else { + mcdu.isNoTrans[2] = 0; + } + me.flightPlanChanged(2); flightPlanTimer.start(); } diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 91d16aa1..474ac605 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -72,10 +72,13 @@ var arrivalPage = { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.flightplans[2].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; - 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 (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"; + } } } @@ -94,15 +97,19 @@ var arrivalPage = { } else { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; - 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"; + 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) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; - if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { - me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; + 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) { @@ -188,7 +195,7 @@ var arrivalPage = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.flightplans[me.computer].destination_runway != nil) { 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", "yel"]; } else { me.L1 = ["-----", " APPR", "wht"]; @@ -204,13 +211,13 @@ var arrivalPage = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { me.L1 = [fmgc.flightPlanController.flightplans[me.computer].approach.id, " APPR", "yel"]; - } elsif (fmgc.flightPlanController.flightplans[2].approach != nil and fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) { + } 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 and fmgc.flightPlanController.flightplans[2].approach == me.selectedApproach) { + if (fmgc.flightPlanController.flightplans[2].approach != nil) { me.L1 = [fmgc.flightPlanController.flightplans[2].approach.id, " APPR", "grn"]; } else { me.L1 = ["-----", " APPR", "wht"]; @@ -223,6 +230,8 @@ var arrivalPage = { }, 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"]; @@ -233,13 +242,13 @@ var arrivalPage = { 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 == me.selectedVIA) { + } 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 and fmgc.flightPlanController.flightplans[2].approach_trans == me.selectedVIA) { + if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { me.C1 = [fmgc.flightPlanController.flightplans[2].approach_trans.id, "VIA", "grn"]; } else { me.C1 = ["-------", "VIA", "wht"]; @@ -262,13 +271,13 @@ var arrivalPage = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.flightplans[me.computer].star != nil) { me.R1 = [fmgc.flightPlanController.flightplans[me.computer].star.id, "STAR ", "yel"]; - } elsif (fmgc.flightPlanController.flightplans[2].star != nil and fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) { + } elsif (fmgc.flightPlanController.flightplans[2].star != nil and fmgc.flightPlanController.flightplans[2].star.id == me.selectedSTAR.id) { me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "yel"]; } else { me.R1 = ["-------", "STAR ", "wht"]; } } else { - if (fmgc.flightPlanController.flightplans[2].star != nil and fmgc.flightPlanController.flightplans[2].star == me.selectedSTAR) { + if (fmgc.flightPlanController.flightplans[2].star != nil) { me.R1 = [fmgc.flightPlanController.flightplans[2].star.id, "STAR ", "grn"]; } else { me.R1 = ["-------", "STAR ", "wht"]; @@ -292,7 +301,7 @@ var arrivalPage = { 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 == me.selectedTransition) { + } 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"]; @@ -484,6 +493,7 @@ var arrivalPage = { 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) { return; } @@ -712,6 +722,7 @@ var arrivalPage = { }, arrPushbuttonLeft: func(index) { if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) { + if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } me.oldPage = me.activePage; me.activePage = 2; me.updatePage(); diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f205f457..5484bd80 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -216,17 +216,6 @@ var fplnPage = { # this one is only created once, and then updated - remember th R5: [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: [], outputList: [], scroll: 0, From 565055b9cb87140c38e269e4a4cc16393511fd3a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 8 Jun 2020 17:05:04 +0100 Subject: [PATCH 12/23] Reset variables --- Nasal/MCDU/ARRIVAL.nas | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 474ac605..e952f469 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -325,6 +325,10 @@ var arrivalPage = { if (me.arrAirport == nil) { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } + + me.approaches = []; + me._approaches = nil; + me._approaches = me.arrAirport[0].getApproachList(); me.approaches = sort(me._approaches,func(a,b) cmp(a,b)); if (me.approaches == nil or size(me.approaches) == 0) { @@ -440,6 +444,10 @@ var arrivalPage = { if (me.arrAirport == nil) { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } + + me.stars = []; + me._stars = nil; + if (me.selectedApproach != nil) { me._stars = me.arrAirport[0].stars(me.selectedApproach.runways[0]); } else { @@ -497,6 +505,8 @@ var arrivalPage = { if (me.selectedApproach == nil or me.activePage != 2) { 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"); @@ -578,10 +588,15 @@ var arrivalPage = { if (me.arrAirport == nil) { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } + + me.clearTransitions(); if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") { - me.clearTransitions(); + append(me.transitions, "NO TRANS"); return; } + + me.transitions = []; + me._transitions = nil; me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions; me.transitions = sort(me._transitions,func(a,b) cmp(a,b)); append(me.transitions, "NO TRANS"); @@ -828,21 +843,18 @@ var arrivalPage = { arrPushbuttonRight: func(index) { if (size(me.transitions) >= (index - 2)) { if (!dirToFlag) { - if (me.transitions[index - 3] == "NO TRANS") { - me.makeTmpy(); - fmgc.flightPlanController.flightplans[me.computer].star_trans = nil; - isNoTrans[me.computer] = 1; - me.updateActiveTransitions(); - me.updateTransitions(); - fmgc.flightPlanController.flightPlanChanged(me.computer); - } else { - me.selectedTransition = me.transitions[index - 3]; - me.makeTmpy(); + me.selectedTransition = me.transitions[index - 3]; + me.makeTmpy(); + if (me.selectedTransition != "NO TRANS") { + isNoTrans[me.computer] = 0; fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; - me.updateActiveTransitions(); - me.updateTransitions(); - fmgc.flightPlanController.flightPlanChanged(me.computer); + } else { + isNoTrans[me.computer] = 1; + fmgc.flightPlanController.flightplans[me.computer].star_trans = nil; } + me.updateActiveTransitions(); + me.updateTransitions(); + fmgc.flightPlanController.flightPlanChanged(me.computer); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); } From 1ab12b6f601e88d217a69df6de5f9764b940a08a Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Thu, 11 Jun 2020 15:37:31 +0100 Subject: [PATCH 13/23] Modify GUI colour scheme --- gui/it-gui.xml | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/gui/it-gui.xml b/gui/it-gui.xml index 88d53dc2..55b37037 100644 --- a/gui/it-gui.xml +++ b/gui/it-gui.xml @@ -10,9 +10,9 @@ 0.95 - 0.05 - 0.05 - 0.05 + 0.213 + 0.199 + 0.191 0.95 - 0.05 - 0.05 - 0.05 + 0.173 + 0.169 + 0.161 0.95 @@ -52,9 +52,9 @@ 0.95 - 1.0 - 0.0 - 1.0 + 0.847 + 0.459 + 0.008 0.95 @@ -100,9 +100,9 @@ 0.95 - 1.0 - 0.0 - 1.0 + 0.847 + 0.459 + 0.008 @@ -111,9 +111,9 @@ 0.95 - 0.05 - 0.05 - 0.05 + 0.213 + 0.199 + 0.191 0.95 - 0.05 - 0.05 - 0.05 + 0.173 + 0.169 + 0.161 0.95 @@ -153,9 +153,9 @@ 0.95 - 1.0 - 0.0 - 1.0 + 0.847 + 0.459 + 0.008 0.95 @@ -201,9 +201,9 @@ 0.95 - 1.0 - 0.0 - 1.0 + 0.847 + 0.459 + 0.008 From 2e5d049ccf5f0496d684ce12439127a0177be948 Mon Sep 17 00:00:00 2001 From: J Maverick 16 Date: Thu, 11 Jun 2020 19:33:18 +0200 Subject: [PATCH 14/23] GUI: Updated colors --- gui/it-gui.xml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gui/it-gui.xml b/gui/it-gui.xml index 55b37037..cfb79da1 100644 --- a/gui/it-gui.xml +++ b/gui/it-gui.xml @@ -28,9 +28,9 @@ 0.95 - 0.9 - 0.9 - 0.9 + 0.8 + 0.58 + 0.44 0.95 @@ -52,9 +52,9 @@ 0.95 - 0.847 - 0.459 - 0.008 + 0.8 + 0.58 + 0.44 0.95 @@ -100,9 +100,9 @@ 0.95 - 0.847 - 0.459 - 0.008 + 0.8 + 0.58 + 0.44 @@ -129,9 +129,9 @@ 0.95 - 0.9 - 0.9 - 0.9 + 0.8 + 0.58 + 0.44 0.95 @@ -153,9 +153,9 @@ 0.95 - 0.847 - 0.459 - 0.008 + 0.8 + 0.58 + 0.44 0.95 @@ -201,9 +201,9 @@ 0.95 - 0.847 - 0.459 - 0.008 + 0.8 + 0.58 + 0.44 From ac0a5838d277bea7c45d0e49523f8f15c063b5a6 Mon Sep 17 00:00:00 2001 From: J Maverick 16 Date: Thu, 11 Jun 2020 21:36:59 +0200 Subject: [PATCH 15/23] Revised GUI --- gui/it-gui.xml | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/gui/it-gui.xml b/gui/it-gui.xml index cfb79da1..415ffbfb 100644 --- a/gui/it-gui.xml +++ b/gui/it-gui.xml @@ -40,9 +40,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 0.95 @@ -58,9 +58,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 0.95 @@ -82,9 +82,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 1.0 @@ -94,9 +94,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 0.95 @@ -135,15 +135,15 @@ 0.95 - 0.9 - 0.9 - 0.9 + 0.8 + 0.58 + 0.44 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 0.95 @@ -159,9 +159,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 0.95 @@ -183,9 +183,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 1.0 @@ -195,9 +195,9 @@ 0.95 - 0.2 - 0.2 - 0.2 + 0.4 + 0.4 + 0.4 0.95 From 6ca266766ee1ca55fbb220dc13f026b4c0e6d152 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 12 Jun 2020 00:06:40 +0100 Subject: [PATCH 16/23] Bugfixes --- Nasal/MCDU/ARRIVAL.nas | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index e952f469..3e0b88b6 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -151,9 +151,11 @@ var arrivalPage = { me.updateApproaches(); } elsif (me.activePage == 1) { me.updateSTARs(); + me.updateTransitions(); } else { me.updateVIAs(); } + me.checkPageType(); me.updateActiveApproach(); @@ -597,7 +599,11 @@ var arrivalPage = { me.transitions = []; me._transitions = nil; - me._transitions = me.arrAirport[0].getStar(me.selectedSTAR).transitions; + 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 = sort(me._transitions,func(a,b) cmp(a,b)); append(me.transitions, "NO TRANS"); @@ -633,6 +639,7 @@ var arrivalPage = { } # no indication it is scrollable... + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -746,9 +753,6 @@ var arrivalPage = { me.activePage = me.oldPage; me.oldPage = 0; me.updatePage(); - if (me.selectedSTAR != nil) { - me.updateTransitions(); - } } elsif (index == 6 and me.activePage != 2) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { setprop("/MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); @@ -758,7 +762,7 @@ var arrivalPage = { } elsif (me.activePage == 0 and index != 6) { if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { - me.selectedSTAR = nil; + me.selectedVIA = nil; isNoTrans[me.computer] = 0; isNoStar[me.computer] = 0; me.makeTmpy(); @@ -773,8 +777,8 @@ var arrivalPage = { setprop("FMGC/internal/baro", 99999); setprop("FMGC/internal/radio", 99999); setprop("FMGC/internal/radio-no", 0); - me.updateActiveApproach(); me.updateApproaches(); + me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); me.scrollRight(); me.checkPageType(); @@ -787,6 +791,7 @@ var arrivalPage = { } elsif (me.activePage == 1 and index != 6) { if (size(me.stars) >= (index - 2) and index != 2) { if (!dirToFlag) { + me.selectedTransition = nil; me.selectedSTAR = me.stars[index - 3 + me.scrollStars]; me.makeTmpy(); if (me.selectedSTAR != "NO STAR") { @@ -799,15 +804,13 @@ var arrivalPage = { fmgc.flightPlanController.insertNOSTAR(me.computer); } } - me.updateActiveSTARs(); me.updateSTARs(); if (me.selectedSTAR != "NO STAR") { isNoTrans[me.computer] = 0; - me.updateTransitions(); } else { isNoTrans[me.computer] = 1; } - me.updateActiveTransitions(); + me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); @@ -827,8 +830,8 @@ var arrivalPage = { isNoVia[me.computer] = 1; fmgc.flightPlanController.flightplans[me.computer].approach_trans = nil; } - me.updateActiveVIAs(); me.updateVIAs(); + me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); @@ -852,8 +855,7 @@ var arrivalPage = { isNoTrans[me.computer] = 1; fmgc.flightPlanController.flightplans[me.computer].star_trans = nil; } - me.updateActiveTransitions(); - me.updateTransitions(); + me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); From fb0e4754e2fdbcb598ed7c3235c91ff6b4924f94 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 12 Jun 2020 00:43:29 +0100 Subject: [PATCH 17/23] Bugfix --- Nasal/FMGC/flightplan.nas | 12 +++++++++--- Nasal/MCDU/ARRIVAL.nas | 18 +++++++++--------- Nasal/MCDU/DEPARTURE.nas | 1 + 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 329c24d8..eccd7849 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -123,10 +123,16 @@ var flightPlanController = { mcdu.isNoVia[2] = 0; } - if (mcdu.isNoTrans[n] == 1) { - mcdu.isNoTrans[2] = 1; + if (mcdu.isNoTransDep[n] == 1) { + mcdu.isNoTransDep[2] = 1; } else { - mcdu.isNoTrans[2] = 0; + mcdu.isNoTransDep[2] = 0; + } + + if (mcdu.isNoTransArr[n] == 1) { + mcdu.isNoTransArr[2] = 1; + } else { + mcdu.isNoTransArr[2] = 0; } me.flightPlanChanged(2); diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 3e0b88b6..3d7986b7 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -1,5 +1,5 @@ var isNoStar = [0, 0, 0]; -var isNoTrans = [0, 0, 0]; +var isNoTransArr = [0, 0, 0]; var isNoVia = [0, 0, 0]; var arrivalPage = { @@ -65,7 +65,7 @@ var arrivalPage = { me.selectedApproach = nil; me.selectedVIA = nil; isNoStar[me.computer] = 0; - isNoTrans[me.computer] = 0; + isNoTransArr[me.computer] = 0; isNoVia[me.computer] = 0; }, _setupFirstTime: func() { @@ -89,7 +89,7 @@ var arrivalPage = { me.selectedSTAR = "NO STAR"; } - if (isNoTrans[2]) { + if (isNoTransArr[2]) { me.selectedTransition = "NO TRANS"; } elsif (fmgc.flightPlanController.flightplans[2].star != nil) { me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans; @@ -124,7 +124,7 @@ var arrivalPage = { me.selectedSTAR = "NO STAR"; } - if (isNoTrans[me.computer] or isNoTrans[2]) { + 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; @@ -763,7 +763,7 @@ var arrivalPage = { if (size(me.approaches) >= (index - 2) and index != 2) { # index = 3, size = 1 if (!dirToFlag) { me.selectedVIA = nil; - isNoTrans[me.computer] = 0; + isNoTransArr[me.computer] = 0; isNoStar[me.computer] = 0; me.makeTmpy(); if (!me.apprIsRwyFlag) { @@ -806,9 +806,9 @@ var arrivalPage = { } me.updateSTARs(); if (me.selectedSTAR != "NO STAR") { - isNoTrans[me.computer] = 0; + isNoTransArr[me.computer] = 0; } else { - isNoTrans[me.computer] = 1; + isNoTransArr[me.computer] = 1; } me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); @@ -849,10 +849,10 @@ var arrivalPage = { me.selectedTransition = me.transitions[index - 3]; me.makeTmpy(); if (me.selectedTransition != "NO TRANS") { - isNoTrans[me.computer] = 0; + isNoTransArr[me.computer] = 0; fmgc.flightPlanController.flightplans[me.computer].star_trans = me.selectedTransition; } else { - isNoTrans[me.computer] = 1; + isNoTransArr[me.computer] = 1; fmgc.flightPlanController.flightplans[me.computer].star_trans = nil; } me.updatePage(); diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas index a9aefb44..b56cc101 100644 --- a/Nasal/MCDU/DEPARTURE.nas +++ b/Nasal/MCDU/DEPARTURE.nas @@ -1,4 +1,5 @@ var isNoSid = [0, 0]; +var isNoTransDep = [0, 0, 0]; var departurePage = { title: [nil, nil, nil], From 5aac5e8c8a5062e93112e7a73ba1af4f70024f17 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 12 Jun 2020 00:49:42 +0100 Subject: [PATCH 18/23] Start work on departures --- Nasal/MCDU/ARRIVAL.nas | 3 ++- Nasal/MCDU/DEPARTURE.nas | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 3d7986b7..9e25c6a2 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -61,8 +61,9 @@ var arrivalPage = { return nil; }, reset: func() { - me.selectedSTAR = nil; me.selectedApproach = nil; + me.selectedSTAR = nil; + me.selectedTransition = nil; me.selectedVIA = nil; isNoStar[me.computer] = 0; isNoTransArr[me.computer] = 0; diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas index b56cc101..f7034a4b 100644 --- a/Nasal/MCDU/DEPARTURE.nas +++ b/Nasal/MCDU/DEPARTURE.nas @@ -30,18 +30,18 @@ var departurePage = { selectedRunway: nil, selectedSID: nil, selectedTransition: nil, - sids: nil, - transitions: nil, computer: nil, enableScrollRwy: 0, enableScrollSids: 0, scrollRwy: 0, scrollSids: 0, activePage: 0, # runways, sids, trans - hasPressNoTrans: 0, # temporary _runways: nil, _sids: nil, _transitions: nil, + runways: [], + sids: [], + transitions: [], new: func(icao, computer) { var page = {parents:[departurePage]}; page.id = icao; @@ -55,8 +55,9 @@ var departurePage = { }, reset: func() { isNoSid[me.computer] = 0; + isNoTransDep[me.computer] = 0; me.selectedSID = nil; - me.hasPressNoTrans = 0; + me.selectedTransition = nil; }, _setupFirstTime: func() { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { From 99f914a8d633624985b16c56e88fff3a4863dc11 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 12 Jun 2020 16:16:44 +0100 Subject: [PATCH 19/23] Major bugfixes, port departure page, please test! --- Nasal/FMGC/flightplan.nas | 11 +++ Nasal/MCDU/ARRIVAL.nas | 12 +-- Nasal/MCDU/DEPARTURE.nas | 172 ++++++++++++++++++++------------------ 3 files changed, 110 insertions(+), 85 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index eccd7849..3dd3c1bb 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -76,6 +76,11 @@ var flightPlanController = { me.flightplans[n].cleanPlan(); me.flightplans[n].departure = 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) { @@ -111,6 +116,12 @@ var flightPlanController = { me.resetFlightplan(2); 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 { diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 9e25c6a2..e20952e4 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -118,7 +118,6 @@ var arrivalPage = { isNoStar[me.computer] = 0; } elsif (fmgc.flightPlanController.flightplans[2].star != nil) { me.selectedSTAR = fmgc.flightPlanController.flightplans[2].star; - me.selectedTransition = fmgc.flightPlanController.flightplans[2].star_trans; isNoStar[me.computer] = 0; isNoStar[2] = 0; } elsif (isNoStar[me.computer] == 1) { @@ -506,6 +505,7 @@ var arrivalPage = { updateVIAs: func() { if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } if (me.selectedApproach == nil or me.activePage != 2) { + me.clearVias(); return; } me.vias = []; @@ -592,14 +592,15 @@ var arrivalPage = { me.arrAirport = findAirportsByICAO(left(me.id, 4)); } + me.transitions = []; + me._transitions = nil; + me.clearTransitions(); if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") { append(me.transitions, "NO TRANS"); return; } - me.transitions = []; - me._transitions = nil; if (isghost(me.selectedSTAR)) { me._transitions = me.arrAirport[0].getStar(me.selectedSTAR.id).transitions; } else { @@ -677,7 +678,7 @@ var arrivalPage = { } elsif (me.activePage == 1) { if (me.enableScrollStars) { me.scrollStars += 1; - if (me.scrollStars > size(me.stars) - 4) { + if (me.scrollStars > size(me.stars) - 3) { me.scrollStars = 0; } me.updateSTARs(); @@ -711,7 +712,7 @@ var arrivalPage = { if (me.enableScrollStars) { me.scrollStars -= 1; if (me.scrollStars < 0) { - me.scrollStars = size(me.stars) - 4; + me.scrollStars = size(me.stars) - 3; } me.updateSTARs(); if (me.selectedSTAR == nil or me.selectedSTAR == "NO STAR") { @@ -810,6 +811,7 @@ var arrivalPage = { isNoTransArr[me.computer] = 0; } else { isNoTransArr[me.computer] = 1; + me.selectedTransition = "NO TRANS"; } me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas index f7034a4b..697361f3 100644 --- a/Nasal/MCDU/DEPARTURE.nas +++ b/Nasal/MCDU/DEPARTURE.nas @@ -1,4 +1,4 @@ -var isNoSid = [0, 0]; +var isNoSid = [0, 0, 0]; var isNoTransDep = [0, 0, 0]; var departurePage = { @@ -67,9 +67,14 @@ var departurePage = { if (fmgc.flightPlanController.flightplans[2].sid != nil) { me.selectedSID = fmgc.flightPlanController.flightplans[2].sid; isNoSid[me.computer] = 0; - } elsif (isNoSid[me.computer] == 1) { + } elsif (isNoSid[2] == 1) { 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 { if (fmgc.flightPlanController.flightplans[me.computer].departure_runway != nil) { @@ -79,15 +84,20 @@ var departurePage = { } if (fmgc.flightPlanController.flightplans[me.computer].sid != nil) { me.selectedSID = fmgc.flightPlanController.flightplans[me.computer].sid; - me.selectedTransition = fmgc.flightPlanController.flightplans[me.computer].sid_trans; isNoSid[me.computer] = 0; } elsif (fmgc.flightPlanController.flightplans[2].sid != nil) { me.selectedSID = fmgc.flightPlanController.flightplans[2].sid; - me.selectedTransition = fmgc.flightPlanController.flightplans[2].sid_trans; isNoSid[me.computer] = 0; } elsif (isNoSid[me.computer] == 1) { 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; } } }, @@ -109,6 +119,7 @@ var departurePage = { me.updateRunways(); } else { me.updateSIDs(); + me.updateTransitions(); } me.updateActiveRunway(); @@ -144,18 +155,20 @@ var departurePage = { }, updateActiveRunway: func() { 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) { me.L1 = [fmgc.flightPlanController.flightplans[me.computer].departure_runway.id, " RWY", "yel"]; - } elsif (fmgc.flightPlanController.flightplans[2].departure_runway.id == me.selectedRunway.id) { - me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"]; + } 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"]; } - } 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"]; + if (fmgc.flightPlanController.flightplans[2].departure_runway != nil) { + me.L1 = [fmgc.flightPlanController.flightplans[2].departure_runway.id, " RWY", "grn"]; + } else { + me.L1 = ["---", " RWY", "wht"]; + } } } else { me.L1 = ["---", " RWY", "wht"]; @@ -170,18 +183,20 @@ var departurePage = { me.C1 = ["NONE", "SID", "yel"]; } } 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) { me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"]; - } elsif (fmgc.flightPlanController.flightplans[2].sid.id == me.selectedSID.id) { - me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"]; + } 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"]; } - } elsif (fmgc.flightPlanController.flightplans[me.computer].sid != nil) { - me.C1 = [fmgc.flightPlanController.flightplans[me.computer].sid.id, "SID", "yel"]; } else { - me.C1 = ["------- ", "SID", "wht"]; + if (fmgc.flightPlanController.flightplans[2].sid != nil) { + me.C1 = [fmgc.flightPlanController.flightplans[2].sid.id, "SID", "grn"]; + } else { + me.C1 = ["------- ", "SID", "wht"]; + } } } else { me.C1 = ["------- ", "SID", "wht"]; @@ -189,30 +204,32 @@ var departurePage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateActiveTransitions: func() { - if (!me.hasPressNoTrans) { - 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 (me.selectedTransition == "NO TRANS") { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { me.R1 = ["NONE", "TRANS ", "grn"]; } else { 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); }, @@ -220,6 +237,10 @@ var departurePage = { if (me.depAirport == nil) { me.depAirport = findAirportsByICAO(left(me.id, 4)); } + + me.runways = []; + me._runways = nil; + me._runways = keys(me.depAirport[0].runways); me.runways = sort(me._runways,func(a,b) cmp(a,b)); @@ -281,6 +302,10 @@ var departurePage = { if (me.depAirport == nil) { me.depAirport = findAirportsByICAO(left(me.id, 4)); } + + me.sids = []; + me._sids = nil; + if (me.selectedRunway != nil) { me._sids = me.depAirport[0].sids(me.selectedRunway.id); } else { @@ -336,8 +361,8 @@ var departurePage = { } } - me.C2 = [nil, "AVAILABLE", "wht"]; - me.R2 = [nil, "TRANS ", "wht"]; + me.C2[1] = "AVAILABLE"; + me.R2[1] = "TRANS "; if (size(me.sids) > 4) { me.enableScrollSids = 1; @@ -363,30 +388,22 @@ var departurePage = { me.depAirport = findAirportsByICAO(left(me.id, 4)); } - if (me.selectedSID == 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"; - } + me.clearTransitions(); + if (me.selectedSID == nil or me.selectedSID == "NO SID") { + append(me.transitions, "NO TRANS"); 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 = sort(me._transitions,func(a,b) cmp(a,b)); + append(me.transitions, "NO TRANS"); - if (size(me.transitions) == 0) { - 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) { + if (size(me.transitions) >= 1) { me.R2 = [me.transitions[0] ~ " ", "TRANS", "blu"]; if (me.transitions[0] != me.selectedTransition) { me.arrowsMatrix[1][1] = 1; @@ -423,6 +440,7 @@ var departurePage = { me.arrowsColour[1][4] = "ack"; } } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -457,7 +475,6 @@ var departurePage = { } else { me.updateTransitions(); } - me.hasPressNoTrans = 0; } } }, @@ -482,7 +499,6 @@ var departurePage = { } else { me.updateTransitions(); } - me.hasPressNoTrans = 0; } } }, @@ -500,12 +516,12 @@ var departurePage = { if (!dirToFlag) { me.selectedSID = nil; isNoSid[me.computer] = 0; - me.hasPressNoTrans = 0; + isNoTransDep[me.computer] = 0; me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2 + me.scrollRwy]); me.makeTmpy(); fmgc.flightPlanController.flightplans[me.computer].departure_runway = me.selectedRunway; - me.updateActiveRunway(); me.updateRunways(); + me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); me.scrollRight(); } else { @@ -521,21 +537,20 @@ var departurePage = { me.makeTmpy(); if (me.selectedSID != "NO SID") { 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 { isNoSid[me.computer] = 1; fmgc.flightPlanController.flightplans[me.computer].sid = nil; fmgc.flightPlanController.insertNOSID(me.computer); } - me.updateActiveSIDs(); me.updateSIDs(); if (me.selectedSID != "NO SID") { - me.hasPressNoTrans = 0; - me.updateTransitions(); + isNoTransDep[me.computer] = 0; } else { - me.hasPressNoTrans = 1; + isNoTransDep[me.computer] = 1; + me.selectedTransition = "NO TRANS"; } - me.updateActiveTransitions(); + me.updatePage(); fmgc.flightPlanController.flightPlanChanged(me.computer); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); @@ -546,21 +561,18 @@ var departurePage = { } }, depPushbuttonRight: func(index) { - if (index == 2 and size(me.transitions) == 0) { - 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 (size(me.transitions) >= (index - 1)) { if (!dirToFlag) { me.selectedTransition = me.transitions[index - 2]; me.makeTmpy(); - fmgc.flightPlanController.flightplans[me.computer].sid_trans = me.depAirport[0].getSid(me.selectedSID).transition(me.selectedTransition); - me.updateActiveTransitions(); - me.updateTransitions(); + if (me.selectedTransition != "NO TRANS") { + isNoTransDep[me.computer] = 0; + 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); } else { mcdu_message(me.computer, "DIR TO IN PROGRESS"); From 06065f953d26ac6f040638201fc2a92c7ac699bb Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 12 Jun 2020 17:14:02 +0100 Subject: [PATCH 20/23] 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() { From bb7efbb5fb7a916ba7f1d002898c6b18d63567c0 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 13 Jun 2020 08:35:45 -0400 Subject: [PATCH 21/23] Route reserve bug fix --- Nasal/MCDU/FUELPRED.nas | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index c06a5b4d..63000cf2 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -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 (scratchpad == "CLR") { 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-set", 0); setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } else if (getprop("/FMGC/internal/trip-fuel") != 0) { @@ -43,17 +45,21 @@ var fuelPredInput = func(key, i) { var perc = num(split("/", scratchpad)[1]); 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-set", 0); setprop("/FMGC/internal/rte-percent", perc); + setprop("/FMGC/internal/rte-percent-set", 1); setprop("/FMGC/internal/fuel-calculating", 1); mcdu_scratchpad.scratchpads[i].empty(); } } 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-set", 1); if (scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100 <= 15.0) { setprop("/FMGC/internal/rte-percent", scratchpad / num(getprop("/FMGC/internal/trip-fuel")) * 100); } else { 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); mcdu_scratchpad.scratchpads[i].empty(); } else { From 387dd212164f0e1794435d64b753e67aa1292ce2 Mon Sep 17 00:00:00 2001 From: J Maverick 16 Date: Sat, 13 Jun 2020 14:38:09 +0200 Subject: [PATCH 22/23] Overall GUI color revision --- gui/it-gui.xml | 98 +++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/gui/it-gui.xml b/gui/it-gui.xml index 415ffbfb..ddbe6793 100644 --- a/gui/it-gui.xml +++ b/gui/it-gui.xml @@ -1,6 +1,6 @@ - + @@ -10,21 +10,21 @@ 0.95 - 0.213 - 0.199 - 0.191 + 0.17 + 0.17 + 0.17 0.95 - 0.173 - 0.169 - 0.161 + 0.19 + 0.19 + 0.19 0.95 @@ -40,9 +40,9 @@ 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 @@ -58,9 +58,9 @@ 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 @@ -82,21 +82,21 @@ 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 1.0 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 @@ -111,21 +111,21 @@ 0.95 - 0.213 - 0.199 - 0.191 + 0.17 + 0.17 + 0.17 0.95 - 0.173 - 0.169 - 0.161 + 0.19 + 0.19 + 0.19 0.95 @@ -141,9 +141,9 @@ 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 @@ -159,9 +159,9 @@ 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 @@ -183,21 +183,21 @@ 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 1.0 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 - 0.4 - 0.4 - 0.4 + 0.33 + 0.33 + 0.33 0.95 From 2d4ea99e6814701f597071100787235abd9e5952 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 13 Jun 2020 15:48:12 +0100 Subject: [PATCH 23/23] Bugfix for from waypoint, also bugfix for the aproach vias --- Nasal/MCDU/ARRIVAL.nas | 2 +- Nasal/MCDU/F-PLN.nas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index e20952e4..1aee5abe 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -660,7 +660,7 @@ var arrivalPage = { me.L2 = [nil, nil, "wht"]; me.arrowsMatrix[0][1] = 0; me.arrowsColour[0][1] = "wht"; - } else { + } elsif (me.activePage == 1) { me.L2 = [" VIAS", " APPR", "wht"]; me.arrowsMatrix[0][1] = 1; me.arrowsColour[0][1] = "wht"; diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 1bb45b2f..468c6caf 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -106,7 +106,7 @@ var fplnItem = { 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("%-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, "mag"]; + 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"];