diff --git a/A320-main.xml b/A320-main.xml index 912044b7..60e9dd8a 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -1876,7 +1876,8 @@ Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas - Aircraft/A320-family/Nasal/MCDU/LATREV.nas + Aircraft/A320-family/Nasal/MCDU/LATREV.nas + Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas Aircraft/A320-family/Nasal/MCDU/MCDU.nas Aircraft/A320-family/Nasal/MCDU/INITA.nas Aircraft/A320-family/Nasal/MCDU/INITB.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index fa283693..c32148b8 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -6,7 +6,8 @@ var MCDU_1 = nil; var MCDU_2 = nil; var MCDU1_display = nil; var MCDU2_display = nil; -var myLatRev = nil; +var myLatRev = [nil, nil]; +var myDeparture = [nil, nil]; var default = "BoeingCDU-Large.ttf"; var symbol = "helvetica_medium.txf"; var normal = 70; @@ -169,7 +170,7 @@ var canvas_MCDU_base = { "Simple_L1_Arrow","Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5","Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S", "Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow","Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C4","Simple_C5","Simple_C6","Simple_C1S","Simple_C2S","Simple_C3S","Simple_C4S", "Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp","INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","PERFTO","PERFTO_V1","PERFTO_VR", - "PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","FPLN","FPLN_From","FPLN_TMPY_group","FPLN_Callsign","FPLN_L1","FPLN_L2","FPLN_L3","FPLN_L4","FPLN_L5","FPLN_L6","FPLN_L1S","FPLN_L2S","FPLN_L3S","FPLN_L4S","FPLN_L5S","FPLN_L6S","FPLN_6_group"]; + "PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","FPLN","FPLN_From","FPLN_TMPY_group","FPLN_Callsign","FPLN_L1","FPLN_L2","FPLN_L3","FPLN_L4","FPLN_L5","FPLN_L6","FPLN_L1S","FPLN_L2S","FPLN_L3S","FPLN_L4S","FPLN_L5S","FPLN_L6S","FPLN_6_group","departureTMPY"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -210,7 +211,6 @@ var canvas_MCDU_base = { } fplnLineSize = size(mcdu.FPLNLines[i].output); - if (fplnLineSize >= 1) { fplnl1 = mcdu.FPLNLines[i].output[0].getText(); if (fplnl1 != "") { @@ -342,7 +342,6 @@ var canvas_MCDU_base = { } else { me["FPLN_From"].hide(); } - if (TMPYActive[i].getBoolValue()) { me["FPLN_TMPY_group"].show(); me["FPLN_6_group"].hide(); @@ -1595,7 +1594,7 @@ var canvas_MCDU_base = { } elsif (page == "LATREV") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); - me["Simple_Center"].hide(); + me["Simple_Center"].show(); me["FPLN"].hide(); me["INITA"].hide(); me["INITB"].hide(); @@ -1619,32 +1618,52 @@ var canvas_MCDU_base = { me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - if (myLatRev != nil) { - me["Simple_Title"].setText(sprintf("%s", myLatRev.title[0] ~ myLatRev.title[1] ~ myLatRev.title[2])); + if (myLatRev[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myLatRev[i].title[0] ~ myLatRev[i].title[1] ~ myLatRev[i].title[2])); - forindex (var matrixArrow; myLatRev.arrowsMatrix) { + if (myLatRev[i].subtitle[0] != nil) { + me["Simple_Center"].show(); + me["Simple_C1S"].setText(sprintf("%s", myLatRev[i].subtitle[0] ~ "/" ~ myLatRev[i].subtitle[1])); + me["Simple_C1S"].show(); + me["Simple_C1"].hide(); + me["Simple_C2"].hide(); + me["Simple_C3"].hide(); + me["Simple_C4"].hide(); + me["Simple_C5"].hide(); + me["Simple_C6"].hide(); + me["Simple_C2S"].hide(); + me["Simple_C3S"].hide(); + me["Simple_C4S"].hide(); + me["Simple_C5S"].hide(); + me["Simple_C6S"].hide(); + } else { + me["Simple_Center"].hide(); + } + forindex (var matrixArrow; myLatRev[i].arrowsMatrix) { if (matrixArrow == 0) { var sign = "L"; } else { var sign = "R"; } - forindex (var item; myLatRev.arrowsMatrix[matrixArrow]) { - if (myLatRev.arrowsMatrix[matrixArrow][item] == 1) { + forindex (var item; myLatRev[i].arrowsMatrix[matrixArrow]) { + if (myLatRev[i].arrowsMatrix[matrixArrow][item] == 1) { me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show(); } else { me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide(); } } } + me.colorLeftArrow(myLatRev[i].arrowsColour[0][0],myLatRev[i].arrowsColour[0][1],myLatRev[i].arrowsColour[0][2],myLatRev[i].arrowsColour[0][3],myLatRev[i].arrowsColour[0][4],myLatRev[i].arrowsColour[0][5]); - forindex (var matrixFont; myLatRev.fontMatrix) { + + forindex (var matrixFont; myLatRev[i].fontMatrix) { if (matrixFont == 0) { var sign = "L"; } else { var sign = "R"; } - forindex (var item; myLatRev.fontMatrix[matrixFont]) { - if (myLatRev.fontMatrix[matrixFont][item] == 1) { + forindex (var item; myLatRev[i].fontMatrix[matrixFont]) { + if (myLatRev[i].fontMatrix[matrixFont][item] == 1) { me["Simple_" ~ sign ~ (item + 1)].setFont(symbol); me["Simple_" ~ sign ~ (item + 1)].setFontSize(small); } else { @@ -1654,175 +1673,484 @@ var canvas_MCDU_base = { } } - if (myLatRev.L1[0] == nil) { + if (myLatRev[i].L1[0] == nil) { me["Simple_L1"].hide(); me["Simple_L1S"].hide(); } else { me["Simple_L1"].show(); - me["Simple_L1"].setText(myLatRev.L1[0]); - if (myLatRev.L1[1] != nil) { + me["Simple_L1"].setText(myLatRev[i].L1[0]); + if (myLatRev[i].L1[1] != nil) { me["Simple_L1S"].show(); - me["Simple_L1S"].setText(myLatRev.L1[1]); + me["Simple_L1S"].setText(myLatRev[i].L1[1]); } else { me["Simple_L1S"].hide(); } } - if (myLatRev.L2[0] == nil) { + if (myLatRev[i].L2[0] == nil) { me["Simple_L2"].hide(); me["Simple_L2S"].hide(); } else { me["Simple_L2"].show(); - me["Simple_L2"].setText(myLatRev.L2[0]); - if (myLatRev.L2[1] != nil) { + me["Simple_L2"].setText(myLatRev[i].L2[0]); + if (myLatRev[i].L2[1] != nil) { me["Simple_L2S"].show(); - me["Simple_L2S"].setText(myLatRev.L2[1]); + me["Simple_L2S"].setText(myLatRev[i].L2[1]); } else { me["Simple_L2S"].hide(); } } - if (myLatRev.L3[0] == nil) { + if (myLatRev[i].L3[0] == nil) { me["Simple_L3"].hide(); me["Simple_L3S"].hide(); } else { me["Simple_L3"].show(); - me["Simple_L3"].setText(myLatRev.L3[0]); - if (myLatRev.L3[1] != nil) { + me["Simple_L3"].setText(myLatRev[i].L3[0]); + if (myLatRev[i].L3[1] != nil) { me["Simple_L3S"].show(); - me["Simple_L3S"].setText(myLatRev.L3[1]); + me["Simple_L3S"].setText(myLatRev[i].L3[1]); } else { me["Simple_L3S"].hide(); } } - if (myLatRev.L4[0] == nil) { + if (myLatRev[i].L4[0] == nil) { me["Simple_L4"].hide(); me["Simple_L4S"].hide(); } else { me["Simple_L4"].show(); - me["Simple_L4"].setText(myLatRev.L4[0]); - if (myLatRev.L4[1] != nil) { + me["Simple_L4"].setText(myLatRev[i].L4[0]); + if (myLatRev[i].L4[1] != nil) { me["Simple_L4S"].show(); - me["Simple_L4S"].setText(myLatRev.L4[1]); + me["Simple_L4S"].setText(myLatRev[i].L4[1]); } else { me["Simple_L4S"].hide(); } } - if (myLatRev.L5[0] == nil) { + if (myLatRev[i].L5[0] == nil) { me["Simple_L5"].hide(); me["Simple_L5S"].hide(); } else { me["Simple_L5"].show(); - me["Simple_L5"].setText(myLatRev.L5[0]); - if (myLatRev.L5[1] != nil) { + me["Simple_L5"].setText(myLatRev[i].L5[0]); + if (myLatRev[i].L5[1] != nil) { me["Simple_L5S"].show(); - me["Simple_L5S"].setText(myLatRev.L5[1]); + me["Simple_L5S"].setText(myLatRev[i].L5[1]); } else { me["Simple_L5S"].hide(); } } - if (myLatRev.L6[0] == nil) { + if (myLatRev[i].L6[0] == nil) { me["Simple_L6"].hide(); me["Simple_L6S"].hide(); } else { me["Simple_L6"].show(); - me["Simple_L6"].setText(myLatRev.L6[0]); - if (myLatRev.L6[1] != nil) { + me["Simple_L6"].setText(myLatRev[i].L6[0]); + if (myLatRev[i].L6[1] != nil) { me["Simple_L6S"].show(); - me["Simple_L6S"].setText(myLatRev.L6[1]); + me["Simple_L6S"].setText(myLatRev[i].L6[1]); } else { me["Simple_L6S"].hide(); } } - me.colorLeft(myLatRev.L1[2],myLatRev.L2[2],myLatRev.L3[2],myLatRev.L4[2],myLatRev.L5[2],myLatRev.L6[2]); + me.colorLeft(myLatRev[i].L1[2],myLatRev[i].L2[2],myLatRev[i].L3[2],myLatRev[i].L4[2],myLatRev[i].L5[2],myLatRev[i].L6[2]); - if (myLatRev.R1[0] == nil) { + if (myLatRev[i].R1[0] == nil) { me["Simple_R1"].hide(); me["Simple_R1S"].hide(); } else { me["Simple_R1"].show(); - me["Simple_R1"].setText(myLatRev.R1[0]); - if (myLatRev.R1[1] != nil) { + me["Simple_R1"].setText(myLatRev[i].R1[0]); + if (myLatRev[i].R1[1] != nil) { me["Simple_R1S"].show(); - me["Simple_R1S"].setText(myLatRev.R1[1]); + me["Simple_R1S"].setText(myLatRev[i].R1[1]); } else { me["Simple_R1S"].hide(); } } - if (myLatRev.R2[0] == nil) { + if (myLatRev[i].R2[0] == nil) { me["Simple_R2"].hide(); me["Simple_R2S"].hide(); } else { me["Simple_R2"].show(); - me["Simple_R2"].setText(myLatRev.R2[0]); - if (myLatRev.R2[1] != nil) { + me["Simple_R2"].setText(myLatRev[i].R2[0]); + if (myLatRev[i].R2[1] != nil) { me["Simple_R2S"].show(); - me["Simple_R2S"].setText(myLatRev.R2[1]); + me["Simple_R2S"].setText(myLatRev[i].R2[1]); } else { me["Simple_R2S"].hide(); } } - if (myLatRev.R3[0] == nil) { + if (myLatRev[i].R3[0] == nil) { me["Simple_R3"].hide(); me["Simple_R3S"].hide(); } else { me["Simple_R3"].show(); - me["Simple_R3"].setText(myLatRev.R3[0]); - if (myLatRev.R3[1] != nil) { + me["Simple_R3"].setText(myLatRev[i].R3[0]); + if (myLatRev[i].R3[1] != nil) { me["Simple_R3S"].show(); - me["Simple_R3S"].setText(myLatRev.R3[1]); + me["Simple_R3S"].setText(myLatRev[i].R3[1]); } else { me["Simple_R3S"].hide(); } } - if (myLatRev.R4[0] == nil) { + if (myLatRev[i].R4[0] == nil) { me["Simple_R4"].hide(); me["Simple_R4S"].hide(); } else { me["Simple_R4"].show(); - me["Simple_R4"].setText(myLatRev.R4[0]); - if (myLatRev.R4[1] != nil) { + me["Simple_R4"].setText(myLatRev[i].R4[0]); + if (myLatRev[i].R4[1] != nil) { me["Simple_R4S"].show(); - me["Simple_R4S"].setText(myLatRev.R4[1]); + me["Simple_R4S"].setText(myLatRev[i].R4[1]); } else { me["Simple_R4S"].hide(); } } - if (myLatRev.R5[0] == nil) { + if (myLatRev[i].R5[0] == nil) { me["Simple_R5"].hide(); me["Simple_R5S"].hide(); } else { me["Simple_R5"].show(); - me["Simple_R5"].setText(myLatRev.R5[0]); - if (myLatRev.R5[1] != nil) { + me["Simple_R5"].setText(myLatRev[i].R5[0]); + if (myLatRev[i].R5[1] != nil) { me["Simple_R5S"].show(); - me["Simple_R5S"].setText(myLatRev.R5[1]); + me["Simple_R5S"].setText(myLatRev[i].R5[1]); } else { me["Simple_R5S"].hide(); } } - if (myLatRev.R6[0] == nil) { + if (myLatRev[i].R6[0] == nil) { me["Simple_R6"].hide(); me["Simple_R6S"].hide(); } else { me["Simple_R6"].show(); - me["Simple_R6"].setText(myLatRev.R6[0]); - if (myLatRev.R6[1] != nil) { + me["Simple_R6"].setText(myLatRev[i].R6[0]); + if (myLatRev[i].R6[1] != nil) { me["Simple_R6S"].show(); - me["Simple_R6S"].setText(myLatRev.R6[1]); + me["Simple_R6S"].setText(myLatRev[i].R6[1]); } else { me["Simple_R6S"].hide(); } } - me.colorRight(myLatRev.R1[2],myLatRev.R2[2],myLatRev.R3[2],myLatRev.R4[2],myLatRev.R5[2],myLatRev.R6[2]); + me.colorRight(myLatRev[i].R1[2],myLatRev[i].R2[2],myLatRev[i].R3[2],myLatRev[i].R4[2],myLatRev[i].R5[2],myLatRev[i].R6[2]); + } + pageSwitch[i].setBoolValue(1); + } + } elsif (page == "DEPARTURE") { + if (!pageSwitch[i].getBoolValue()) { + me["Simple"].show(); + me["Simple_Center"].show(); + me["FPLN"].hide(); + me["INITA"].hide(); + me["INITB"].hide(); + me["PERFTO"].hide(); + me["Simple_PageNum"].setText("X/X"); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + + me.fontLeft(default, default, default, default, default, default); + me.fontLeftS(default, default, default, default, default, default); + me.fontRight(default, default, default, default, default, default); + me.fontRightS(default, default, default, default, default, default); + + me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeRight(normal, normal, normal, normal, normal, normal); + + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + + + if (myDeparture[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myDeparture[i].title[0] ~ myDeparture[i].title[1] ~ myDeparture[i].title[2])); + + forindex (var matrixArrow; myDeparture[i].arrowsMatrix) { + if (matrixArrow == 0) { + var sign = "L"; + } else { + var sign = "R"; + } + forindex (var item; myDeparture[i].arrowsMatrix[matrixArrow]) { + if (myDeparture[i].arrowsMatrix[matrixArrow][item] == 1) { + me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show(); + } else { + me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide(); + } + } + } + me.colorLeftArrow(myDeparture[i].arrowsColour[0][0],myDeparture[i].arrowsColour[0][1],myDeparture[i].arrowsColour[0][2],myDeparture[i].arrowsColour[0][3],myDeparture[i].arrowsColour[0][4],myDeparture[i].arrowsColour[0][5]); + + forindex (var matrixFont; myDeparture[i].fontMatrix) { + if (matrixFont == 0) { + var sign = "L"; + } else { + var sign = "R"; + } + forindex (var item; myDeparture[i].fontMatrix[matrixFont]) { + if (myDeparture[i].fontMatrix[matrixFont][item] == 1) { + me["Simple_" ~ sign ~ (item + 1)].setFont(symbol); + me["Simple_" ~ sign ~ (item + 1)].setFontSize(small); + } else { + me["Simple_" ~ sign ~ (item + 1)].setFont(default); + me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal); + } + } + } + + if (myDeparture[i].L1[0] == nil) { + me["Simple_L1"].hide(); + me["Simple_L1S"].hide(); + } else { + me["Simple_L1"].show(); + me["Simple_L1"].setText(myDeparture[i].L1[0]); + if (myDeparture[i].L1[1] != nil) { + me["Simple_L1S"].show(); + me["Simple_L1S"].setText(myDeparture[i].L1[1]); + } else { + me["Simple_L1S"].hide(); + } + } + + if (myDeparture[i].L2[0] == nil) { + me["Simple_L2"].hide(); + me["Simple_L2S"].hide(); + } else { + me["Simple_L2"].show(); + me["Simple_L2"].setText(myDeparture[i].L2[0]); + if (myDeparture[i].L2[1] != nil) { + me["Simple_L2S"].show(); + me["Simple_L2S"].setText(myDeparture[i].L2[1]); + } else { + me["Simple_L2S"].hide(); + } + } + + if (myDeparture[i].L3[0] == nil) { + me["Simple_L3"].hide(); + me["Simple_L3S"].hide(); + } else { + me["Simple_L3"].show(); + me["Simple_L3"].setText(myDeparture[i].L3[0]); + if (myDeparture[i].L3[1] != nil) { + me["Simple_L3S"].show(); + me["Simple_L3S"].setText(myDeparture[i].L3[1]); + } else { + me["Simple_L3S"].hide(); + } + } + + if (myDeparture[i].L4[0] == nil) { + me["Simple_L4"].hide(); + me["Simple_L4S"].hide(); + } else { + me["Simple_L4"].show(); + me["Simple_L4"].setText(myDeparture[i].L4[0]); + if (myDeparture[i].L4[1] != nil) { + me["Simple_L4S"].show(); + me["Simple_L4S"].setText(myDeparture[i].L4[1]); + } else { + me["Simple_L4S"].hide(); + } + } + + if (myDeparture[i].L5[0] == nil) { + me["Simple_L5"].hide(); + me["Simple_L5S"].hide(); + } else { + me["Simple_L5"].show(); + me["Simple_L5"].setText(myDeparture[i].L5[0]); + if (myDeparture[i].L5[1] != nil) { + me["Simple_L5S"].show(); + me["Simple_L5S"].setText(myDeparture[i].L5[1]); + } else { + me["Simple_L5S"].hide(); + } + } + + if (myDeparture[i].L6[0] == nil) { + me["Simple_L6"].hide(); + me["Simple_L6S"].hide(); + } else { + me["Simple_L6"].show(); + me["Simple_L6"].setText(myDeparture[i].L6[0]); + if (myDeparture[i].L6[1] != nil) { + me["Simple_L6S"].show(); + me["Simple_L6S"].setText(myDeparture[i].L6[1]); + } else { + me["Simple_L6S"].hide(); + } + } + me.colorLeft(myDeparture[i].L1[2],myDeparture[i].L2[2],myDeparture[i].L3[2],myDeparture[i].L4[2],myDeparture[i].L5[2],myDeparture[i].L6[2]); + + if (myDeparture[i].C1[0] == nil) { + me["Simple_C1"].hide(); + me["Simple_C1S"].hide(); + } else { + me["Simple_C1"].show(); + me["Simple_C1"].setText(myDeparture[i].C1[0]); + if (myDeparture[i].C1[1] != nil) { + me["Simple_C1S"].show(); + me["Simple_C1S"].setText(myDeparture[i].C1[1]); + } else { + me["Simple_C1S"].hide(); + } + } + + if (myDeparture[i].C2[0] == nil) { + me["Simple_C2"].hide(); + me["Simple_C2S"].hide(); + } else { + me["Simple_C2"].show(); + me["Simple_C2"].setText(myDeparture[i].C2[0]); + if (myDeparture[i].C2[1] != nil) { + me["Simple_C2S"].show(); + me["Simple_C2S"].setText(myDeparture[i].C2[1]); + } else { + me["Simple_C2S"].hide(); + } + } + + if (myDeparture[i].C3[0] == nil) { + me["Simple_C3"].hide(); + me["Simple_C3S"].hide(); + } else { + me["Simple_C3"].show(); + me["Simple_C3"].setText(myDeparture[i].C3[0]); + if (myDeparture[i].C3[1] != nil) { + me["Simple_C3S"].show(); + me["Simple_C3S"].setText(myDeparture[i].C3[1]); + } else { + me["Simple_C3S"].hide(); + } + } + + if (myDeparture[i].C4[0] == nil) { + me["Simple_C4"].hide(); + me["Simple_C4S"].hide(); + } else { + me["Simple_C4"].show(); + me["Simple_C4"].setText(myDeparture[i].C4[0]); + if (myDeparture[i].C4[1] != nil) { + me["Simple_C4S"].show(); + me["Simple_C4S"].setText(myDeparture[i].C4[1]); + } else { + me["Simple_C4S"].hide(); + } + } + + if (myDeparture[i].C5[0] == nil) { + me["Simple_C5"].hide(); + me["Simple_C5S"].hide(); + } else { + me["Simple_C5"].show(); + me["Simple_C5"].setText(myDeparture[i].C5[0]); + if (myDeparture[i].C5[1] != nil) { + me["Simple_C5S"].show(); + me["Simple_C5S"].setText(myDeparture[i].C5[1]); + } else { + me["Simple_C5S"].hide(); + } + } + me.colorCenter(myDeparture[i].C1[2],myDeparture[i].C2[2],myDeparture[i].C3[2],myDeparture[i].C4[2],myDeparture[i].C5[2],myDeparture[i].C6[2]); + + me["Simple_C6"].hide(); + me["Simple_C6S"].hide(); + + if (myDeparture[i].R1[0] == nil) { + me["Simple_R1"].hide(); + me["Simple_R1S"].hide(); + } else { + me["Simple_R1"].show(); + me["Simple_R1"].setText(myDeparture[i].R1[0]); + if (myDeparture[i].R1[1] != nil) { + me["Simple_R1S"].show(); + me["Simple_R1S"].setText(myDeparture[i].R1[1]); + } else { + me["Simple_R1S"].hide(); + } + } + + if (myDeparture[i].R2[0] == nil) { + me["Simple_R2"].hide(); + me["Simple_R2S"].hide(); + } else { + me["Simple_R2"].show(); + me["Simple_R2"].setText(myDeparture[i].R2[0]); + if (myDeparture[i].R2[1] != nil) { + me["Simple_R2S"].show(); + me["Simple_R2S"].setText(myDeparture[i].R2[1]); + } else { + me["Simple_R2S"].hide(); + } + } + + if (myDeparture[i].R3[0] == nil) { + me["Simple_R3"].hide(); + me["Simple_R3S"].hide(); + } else { + me["Simple_R3"].show(); + me["Simple_R3"].setText(myDeparture[i].R3[0]); + if (myDeparture[i].R3[1] != nil) { + me["Simple_R3S"].show(); + me["Simple_R3S"].setText(myDeparture[i].R3[1]); + } else { + me["Simple_R3S"].hide(); + } + } + + if (myDeparture[i].R4[0] == nil) { + me["Simple_R4"].hide(); + me["Simple_R4S"].hide(); + } else { + me["Simple_R4"].show(); + me["Simple_R4"].setText(myDeparture[i].R4[0]); + if (myDeparture[i].R4[1] != nil) { + me["Simple_R4S"].show(); + me["Simple_R4S"].setText(myDeparture[i].R4[1]); + } else { + me["Simple_R4S"].hide(); + } + } + + if (myDeparture[i].R5[0] == nil) { + me["Simple_R5"].hide(); + me["Simple_R5S"].hide(); + } else { + me["Simple_R5"].show(); + me["Simple_R5"].setText(myDeparture[i].R5[0]); + if (myDeparture[i].R5[1] != nil) { + me["Simple_R5S"].show(); + me["Simple_R5S"].setText(myDeparture[i].R5[1]); + } else { + me["Simple_R5S"].hide(); + } + } + + if (myDeparture[i].R6[0] == nil) { + me["Simple_R6"].hide(); + me["Simple_R6S"].hide(); + } else { + me["Simple_R6"].show(); + me["Simple_R6"].setText(myDeparture[i].R6[0]); + if (myDeparture[i].R6[1] != nil) { + me["Simple_R6S"].show(); + me["Simple_R6S"].setText(myDeparture[i].R6[1]); + } else { + me["Simple_R6S"].hide(); + } + } + me.colorRight(myDeparture[i].R1[2],myDeparture[i].R2[2],myDeparture[i].R3[2],myDeparture[i].R4[2],myDeparture[i].R5[2],myDeparture[i].R6[2]); } pageSwitch[i].setBoolValue(1); } diff --git a/Nasal/MCDU/DEPARTURE.nas b/Nasal/MCDU/DEPARTURE.nas new file mode 100644 index 00000000..be7f321c --- /dev/null +++ b/Nasal/MCDU/DEPARTURE.nas @@ -0,0 +1,140 @@ +var departurePage = { + title: [nil, nil, nil], + subtitle: [nil, nil], + fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], + L1: [nil, nil, "ack"], # content, title, colour + L2: [nil, nil, "ack"], + L3: [nil, nil, "ack"], + L4: [nil, nil, "ack"], + L5: [nil, nil, "ack"], + L6: [nil, nil, "ack"], + C1: [nil, nil, "ack"], + C2: [nil, nil, "ack"], + C3: [nil, nil, "ack"], + C4: [nil, nil, "ack"], + C5: [nil, nil, "ack"], + C6: [nil, nil, "ack"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + depAirport: nil, + runways: nil, + selectedRunway: nil, + sids: nil, + computer: nil, + enableScroll: 0, + _runways: nil, + _sids: nil, + new: func(icao, computer) { + var lr = {parents:[departurePage]}; + lr.id = icao; + lr.computer = computer; + lr._setupPageWithData(); + lr.updateRunways(); + lr.updateActiveRunway(); + return lr; + }, + del: func() { + return nil; + }, + _setupPageWithData: func() { + me.title = ["DEPARTURE", " FROM ", left(me.id, 4)]; + if (!TMPYActive[me.computer].getBoolValue()) { + me.L6 = [" RETURN END", nil, "wht"]; + } else { + me.L6 = [" F-PLN", " TMPY", "yel"]; + me.arrowsColour[0][5] = "yel"; + } + + me.C1 = ["------- ", "SID", "wht"]; + me.R1 = ["-------", "TRANS ", "wht"]; + me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + 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"]]; + }, + updateActiveRunway: func() { + if (me.selectedRunway != nil) { + if (fmgc.fp[2].departure_runway != nil) { + if (fmgc.fp[2].departure_runway.id == me.selectedRunway.id) { + me.L1 = [fmgc.fp[me.computer].departure_runway.id, " RWY", "grn"]; + } elsif (fmgc.fp[me.computer].departure_runway != nil) { + me.L1 = [fmgc.fp[me.computer].departure_runway.id, " RWY", "yel"]; + } else { + me.L1 = ["---", " RWY", "wht"]; + } + } elsif (fmgc.fp[me.computer].departure_runway != nil) { + me.L1 = [fmgc.fp[me.computer].departure_runway.id, " RWY", "yel"]; + } else { + me.L1 = ["---", " RWY", "wht"]; + } + } else { + me.L1 = ["---", " RWY", "wht"]; + } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + updateRunways: func() { + me.depAirport = findAirportsByICAO(left(me.id, 4)); + me._runways = keys(me.depAirport[0].runways); + me.runways = sort(me._runways,func(a,b) cmp(a,b)); + + me.fourRunways = [nil, nil, nil, nil]; + + if (size(me.runways) >= 1) { + me.L2 = [" " ~ me.runways[0], nil, "blu"]; + me.C2 = [math.round(me.depAirport[0].runways[me.runways[0]].length) ~ "M", nil, "blu"]; + me.R2 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[0]].heading), nil, "blu"]; + me.arrowsMatrix[0][1] = 1; + me.arrowsColour[0][1] = "blu"; + } + if (size(me.runways) >= 2) { + me.L3 = [" " ~ me.runways[1], nil, "blu"]; + me.C3 = [math.round(me.depAirport[0].runways[me.runways[1]].length) ~ "M", nil, "blu"]; + me.R3 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[1]].heading), nil, "blu"]; + me.arrowsMatrix[0][2] = 1; + me.arrowsColour[0][2] = "blu"; + } + if (size(me.runways) >= 3) { + me.L4 = [" " ~ me.runways[2], nil, "blu"]; + me.C4 = [math.round(me.depAirport[0].runways[me.runways[2]].length) ~ "M", nil, "blu"]; + me.R4 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[2]].heading), nil, "blu"]; + me.arrowsMatrix[0][3] = 1; + me.arrowsColour[0][3] = "blu"; + } + if (size(me.runways) >= 4) { + me.L5 = [" " ~ me.runways[3], nil, "blu"]; + me.C5 = [math.round(me.depAirport[0].runways[me.runways[3]].length) ~ "M", nil, "blu"]; + me.R5 = ["CRS" ~ math.round(me.depAirport[0].runways[me.runways[3]].heading), nil, "blu"]; + me.arrowsMatrix[0][4] = 1; + me.arrowsColour[0][4] = "blu"; + } + + if (size(me.runways) > 4) { + me.enableScroll = 1; + } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + makeTmpy: func() { + if (!TMPYActive[me.computer].getBoolValue()) { + fmgc.flightplan.initTempFP(me.computer, 2); + me.L6 = [" F-PLN", " TMPY", "yel"]; + me.arrowsColour[0][5] = "yel"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } + }, + depPushbuttonLeft: func(index) { + if (size(me.runways) >= (index - 1)) { + me.selectedRunway = me.depAirport[0].runway(me.runways[index - 2]); + me.makeTmpy(); + fmgc.fp[me.computer].departure_runway = me.selectedRunway; + me.updateActiveRunway(); + fmgc.flightplan.checkWPOutputs(me.computer); + } else { + notAllowed(me.computer); + } + }, +}; \ No newline at end of file diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 3e841584..7c4617df 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -140,33 +140,35 @@ var FPLNText = { } } else if (size(scratchpad) == 1) { formatError(me.computer.mcdu); - } else { - if (me.getText() == fmgc.fp[2].departure.id) { - if (canvas_mcdu.myLatRev != nil) { - canvas_mcdu.myLatRev.del(); + } else if (scratchpad == "") { + if (me.getText() == fmgc.fp[2].departure.id or left(me.getText(), 4) == fmgc.fp[2].departure.id) { + if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) { + canvas_mcdu.myLatRev[me.computer.mcdu].del(); } - canvas_mcdu.myLatRev = nil; - canvas_mcdu.myLatRev = latRev.new(0, me.getText()); + canvas_mcdu.myLatRev[me.computer.mcdu] = nil; + canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(0, me.getText()); } elsif (me.index == fmgc.arrivalAirportI[2]) { - if (canvas_mcdu.myLatRev != nil) { - canvas_mcdu.myLatRev.del(); + if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) { + canvas_mcdu.myLatRev[me.computer.mcdu].del(); } - canvas_mcdu.myLatRev = nil; - canvas_mcdu.myLatRev = latRev.new(1, me.getText()); - } elsif (me.index == fmgc.currentWP[2]) { - if (canvas_mcdu.myLatRev != nil) { - canvas_mcdu.myLatRev.del(); + canvas_mcdu.myLatRev[me.computer.mcdu] = nil; + canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(1, me.getText()); + } elsif (me.index == (fmgc.currentWP[2] - 1)) { + if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) { + canvas_mcdu.myLatRev[me.computer.mcdu].del(); } - canvas_mcdu.myLatRev = nil; - canvas_mcdu.myLatRev = latRev.new(2, me.getText()); + canvas_mcdu.myLatRev[me.computer.mcdu] = nil; + canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(2, me.getText()); } else { - if (canvas_mcdu.myLatRev != nil) { - canvas_mcdu.myLatRev.del(); + if (canvas_mcdu.myLatRev[me.computer.mcdu] != nil) { + canvas_mcdu.myLatRev[me.computer.mcdu].del(); } - canvas_mcdu.myLatRev = nil; - canvas_mcdu.myLatRev = latRev.new(3, me.getText()); + canvas_mcdu.myLatRev[me.computer.mcdu] = nil; + canvas_mcdu.myLatRev[me.computer.mcdu] = latRev.new(3, me.getText()); } setprop("/MCDU[" ~ me.computer.mcdu ~ "]/page", "LATREV"); + } else { + notAllowed(me.computer.mcdu); } } }, diff --git a/Nasal/MCDU/LATREV.nas b/Nasal/MCDU/LATREV.nas index 309e7e39..cb241159 100644 --- a/Nasal/MCDU/LATREV.nas +++ b/Nasal/MCDU/LATREV.nas @@ -3,6 +3,7 @@ var latRev = { subtitle: [nil, nil], fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], L1: [nil, nil, "ack"], # content, title, colour L2: [nil, nil, "ack"], L3: [nil, nil, "ack"], @@ -34,33 +35,44 @@ var latRev = { me.L3 = [" HOLD", nil, "wht"]; me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["FIX INFO ", nil, "wht"]; - me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; + me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; me.arrowsMatrix = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0]]; + me.arrowsColour = [["ack", "wht", "wht", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]]; } else { me.title = ["LAT REV", " FROM ", me.id]; - if (me.type == 0) { - me.depAirport = findAirportsByICAO(me.id); + if (me.type == 0) { + if (size(me.id) > 4) { + me.depAirport = findAirportsByICAO(left(me.id, 4)); + } else { + me.depAirport = findAirportsByICAO(me.id); + } me.subtitle = [dmsToString(sprintf(me.depAirport[0].lat), "lat"), dmsToString(sprintf(me.depAirport[0].lon), "lon")]; me.L1 = [" DEPARTURE", nil, "wht"]; me.L2 = [" OFFSET", nil, "wht"]; me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["FIX INFO ", nil, "wht"]; - me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; - me.R3 = ["[ ]", "NEXT WPT ", "blu"]; - me.R4 = ["[ ]", "NEW DEST", "blu"]; + me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; + me.R3 = ["[ ]", "NEXT WPT ", "blu"]; + me.R4 = ["[ ]", "NEW DEST", "blu"]; me.arrowsMatrix = [[1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0]]; + me.arrowsColour = [["wht", "wht", "ack", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 0, 0]]; } elsif (me.type == 1) { - me.arrAirport = findAirportsByICAO(me.id); + if (size(me.id) > 4) { + me.arrAirport = findAirportsByICAO(left(me.id, 4)); + } else { + me.arrAirport = findAirportsByICAO(me.id); + } me.subtitle = [dmsToString(sprintf(me.arrAirport[0].lat), "lat"), dmsToString(sprintf(me.arrAirport[0].lon), "lon")]; me.L3 = [" ALTN", nil, "wht"]; - me.L4 = [" ALTN", "ENABLE", "blu"]; + me.L4 = [" ALTN", " ENABLE", "blu"]; me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["ARRIVAL ", nil, "wht"]; - me.R3 = ["[ ]", "NEXT WPT ", "blu"]; + me.R3 = ["[ ]", "NEXT WPT ", "blu"]; me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 0, 0]]; + me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0]]; } elsif (me.type == 3) { if (size(me.id) == 2 or size(me.id) == 3) { @@ -72,13 +84,14 @@ var latRev = { } me.subtitle = [dmsToString(sprintf(me.wpt[0].lat), "lat"), dmsToString(sprintf(me.wpt[0].lon), "lon")]; me.L3 = [" HOLD", nil, "wht"]; - me.L4 = [" ALTN", "ENABLE", "blu"]; + me.L4 = [" ALTN", " ENABLE", "blu"]; me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["FIX INFO ", nil, "wht"]; - me.R3 = ["[ ]", "NEXT WPT ", "blu"]; - me.R4 = ["[ ]", "NEW DEST", "blu"]; + me.R3 = ["[ ]", "NEXT WPT ", "blu"]; + me.R4 = ["[ ]", "NEW DEST", "blu"]; me.R5 = ["AIRWAYS ", nil, "wht"]; me.arrowsMatrix = [[0, 0, 1, 1, 0, 1], [1, 0, 0, 0, 1, 0]]; + me.arrowsColour = [["ack", "ack", "wht", "blu", "ack", "wht"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0]]; } } @@ -86,13 +99,12 @@ var latRev = { }; var dmsToString = func(dms, type) { - var decimalSplit = split(".", dms); - var degrees = decimalSplit[0]; - var minutes = decimalSplit[1] * 60; + var degrees = int(dms); + var minutes = sprintf("%.1f",abs((dms - degrees) * 60)); if (type == "lat") { var sign = degrees >= 0 ? "N" : "S"; } else { var sign = degrees >= 0 ? "E" : "W"; } - return degrees ~ "g" ~ minutes ~ " " ~ sign; + return abs(degrees) ~ "g" ~ minutes ~ " " ~ sign; } \ No newline at end of file diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 62c094fd..7d0520a2 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -105,6 +105,13 @@ var lskbutton = func(btn, i) { printInput("L1", i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC2") { printInput2("L1", i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { + if (canvas_mcdu.myDeparture[i] != nil) { + canvas_mcdu.myDeparture[i].del(); + } + canvas_mcdu.myDeparture[i] = nil; + canvas_mcdu.myDeparture[i] = departurePage.new(canvas_mcdu.myLatRev[i].title[2], i); + setprop("/MCDU[" ~ i ~ "]/page", "DEPARTURE"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { FPLNButton("L", 1, i); } else { @@ -131,6 +138,8 @@ var lskbutton = func(btn, i) { printInput2("L2", i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { FPLNButton("L", 2, i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + canvas_mcdu.myDeparture[i].depPushbuttonLeft(2); } else { notAllowed(i); } @@ -149,6 +158,8 @@ var lskbutton = func(btn, i) { printInput2("L3", i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { FPLNButton("L", 3, i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + canvas_mcdu.myDeparture[i].depPushbuttonLeft(3); } else { notAllowed(i); } @@ -163,6 +174,8 @@ var lskbutton = func(btn, i) { printInput2("L4", i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { FPLNButton("L", 4, i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + canvas_mcdu.myDeparture[i].depPushbuttonLeft(4); } else { notAllowed(i); } @@ -185,6 +198,8 @@ var lskbutton = func(btn, i) { printInput2("L5", i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { FPLNButton("L", 5, i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + canvas_mcdu.myDeparture[i].depPushbuttonLeft(5); } else { notAllowed(i); } @@ -203,6 +218,12 @@ var lskbutton = func(btn, i) { FPLNButton("L", 6, i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "LATREV") { setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { + if (canvas_mcdu.TMPYActive[i].getBoolValue()) { + setprop("/MCDU[" ~ i ~ "]/page", "F-PLNA"); + } else { + setprop("/MCDU[" ~ i ~ "]/page", "LATREV"); + } } else { notAllowed(i); }