diff --git a/A320-main.xml b/A320-main.xml index d4011cf1..5811ce73 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -653,6 +653,7 @@ 0 0 + 0 @@ -4271,6 +4272,7 @@ Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas + Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas Aircraft/A320-family/Nasal/MCDU/HOLD.nas Aircraft/A320-family/Nasal/MCDU/F-PLN.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 6f1e490f..030d6b7d 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -17,6 +17,8 @@ var myHold = [nil, nil]; var myAirways = [nil, nil]; var myDuplicate = [nil, nil]; var myClosestAirport = [nil, nil]; +var myReceivedMessage = [nil, nil]; +var myReceivedMessages = [nil, nil]; var myPilotWP = [nil, nil]; var myWind = [nil, nil]; var myCLBWIND = [nil, nil]; @@ -267,7 +269,7 @@ var canvas_MCDU_base = { "FUELPRED_ZFWCG","FUELPRED_ZFWCG_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR", "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", - "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; + "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -299,6 +301,25 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); }, + defaultHideWithCenter: func() { + me["Simple"].show(); + me["Simple_Center"].show(); + me["FPLN"].hide(); + me["DIRTO_TMPY_group"].hide(); + me["INITA"].hide(); + me["IRSINIT"].hide(); + me["INITB"].hide(); + me["FUELPRED"].hide(); + me["PROG"].hide(); + me["PERFTO"].hide(); + }, + defaultPageNumbers: func() { + me["Simple_Title"].setColor(1, 1, 1); + me["Simple_PageNum"].setText("X/X"); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + }, hideAllArrows: func() { me["Simple_L1_Arrow"].hide(); me["Simple_L2_Arrow"].hide(); @@ -313,6 +334,36 @@ var canvas_MCDU_base = { me["Simple_R5_Arrow"].hide(); me["Simple_R6_Arrow"].hide(); }, + hideAllArrowsButL6: func() { + 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(); + me["Simple_L6_Arrow"].show(); + me["Simple_R1_Arrow"].hide(); + me["Simple_R2_Arrow"].hide(); + me["Simple_R3_Arrow"].hide(); + me["Simple_R4_Arrow"].hide(); + me["Simple_R5_Arrow"].hide(); + me["Simple_R6_Arrow"].hide(); + }, + standardFontSize: func() { + 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); + }, + standardFontColour: func() { + me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + }, updateCommon: func(i) { page = pageProp[i].getValue(); if (page != "NOTIFICATION") { @@ -334,6 +385,9 @@ var canvas_MCDU_base = { } else { me["MODEVHF3"].show(); } + if (page != "WEATHERREQ") { + me["WEATHERREQSEND"].hide(); + } if (page != "COMMINIT" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMSTATUS") { me["PRINTPAGE"].hide(); } else { @@ -451,11 +505,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("MCDU MENU"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, -1, -1); me["Simple_L0S"].hide(); @@ -467,21 +517,8 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.colorLeft("ack", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - + me.standardFontSize(); + me.standardFontColour(); me["Simple_L3"].setText(" AIDS"); me["Simple_L4"].setText(" CFDS"); pageSwitch[i].setBoolValue(1); @@ -512,11 +549,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("ATSU DATALINK"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, -1, -1, -1, -1, -1); me["Simple_L0S"].hide(); @@ -528,26 +561,311 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); + me.standardFontSize(); + me.standardFontColour(); + me["Simple_L1"].setText(" ATC MENU"); + me["Simple_R1"].setText("AOC MENU "); + me["Simple_R6"].setText("COMM MENU "); + pageSwitch[i].setBoolValue(1); + } + } else if (page == "AOCMENU") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me["Simple_Title"].setText("AOC MENU"); + me.defaultPageNumbers(); + + me.showLeft(1, 1, 1, -1, 1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(-1, -1, -1, -1, -1, 1); + me.showLeftArrow(1, 1, 1, -1, 1, 1); + me.showRight(1, 1, 1, 1, 1, -1); + me.showRightS(-1, -1, -1, -1, -1, -1); + me.showRightArrow(1, 1, 1, 1, 1, -1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.standardFontSize(); + me.standardFontColour(); + + me["Simple_L1"].setText(" PREFLIGHT"); + me["Simple_L2"].setText(" ENROUTE"); + me["Simple_L3"].setText(" POSTFLIGHT"); + me["Simple_L5"].setText(" SNAG"); + me["Simple_L6S"].setText(" ATSU DLK"); + me["Simple_L6"].setText(" RETURN"); + + me["Simple_R1"].setText("FLT LOG "); + me["Simple_R2"].setText("WEATHER REQ "); + me["Simple_R3"].setText("RCVD MSGS "); + me["Simple_R4"].setText("REPORTS "); + me["Simple_R5"].setText("CONFIG "); + pageSwitch[i].setBoolValue(1); + } + } else if (page == "WEATHERREQ") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me["Simple_Title"].setText("WEATHER REQ"); + me.defaultPageNumbers(); + + me.showLeft(1, -1, -1, -1, -1, 1); + me["Simple_L0S"].hide(); + me.showLeftS(1, -1, -1, -1, -1, -1); + me.showLeftArrow(1, -1, -1, -1, -1, 1); + me.showRight(1, 1, 1, -1, 1, -1); + me.showRightS(1, 1, 1, -1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.fontLeft(default, default, default, default, default, default); + me.fontLeftS(default, default, default, default, default, default); + me.fontRight(symbol, symbol, symbol, 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.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRight("blu", "blu", "blu", "wht", "blu", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + + me["Simple_L1"].setText(" WEATHER TYPE"); + me["Simple_L1S"].setText(" " ~ atsu.AOC.selectedType); + me["Simple_R1S"].setText("STA 1 "); + me["Simple_R2"].setText("[ ]"); + me["Simple_R2S"].setText("STA 2 "); + me["Simple_R3"].setText("[ ]"); + me["Simple_R3S"].setText("STA 3 "); + pageSwitch[i].setBoolValue(1); + } + + if (atsu.AOC.station != nil) { + me["Simple_R1"].setFont(default); + me["Simple_R1"].setText(atsu.AOC.station); + if (atsu.AOC.sent and !atsu.AOC.received) { + me["WEATHERREQSEND"].hide(); + } else { + me["WEATHERREQSEND"].show(); + } + + if (atsu.AOC.sent) { + me["Simple_R5"].setText(atsu.AOC.sentTime ~ " SEND "); + } else { + me["Simple_R5"].setText("SEND "); + } + } else { + me["Simple_R5"].setText("SEND "); + me["Simple_R1"].setFont(symbol); + me["Simple_R1"].setText("[ ]"); + me["WEATHERREQSEND"].hide(); + } + + me._receivedTime = left(getprop("/sim/time/gmt-string"), 5); + me.receivedTime = split(":", me._receivedTime)[0] ~ "." ~ split(":", me._receivedTime)[1] ~ "Z"; + me["Simple_L6"].setText(" RETURN " ~ me.receivedTime); + } else if (page == "WEATHERTYPE") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me["Simple_Title"].setText("WEATHER TYPE"); + me.defaultPageNumbers(); + + me.showLeft(1, 1, 1, -1, -1, -1); + me["Simple_L0S"].hide(); + me.showLeftS(-1, -1, -1, -1, -1, -1); + me.showLeftArrow(1, 1, 1, -1, -1, -1); + me.showRight(1, 1, 1, -1, -1, -1); + me.showRightS(-1, -1, -1, -1, -1, -1); + me.showRightArrow(1, 1, 1, -1, -1, -1); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.standardFontSize(); + me.standardFontColour(); + + me["Simple_L1"].setText(" HOURLY WX"); + me["Simple_L2"].setText(" AREA FCST"); + me["Simple_L3"].setText(" FLD CONDX"); + me["Simple_R1"].setText("TERM FCST "); + me["Simple_R2"].setText("NOTAMS "); + me["Simple_R3"].setText("SEVERE WX "); + pageSwitch[i].setBoolValue(1); + } + } else if (page == "RECEIVEDMSGS") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHide(); + me["Simple_Title"].show(); + me["arrowsDepArr"].hide(); + me.hideAllArrowsButL6(); + + me["Simple_L0S"].hide(); + me["Simple_L6S"].hide(); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + 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.fontSizeCenter(normal, normal, normal, normal, normal, normal); me.fontSizeRight(normal, normal, normal, normal, normal, normal); - me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me["Simple_L1"].setText(" ATC MENU"); - me["Simple_R1"].setText("AOC MENU "); - me["Simple_R6"].setText("COMM MENU "); + me.showRight(-1, -1, -1, -1, -1, -1); + me.showRightS(-1, -1, -1, -1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + + if (myReceivedMessages[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myReceivedMessages[i].title)); + + me["Simple_L6_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myReceivedMessages[i].arrowsColour[0][5] ~ "/r"), getprop("/MCDUC/colors/" ~ myReceivedMessages[i].arrowsColour[0][5] ~ "/g"), getprop("/MCDUC/colors/" ~ myReceivedMessages[i].arrowsColour[0][5] ~ "/b")); + + if (mcdu.ReceivedMessagesDatabase.getCountPages() > 1) { + me["Simple_PageNum"].show(); + me["Simple_PageNum"].setText(myReceivedMessages[i].getPageNumStr()); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + } else { + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + } + + me.dynamicPageFontFunc(myReceivedMessages[i]); + me.dynamicPageArrowFunc(myReceivedMessages[i]); + + me.dynamicPageFunc(myReceivedMessages[i].L1, "Simple_L1"); + me.dynamicPageFunc(myReceivedMessages[i].L2, "Simple_L2"); + me.dynamicPageFunc(myReceivedMessages[i].L3, "Simple_L3"); + me.dynamicPageFunc(myReceivedMessages[i].L4, "Simple_L4"); + me.dynamicPageFunc(myReceivedMessages[i].L5, "Simple_L5"); + me.colorLeft(myReceivedMessages[i].L1[2],myReceivedMessages[i].L2[2],myReceivedMessages[i].L3[2],myReceivedMessages[i].L4[2],myReceivedMessages[i].L5[2],myReceivedMessages[i].L6[2]); + me["Simple_L6"].setColor(WHITE); + } pageSwitch[i].setBoolValue(1); } + + if (myReceivedMessages[i] != nil) { + me._receivedTime = left(getprop("/sim/time/gmt-string"), 5); + me.receivedTime = split(":", me._receivedTime)[0] ~ "." ~ split(":", me._receivedTime)[1] ~ "Z"; + me["Simple_L6"].setText(" RETURN " ~ me.receivedTime); + } + } else if (page == "RECEIVEDMSG") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + me["Simple_Title"].show(); + me["arrowsDepArr"].hide(); + me.hideAllArrowsButL6(); + me["Simple_PageNum"].hide(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me["Simple_L0S"].hide(); + me["Simple_L6S"].hide(); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + 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(small, small, small, small, small, normal); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); + me.fontSizeRight(normal, normal, normal, normal, normal, normal); + + me.colorLeftS("grn", "wht", "wht", "wht", "wht", "wht"); + me.colorCenterS("grn", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + + me.showCenter(-1, -1, -1, -1, -1, -1); + me.showCenterS(1, -1, -1, -1, -1, -1); + me.showRight(-1, -1, -1, -1, -1, -1); + me.showRightS(1, -1, -1, -1, -1, -1); + me.showRightArrow(-1, -1, -1, -1, -1, -1); + + + if (myReceivedMessage[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myReceivedMessage[i].title)); + + me["Simple_L6_Arrow"].setColor(getprop("/MCDUC/colors/" ~ myReceivedMessage[i].arrowsColour[0][5] ~ "/r"), getprop("/MCDUC/colors/" ~ myReceivedMessage[i].arrowsColour[0][5] ~ "/g"), getprop("/MCDUC/colors/" ~ myReceivedMessage[i].arrowsColour[0][5] ~ "/b")); + + forindex (var matrixFont; myReceivedMessages[i].fontMatrix) { + if (matrixFont == 0) { + var sign = "L"; + } else { + var sign = "R"; + } + forindex (var item; myReceivedMessages[i].fontMatrix[matrixFont]) { + if (myReceivedMessages[i].fontMatrix[matrixFont][item] == 1) { + me["Simple_" ~ sign ~ (item + 1)].setFont(symbol); + } else { + me["Simple_" ~ sign ~ (item + 1)].setFont(default); + } + } + } + + me.dynamicPageArrowFunc(myReceivedMessage[i]); + + if (myReceivedMessage[i].L1[0] != nil) { + me["Simple_L1"].setText(myReceivedMessage[i].L1[0]); + me["Simple_L1"].show(); + } else { me["Simple_L1"].hide(); } + if (myReceivedMessage[i].L1[1] != nil) { + me["Simple_L1S"].setText(myReceivedMessage[i].L1[1]); + me["Simple_L1S"].show(); + } else { me["Simple_L1S"].hide(); } + if (myReceivedMessage[i].L2[0] != nil) { + me["Simple_L2"].setText(myReceivedMessage[i].L2[0]); + me["Simple_L2"].show(); + } else { me["Simple_L2"].hide(); } + if (myReceivedMessage[i].L2[1] != nil) { + me["Simple_L2S"].setText(myReceivedMessage[i].L2[1]); + me["Simple_L2S"].show(); + } else { me["Simple_L2S"].hide(); } + if (myReceivedMessage[i].L3[0] != nil) { + me["Simple_L3"].setText(myReceivedMessage[i].L3[0]); + me["Simple_L3"].show(); + } else { me["Simple_L3"].hide(); } + if (myReceivedMessage[i].L3[1] != nil) { + me["Simple_L3S"].setText(myReceivedMessage[i].L3[1]); + me["Simple_L3S"].show(); + } else { me["Simple_L3S"].hide(); } + if (myReceivedMessage[i].L4[0] != nil) { + me["Simple_L4"].setText(myReceivedMessage[i].L4[0]); + me["Simple_L4"].show(); + } else { me["Simple_L4"].hide(); } + if (myReceivedMessage[i].L4[1] != nil) { + me["Simple_L4S"].setText(myReceivedMessage[i].L4[1]); + me["Simple_L4S"].show(); + } else { me["Simple_L4S"].hide(); } + if (myReceivedMessage[i].L5[0] != nil) { + me["Simple_L5"].setText(myReceivedMessage[i].L5[0]); + me["Simple_L5"].show(); + } else { me["Simple_L5"].hide(); } + if (myReceivedMessage[i].L5[1] != nil) { + me["Simple_L5S"].setText(myReceivedMessage[i].L5[1]); + me["Simple_L5S"].show(); + } else { me["Simple_L5S"].hide(); } + + me["Simple_C1S"].setText(myReceivedMessage[i].C1[1]); + me["Simple_R1S"].setText(myReceivedMessage[i].R1[1]); + me.colorLeft(myReceivedMessage[i].L1[2],myReceivedMessage[i].L2[2],myReceivedMessage[i].L3[2],myReceivedMessage[i].L4[2],myReceivedMessage[i].L5[2],myReceivedMessage[i].L6[2]); + me["Simple_L6"].setColor(WHITE); + me["Simple_C1S"].setColor(GREEN); + } + pageSwitch[i].setBoolValue(1); + } + + if (myReceivedMessage[i] != nil) { + me._receivedTime = left(getprop("/sim/time/gmt-string"), 5); + me.receivedTime = split(":", me._receivedTime)[0] ~ "." ~ split(":", me._receivedTime)[1] ~ "Z"; + me["Simple_L6"].setText(" RETURN " ~ me.receivedTime); + } } else if (page == "ATCMENU") { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); @@ -568,13 +886,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -620,21 +932,8 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - + me.standardFontSize(); + me.standardFontColour(); me["Simple_L1"].setText(" DEPART REQ"); me["Simple_L2"].setText(" OCEANIC REQ"); @@ -646,26 +945,13 @@ var canvas_MCDU_base = { } } else if (page == "NOTIFICATION") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("NOTIFICATION"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, -1, -1, -1, 1); me["Simple_L0S"].hide(); @@ -748,26 +1034,13 @@ var canvas_MCDU_base = { } } else if (page == "CONNECTSTATUS") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("CONNECTION STATUS"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, -1, 1, -1, 1); me["Simple_L0S"].hide(); @@ -842,11 +1115,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("COMM MENU"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, -1, -1, 1); me["Simple_L0S"].hide(); @@ -865,14 +1134,7 @@ var canvas_MCDU_base = { me.fontSizeLeft(normal, normal, normal, normal, normal, normal); me.fontSizeRight(normal, normal, normal, normal, small, normal); - - me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - + me.standardFontColour(); me["Simple_L1S"].setText(" COMM"); me["Simple_L1"].setText(" INIT"); me["Simple_L2S"].setText(" VHF3"); @@ -891,26 +1153,13 @@ var canvas_MCDU_base = { } } else if (page == "VOICEDIRECTORY") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("VHF3 VOICE DIRECTORY"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, -1, -1, 1, -1, 1); me["Simple_L0S"].hide(); @@ -924,13 +1173,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeft("blu", "wht", "wht", "wht", "wht", "wht"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -968,26 +1211,13 @@ var canvas_MCDU_base = { } } else if (page == "DATAMODE") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("VHF3 DATA MODE"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(-1, 1, 1, 1, -1, 1); me["Simple_L0S"].hide(); @@ -1001,13 +1231,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeft("wht", "blu", "blu", "blu", "wht", "wht"); me.colorLeftS("grn", "blu", "blu", "blu", "wht", "wht"); @@ -1044,11 +1268,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("COMM INIT"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(-1, 1, 1, 1, -1, 1); me["Simple_L0S"].hide(); @@ -1093,11 +1313,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("COMM STATUS"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, -1, 1, 1, 1); me["Simple_L0S"].hide(); @@ -1152,11 +1368,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("COMPANY CALL"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, -1, -1, -1, 1); me["Simple_L0S"].hide(); @@ -1251,11 +1463,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText(sprintf("%s", " " ~ acType.getValue())); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, -1, 1, 1); me["Simple_L0S"].hide(); @@ -1355,21 +1563,8 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - + me.standardFontSize(); + me.standardFontColour(); # why is this needed? me["Simple_L5"].show(); @@ -1408,21 +1603,8 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRight("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - + me.standardFontSize(); + me.standardFontColour(); pageSwitch[i].setBoolValue(1); } @@ -1453,13 +1635,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -1498,26 +1674,13 @@ var canvas_MCDU_base = { } } else if (page == "POSMON") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("POSITION MONITOR"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); @@ -1531,13 +1694,7 @@ var canvas_MCDU_base = { me.showRightS(-1, -1, -1, -1, 1, 1); me.showRightArrow(-1, -1, -1, -1, -1, 1); - 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.standardFontSize(); me.colorLeft("wht", "wht", "wht", "wht", "grn", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -1569,11 +1726,7 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); me["Simple_Title"].setText("RADIO NAV"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, 1, -1); me["Simple_L0S"].hide(); @@ -1874,11 +2027,7 @@ var canvas_MCDU_base = { me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("IRS INIT"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, -1, -1, -1, 1); me["Simple_L0S"].hide(); @@ -2036,26 +2185,13 @@ var canvas_MCDU_base = { } else if (page == "ROUTESELECTION") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("ROUTE SELECTION"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, -1, -1, -1, -1, 1); me["Simple_L0S"].hide(); @@ -2335,7 +2471,7 @@ var canvas_MCDU_base = { me["Simple_C3"].setText(sprintf("/%.1f ", rte_percent.getValue())); } } - if (fmgc.FMGCInternal.crzSet == 1) { + if (fmgc.FMGCInternal.altAirportSet) { me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); me["Simple_L4"].setColor(BLUE); me["Simple_C4"].show(); @@ -2614,7 +2750,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].setText(sprintf("/%.1f ", rte_percent.getValue())); } } - if (fmgc.FMGCInternal.crzSet == 1) { + if (fmgc.FMGCInternal.altAirportSet) { me["Simple_L4"].setText(sprintf("%.1f", alt_fuel.getValue())); me["Simple_L4"].setColor(BLUE); me["Simple_C4"].show(); @@ -3058,26 +3194,13 @@ var canvas_MCDU_base = { me["Simple_C3S"].setText("CLEAN "); } else if (page == "PERFCLB") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("CLB"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); @@ -3225,26 +3348,13 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("PHASE "); } else if (page == "PERFCRZ") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("CRZ"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, -1, 1); me["Simple_L0S"].hide(); @@ -3375,26 +3485,13 @@ var canvas_MCDU_base = { } else if (page == "PERFDES") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("DES"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].hide(); @@ -3546,26 +3643,13 @@ var canvas_MCDU_base = { me["Simple_R6"].setText("PHASE "); } else if (page == "PERFAPPR") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].show(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("APPR"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(1, 1, 1, 1, 1, 1); me["Simple_L0S"].show(); @@ -3742,26 +3826,13 @@ var canvas_MCDU_base = { me["Simple_C5S"].setText("VLS "); } else if (page == "PERFGA") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].show(); me["Simple_Title"].show(); me["Simple_Title"].setText("GO AROUND"); - me["Simple_Title"].setColor(1, 1, 1); - me["Simple_PageNum"].setText("X/X"); - me["Simple_PageNum"].hide(); - me["ArrowLeft"].hide(); - me["ArrowRight"].hide(); + me.defaultPageNumbers(); me.showLeft(-1, -1, -1, -1, 1, 1); me["Simple_L0S"].hide(); @@ -3835,16 +3906,7 @@ var canvas_MCDU_base = { me["Simple_C3S"].setText("CLEAN "); } else if (page == "WINDCLB" or page == "WINDCRZ" or page == "WINDDES" or page == "WINDHIST") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); # if (page == "WINDCRZ") { # up/down arrows show # } else { @@ -3936,16 +3998,7 @@ var canvas_MCDU_base = { } } else if (page == "LATREV") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); @@ -3957,13 +4010,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); @@ -4022,16 +4069,7 @@ var canvas_MCDU_base = { } } else if (page == "VERTREV") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); @@ -4043,13 +4081,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); @@ -4106,46 +4138,20 @@ var canvas_MCDU_base = { } } else if (page == "DEPARTURE") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); me["ArrowLeft"].show(); 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(); - me["Simple_L6_Arrow"].show(); - me["Simple_R1_Arrow"].hide(); - me["Simple_R2_Arrow"].hide(); - me["Simple_R3_Arrow"].hide(); - me["Simple_R4_Arrow"].hide(); - me["Simple_R5_Arrow"].hide(); - me["Simple_R6_Arrow"].hide(); + me.hideAllArrowsButL6(); me["Simple_L0S"].hide(); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -4190,16 +4196,7 @@ var canvas_MCDU_base = { } } else if (page == "DUPLICATENAMES") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["arrowsDepArr"].hide(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); @@ -4211,13 +4208,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); @@ -4266,47 +4257,21 @@ var canvas_MCDU_base = { } } else if (page == "ARRIVAL") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); me["ArrowLeft"].show(); 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(); - me["Simple_L6_Arrow"].show(); - me["Simple_R1_Arrow"].hide(); - me["Simple_R2_Arrow"].hide(); - me["Simple_R3_Arrow"].hide(); - me["Simple_R4_Arrow"].hide(); - me["Simple_R5_Arrow"].hide(); - me["Simple_R6_Arrow"].hide(); + me.hideAllArrowsButL6(); me["arrow2L"].hide(); me["arrow2R"].hide(); me["Simple_L0S"].hide(); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -4357,34 +4322,14 @@ var canvas_MCDU_base = { } } else if (page == "HOLD") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); 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(); - me["Simple_L6_Arrow"].show(); - me["Simple_R1_Arrow"].hide(); - me["Simple_R2_Arrow"].hide(); - me["Simple_R3_Arrow"].hide(); - me["Simple_R4_Arrow"].hide(); - me["Simple_R5_Arrow"].hide(); - me["Simple_R6_Arrow"].hide(); + me.hideAllArrowsButL6(); me["Simple_L0S"].hide(); me["Simple_C3B"].hide(); @@ -4443,34 +4388,14 @@ var canvas_MCDU_base = { } } else if (page == "AIRWAYS") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); me["ArrowLeft"].hide(); me["ArrowRight"].hide(); 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(); - me["Simple_L6_Arrow"].show(); - me["Simple_R1_Arrow"].hide(); - me["Simple_R2_Arrow"].hide(); - me["Simple_R3_Arrow"].hide(); - me["Simple_R4_Arrow"].hide(); - me["Simple_R5_Arrow"].hide(); - me["Simple_R6_Arrow"].hide(); + me.hideAllArrowsButL6(); me["Simple_L0S"].hide(); me["Simple_C3B"].hide(); @@ -4529,16 +4454,7 @@ var canvas_MCDU_base = { } } else if (page == "CLOSESTAIRPORT") { if (!pageSwitch[i].getBoolValue()) { - me["Simple"].show(); - me["Simple_Center"].show(); - me["FPLN"].hide(); - me["DIRTO_TMPY_group"].hide(); - me["INITA"].hide(); - me["IRSINIT"].hide(); - me["INITB"].hide(); - me["FUELPRED"].hide(); - me["PROG"].hide(); - me["PERFTO"].hide(); + me.defaultHideWithCenter(); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); @@ -4640,13 +4556,7 @@ var canvas_MCDU_base = { me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - 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.standardFontSize(); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 29bea37f..62495789 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -2986,4 +2986,34 @@ d="m 974.36752,294.79468 20.17349,-20.1735" style="fill:none;stroke:#ffffff;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + diff --git a/Nasal/ECAM/ECAM-logic.nas b/Nasal/ECAM/ECAM-logic.nas index 055c6453..07bdeb9b 100644 --- a/Nasal/ECAM/ECAM-logic.nas +++ b/Nasal/ECAM/ECAM-logic.nas @@ -2426,6 +2426,7 @@ var messages_right_memo = func { } else { vhf3_voice.active = 0; } + if (getprop("controls/autobrake/mode") == 1 and (phaseVarMemo3 == 7 or phaseVarMemo3 == 8)) { auto_brk_lo.active = 1; } else { diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index b99568d6..07b6c434 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -887,6 +887,8 @@ var reset_FMGC = func { setprop("systems/ventilation/lavatory/extractvalve", "0"); setprop("systems/pressurization/ambientpsi", "0"); setprop("systems/pressurization/cabinpsi", "0"); + + mcdu.ReceivedMessagesDatabase.clearDatabase(); } ################# diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index b66c25a3..aa769301 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -171,6 +171,7 @@ var MessageController = { TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"), TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), + TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"), ]), 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"), diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 3e8c1386..b2c477a1 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -197,6 +197,7 @@ var windController = { me.winds[n] = me.copyWinds(2); me.nav_indicies[n] = me.nav_indicies[2]; me.windSizes[n] = me.windSizes[2]; + #me.waypointsChanged(); #me.temporaryFlag[n] = 1; }, @@ -213,7 +214,7 @@ var windController = { } if (n == 3) { return; } me.resetWind(n); - #me.updatePlans(); + me.waypointsChanged(); #me.temporaryFlag[n] = 0; }, @@ -253,6 +254,7 @@ var windController = { #print("insert plan: ", plan, ", index: ", index); #debug.dump(me.winds); #debug.dump(me.windSizes); + me.waypointsChanged(); }, deleteWind: func(plan, index) { @@ -274,6 +276,58 @@ var windController = { #print("delete plan: ", plan, ", index: ", index); #debug.dump(me.winds); #debug.dump(me.windSizes); + me.waypointsChanged(); + }, + + waypointsChanged: func() { + if (canvas_mcdu.myCRZWIND[1] != nil) { + if (!fmgc.flightPlanController.temporaryFlag[1]) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { + canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[1].singleCRZ = 0; + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[1].waypoint = nil; + canvas_mcdu.myCRZWIND[1].singleCRZ = 1; + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } + } else { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[1]) > 0) { + canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[1].getWP(me.nav_indicies[1][0]); + canvas_mcdu.myCRZWIND[1].singleCRZ = 0; + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[1].waypoint = nil; + canvas_mcdu.myCRZWIND[1].singleCRZ = 1; + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } + } + canvas_mcdu.myCRZWIND[1].reload(); + } + if (canvas_mcdu.myCRZWIND[0] != nil) { + if (!fmgc.flightPlanController.temporaryFlag[0]) { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { + canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[0].singleCRZ = 0; + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[0].waypoint = nil; + canvas_mcdu.myCRZWIND[0].singleCRZ = 1; + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } + } else { + if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[0]) > 0) { + canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[0].getWP(me.nav_indicies[0][0]); + canvas_mcdu.myCRZWIND[0].singleCRZ = 0; + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[0].waypoint = nil; + canvas_mcdu.myCRZWIND[0].singleCRZ = 1; + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } + } + canvas_mcdu.myCRZWIND[0].reload(); + } }, updatePlans: func() { @@ -327,51 +381,9 @@ var windController = { canvas_mcdu.myCLBWIND[0].reload(); } if (canvas_mcdu.myCRZWIND[1] != nil) { - if (!fmgc.flightPlanController.temporaryFlag[1]) { - if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { - canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); - canvas_mcdu.myCRZWIND[1].singleCRZ = 0; - canvas_mcdu.myCRZWIND[1].cur_location = 0; - } else { - canvas_mcdu.myCRZWIND[1].waypoint = nil; - canvas_mcdu.myCRZWIND[1].singleCRZ = 1; - canvas_mcdu.myCRZWIND[1].cur_location = 0; - } - } else { - if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[1]) > 0) { - canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[1].getWP(me.nav_indicies[1][0]); - canvas_mcdu.myCRZWIND[1].singleCRZ = 0; - canvas_mcdu.myCRZWIND[1].cur_location = 0; - } else { - canvas_mcdu.myCRZWIND[1].waypoint = nil; - canvas_mcdu.myCRZWIND[1].singleCRZ = 1; - canvas_mcdu.myCRZWIND[1].cur_location = 0; - } - } canvas_mcdu.myCRZWIND[1].reload(); } if (canvas_mcdu.myCRZWIND[0] != nil) { - if (!fmgc.flightPlanController.temporaryFlag[0]) { - if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[2]) > 0) { - canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); - canvas_mcdu.myCRZWIND[0].singleCRZ = 0; - canvas_mcdu.myCRZWIND[0].cur_location = 0; - } else { - canvas_mcdu.myCRZWIND[0].waypoint = nil; - canvas_mcdu.myCRZWIND[0].singleCRZ = 1; - canvas_mcdu.myCRZWIND[0].cur_location = 0; - } - } else { - if (fmgc.FMGCInternal.toFromSet and size(fmgc.windController.nav_indicies[0]) > 0) { - canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[0].getWP(me.nav_indicies[0][0]); - canvas_mcdu.myCRZWIND[0].singleCRZ = 0; - canvas_mcdu.myCRZWIND[0].cur_location = 0; - } else { - canvas_mcdu.myCRZWIND[0].waypoint = nil; - canvas_mcdu.myCRZWIND[0].singleCRZ = 1; - canvas_mcdu.myCRZWIND[0].cur_location = 0; - } - } canvas_mcdu.myCRZWIND[0].reload(); } if (canvas_mcdu.myDESWIND[1] != nil) { diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 8836300a..67e4dbf9 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -240,6 +240,7 @@ var systemsLoop = maketimer(0.1, func { dmc.DMController.loop(); systems.APUController.loop(); systems.HFLoop(); + atsu.ATSU.loop(); groundspeed = pts.Velocities.groundspeed.getValue(); if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index d096e6ca..6fffab6b 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -273,6 +273,13 @@ var lskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") { + setprop("/MCDU[" ~ i ~ "]/page", "WEATHERTYPE"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") { + atsu.AOC.selectedType = "HOURLY WX"; + setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].leftKey(1); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -341,6 +348,8 @@ var lskbutton = func(btn, i) { } } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { setprop("/MCDU[" ~ i ~ "]/page", "DATAMODE"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].leftKey(2); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -392,6 +401,8 @@ var lskbutton = func(btn, i) { canvas_mcdu.myDuplicate[i].pushButtonLeft(3); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { setprop("/MCDU[" ~ i ~ "]/page", "VOICEDIRECTORY"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].leftKey(3); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -438,6 +449,8 @@ var lskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].leftKey(4); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -493,6 +506,8 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { setprop("/MCDU[" ~ i ~ "]/page", "NOTIFICATION"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].leftKey(5); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -550,10 +565,15 @@ var lskbutton = func(btn, i) { canvas_mcdu.myDirTo[i].fieldL6(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") { canvas_mcdu.myClosestAirport[i].freeze(); - } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION" or getprop("/MCDU[" ~ i ~ "]/page") == "CONNECTSTATUS") { setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ" or getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") { + setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS"); + canvas_mcdu.myReceivedMessages[i].update(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMINIT" or getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY" or getprop("/MCDU[" ~ i ~ "]/page") == "DATAMODE" or getprop("/MCDU[" ~ i ~ "]/page") == "COMMSTATUS" or getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") { @@ -620,6 +640,20 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATSUDLINK") { + setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") { + var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i); + if (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } else { + mcdu_scratchpad.scratchpads[i].empty(); + } + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") { + atsu.AOC.selectedType = "TERM FCST"; + setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -647,6 +681,8 @@ var rskbutton = func(btn, i) { } } else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") { setprop("/MCDU[" ~ i ~ "]/page", "COMPANYCALL"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") { + setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -677,6 +713,13 @@ var rskbutton = func(btn, i) { } } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(3); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") { + if (canvas_mcdu.myReceivedMessages[i] != nil) { + canvas_mcdu.myReceivedMessages[i].del(); + } + canvas_mcdu.myReceivedMessages[i] = nil; + canvas_mcdu.myReceivedMessages[i] = receivedMessagesPage.new(i); + setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -814,6 +857,17 @@ var rskbutton = func(btn, i) { } } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { setprop("/MCDU[" ~ i ~ "]/page", "CONNECTSTATUS"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") { + var result = atsu.AOC.sendReq(i); + if (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 3) { + mcdu.mcdu_message(i, "VHF3 VOICE MSG NOT GEN"); + } elsif (result == 4) { + mcdu.mcdu_message(i, "NO COMM MSG NOT GEN"); + } else { + mcdu_scratchpad.scratchpads[i].empty(); + } } else if (getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY") { for (var i = 0; i < 3; i = i + 1) { if (getprop("/systems/radio/rmp[" ~ i ~ "]/sel_chan") == "vhf3") { @@ -902,6 +956,10 @@ var arrowbutton = func(btn, i) { canvas_mcdu.myArrival[i].scrollLeft(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") { canvas_mcdu.myPilotWP[i].scrollLeft(); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].scrollLeft(); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") { + canvas_mcdu.myReceivedMessage[i].scrollLeft(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { @@ -930,6 +988,10 @@ var arrowbutton = func(btn, i) { canvas_mcdu.myArrival[i].scrollRight(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") { canvas_mcdu.myPilotWP[i].scrollRight(); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") { + canvas_mcdu.myReceivedMessages[i].scrollRight(); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSG") { + canvas_mcdu.myReceivedMessage[i].scrollRight(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") { setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") { @@ -1006,7 +1068,7 @@ var pagebutton = func(btn, i) { setprop("/MCDU[" ~ i ~ "]/page", "DATA"); } else if (btn == "mcdu") { var page = getprop("/MCDU[" ~ i ~ "]/page"); - if (page != "ATSUDLINK" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") { + if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") { setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page")); } else { setprop("/MCDU[" ~ i ~ "]/last-atsu-page", getprop("/MCDU[" ~ i ~ "]/page")); diff --git a/Nasal/MCDU/RECEIVEDMESSAGES.nas b/Nasal/MCDU/RECEIVEDMESSAGES.nas new file mode 100644 index 00000000..1430ca53 --- /dev/null +++ b/Nasal/MCDU/RECEIVEDMESSAGES.nas @@ -0,0 +1,300 @@ +var receivedMessagesPage = { + title: 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"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + computer: nil, + size: 0, + getPageNumStr: func() { + return me.curPage ~ "/" ~ ReceivedMessagesDatabase.getCountPages(); + }, + new: func(computer) { + var ap = {parents:[receivedMessagesPage]}; + ap.computer = computer; + ap.curPage = 1; + ap._setupPageWithData(); + ap.update(); + return ap; + }, + del: func() { + return nil; + }, + scrollLeft: func() { + me.curPage -= 1; + if (me.curPage < 1) { + me.curPage = ReceivedMessagesDatabase.getCountPages(); + } + me.update(); + }, + scrollRight: func() { + me.curPage += 1; + if (me.curPage > ReceivedMessagesDatabase.getCountPages()) { + me.curPage = 1; + } + me.update(); + }, + _clearPage: func() { + me.L1 = [nil, nil, "ack"]; + me.L2 = [nil, nil, "ack"]; + me.L3 = [nil, nil, "ack"]; + me.L4 = [nil, nil, "ack"]; + me.L5 = [nil, nil, "ack"]; + me.R1 = [nil, nil, "ack"]; + me.R2 = [nil, nil, "ack"]; + me.R3 = [nil, nil, "ack"]; + me.R4 = [nil, nil, "ack"]; + me.R5 = [nil, nil, "ack"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; + }, + _setupPageWithData: func() { + me.title = "RECEIVED MESSAGES "; + me.L6 = [" RETURN", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; + me.arrowsColour = [["blu", "blu", "blu", "blu", "blu", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; + me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + update: func() { + me._clearPage(); + me.size = ReceivedMessagesDatabase.getSize(); + var message = nil; + + if (me.size >= (me.curPage * 5) + -4) { + message = ReceivedMessagesDatabase.database.vector[-5 + (me.curPage * 5)]; + me.L1[0] = " " ~ left(message.body, 23); + me.L1[2] = "blu"; + if (!message.viewed) { + me.L1[1] = " " ~ message.time ~ " NEW"; + } else { + me.L1[1] = " " ~ message.time ~ " VIEWED"; + } + me.arrowsMatrix[0][0] = 1; + } + + if (me.size >= (me.curPage * 5) + -3) { + message = ReceivedMessagesDatabase.database.vector[-4 + (me.curPage * 5)]; + me.L2[0] = " " ~ left(message.body, 23); + me.L2[2] = "blu"; + if (!message.viewed) { + me.L2[1] = " " ~ message.time ~ " NEW"; + } else { + me.L2[1] = " " ~ message.time ~ " VIEWED"; + } + me.arrowsMatrix[0][1] = 1; + } + + if (me.size >= (me.curPage * 5) + -2) { + message = ReceivedMessagesDatabase.database.vector[-3 + (me.curPage * 5)]; + me.L3[0] = " " ~ left(message.body, 23); + me.L3[2] = "blu"; + if (!message.viewed) { + me.L3[1] = " " ~ message.time ~ " NEW"; + } else { + me.L3[1] = " " ~ message.time ~ " VIEWED"; + } + me.arrowsMatrix[0][2] = 1; + } + + if (me.size >= (me.curPage * 5) + -1) { + message = ReceivedMessagesDatabase.database.vector[-2 + (me.curPage * 5)]; + me.L4[0] = " " ~ left(message.body, 23); + me.L4[2] = "blu"; + if (!message.viewed) { + me.L4[1] = " " ~ message.time ~ " NEW"; + } else { + me.L4[1] = " " ~ message.time ~ " VIEWED"; + } + me.arrowsMatrix[0][3] = 1; + } + + if (me.size >= (me.curPage * 5) + 0) { + message = ReceivedMessagesDatabase.database.vector[-1 + (me.curPage * 5)]; + me.L5[0] = " " ~ left(message.body, 23); + me.L5[2] = "blu"; + if (!message.viewed) { + me.L5[1] = " " ~ message.time ~ " NEW"; + } else { + me.L5[1] = " " ~ message.time ~ " VIEWED"; + } + me.arrowsMatrix[0][4] = 1; + } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + leftKey: func(index) { + if (ReceivedMessagesDatabase.getSize() >= (-5 + index + (me.curPage * 5))) { + canvas_mcdu.myReceivedMessage[me.computer] = receivedMessagePage.new(me.computer, (-6 + index + (me.curPage * 5))); + setprop("MCDU[" ~ me.computer ~ "]/page", "RECEIVEDMSG"); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + }, +}; + +var receivedMessagePage = { + title: 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"], + computer: nil, + size: 0, + new: func(computer, index) { + var ap = {parents:[receivedMessagePage]}; + ap.computer = computer; + ap.curPage = index + 1; + ReceivedMessagesDatabase.database.vector[ap.curPage - 1].viewed = 1; + ap._setupPageWithData(); + ap.update(); + return ap; + }, + del: func() { + return nil; + }, + scrollLeft: func() { + me.curPage -= 1; + if (me.curPage < 1) { + me.curPage = ReceivedMessagesDatabase.getSize(); + } + ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1; + me.update(); + }, + scrollRight: func() { + me.curPage += 1; + if (me.curPage > ReceivedMessagesDatabase.getSize()) { + me.curPage = 1; + } + ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1; + me.update(); + }, + _clearPage: func() { + me.L1 = [nil, nil, "ack"]; + me.L2 = [nil, nil, "ack"]; + me.L3 = [nil, nil, "ack"]; + me.L4 = [nil, nil, "ack"]; + me.L5 = [nil, nil, "ack"]; + me.C1 = [nil, nil, "ack"]; + me.C2 = [nil, nil, "ack"]; + me.C3 = [nil, nil, "ack"]; + me.C4 = [nil, nil, "ack"]; + me.C5 = [nil, nil, "ack"]; + me.R1 = [nil, nil, "ack"]; + me.R2 = [nil, nil, "ack"]; + me.R3 = [nil, nil, "ack"]; + me.R4 = [nil, nil, "ack"]; + me.R5 = [nil, nil, "ack"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; + }, + _setupPageWithData: func() { + me.title = "ACARS MESSAGE"; + me.L6 = [" RETURN", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; + me.arrowsColour = [["blu", "blu", "blu", "blu", "blu", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; + me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + update: func() { + me._clearPage(); + me.size = ReceivedMessagesDatabase.getSize(); + var message = nil; + if (me.size >= me.curPage) { + message = ReceivedMessagesDatabase.database.vector[me.curPage - 1]; + me.L1[1] = message.time; + me.C1[1] = "VIEWED"; + me.C1[2] = "grn"; + me.R1[1] = me.curPage ~ "/" ~ ReceivedMessagesDatabase.getSize(); + + me.L1[0] = left(message.body, size(message.body) > 30 ? 30 : size(message.body)); + me.L1[2] = "wht"; + me.L2[2] = "wht"; + me.L3[2] = "wht"; + me.L4[2] = "wht"; + me.L5[2] = "wht"; + if (size(message.body) > 30) { + me.L2[1] = left(split(me.L1[0], message.body)[1], size(message.body) > 60 ? 30 : size(message.body) - 30); + } + if (size(message.body) > 60) { + me.L2[0] = left(split(me.L2[1], message.body)[1], size(message.body) > 90 ? 30 : size(message.body) - 60); + } + if (size(message.body) > 90) { + me.L3[1] = left(split(me.L2[0], message.body)[1], size(message.body) > 120 ? 30 : size(message.body) - 90); + } + if (size(message.body) > 120) { + me.L3[0] = left(split(me.L3[1], message.body)[1], size(message.body) > 150 ? 30 : size(message.body) - 120); + } + if (size(message.body) > 150) { + me.L4[1] = left(split(me.L3[0], message.body)[1], size(message.body) > 180 ? 30 : size(message.body) - 150); + } + if (size(message.body) > 180) { + me.L4[0] = left(split(me.L4[1], message.body)[1], size(message.body) > 210 ? 30 : size(message.body) - 180); + } + if (size(message.body) > 210) { + me.L5[1] = left(split(me.L4[0], message.body)[1], size(message.body) > 240 ? 30 : size(message.body) - 210); + } + if (size(message.body) > 240) { + me.L5[0] = left(split(me.L5[1], message.body)[1], size(message.body) > 270 ? 30 : size(message.body) - 240); + } + } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, +}; + +var ACARSMessage = { + new: func(time, body) { + var message = {parents:[ACARSMessage]}; + message.time = time; + message.body = body; + message.viewed = 0; + return message; + }, +}; + +var ReceivedMessagesDatabase = { + database: std.Vector.new(), + addMessage: func(message) { + me.database.insert(0, message); + if (canvas_mcdu.myReceivedMessages[0] != nil) { + canvas_mcdu.myReceivedMessages[0].update(); + } + if (canvas_mcdu.myReceivedMessages[1] != nil) { + canvas_mcdu.myReceivedMessages[1].update(); + } + }, + getCountPages: func() { + return math.ceil(me.database.size() / 5); + }, + getSize: func() { + return me.database.size(); + }, + clearDatabase: func() { + me.database.clear(); + }, +}; \ No newline at end of file diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 48c7e483..ea422864 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -50,11 +50,12 @@ var windCRZPage = { return nil; }, _setupPageWithData: func() { - - if (me.singleCRZ == 1) { + if (me.waypoint == nil) { me.title = ["","CRZ WIND",""]; + me.singleCRZ = 1; } else { me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; + me.singleCRZ = 0; } me.titleColour = "wht"; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]]; @@ -488,8 +489,7 @@ var windCRZPage = { } mcdu_scratchpad.scratchpads[me.computer].empty(); me.items -= 1; - me._setupPageWithData(); - me.updateTmpy(); + me.reload(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index 5da8fe35..15b195a4 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -2,6 +2,17 @@ # Jonathan Redpath # Copyright (c) 2020 Josh Davidson (Octal450) +var ATSU = { + working: 0, + loop: func() { + if (systems.ELEC.Bus.ac1.getValue() >= 110 or systems.ELEC.Bus.dc1.getValue() >= 25) { + me.working = 1; + } else { + me.working = 0; + } + } +}; + var notificationSystem = { notifyAirport: nil, hasNotified: 0, @@ -78,4 +89,116 @@ var CompanyCall = { } } }, +}; + +var AOC = { + station: nil, + selectedType: "HOURLY WX", # 0 = METAR 1 = TAF + lastMETAR: nil, + lastTAF: nil, + sent: 0, + sentTime: nil, + received: 0, + receivedTime: nil, + newStation: func(airport) { + if (size(airport) == 3 or size(airport) == 4) { + if (size(findAirportsByICAO(airport)) == 0) { + return 2; + } else { + me.station = airport; + return 0; + } + } else { + return 1; + } + }, + sendReq: func(i) { + if (me.station == nil or (me.sent and !me.received)) { + return 1; + } + me.sent = 1; + me.received = 0; + var sentTime = left(getprop("/sim/time/gmt-string"), 5); + me.sentTime = split(":", sentTime)[0] ~ "." ~ split(":", sentTime)[1] ~ "Z"; + + if (me.selectedType == "HOURLY WX") { + var result = me.fetchMETAR(atsu.AOC.station, i); + if (result == 0) { + return 0; + } elsif (result == 1) { + return 3; + } elsif (result == 2) { + return 4; + } + } + + if (me.selectedType == "TERM FCST") { + var result = me.fetchTAF(atsu.AOC.station, i); + if (result == 0) { + return 0; + } elsif (result == 1) { + return 3; + } elsif (result == 2) { + return 4; + } + } + }, + fetchMETAR: func(airport, i) { + if (!ATSU.working) { + me.sent = 0; + return 2; + } + if (ecam.vhf3_voice.active) { + me.sent = 0; + return 1; + } + http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport) + .fail(func print("Download failed!")) + .done(func(r) me.processMETAR(r, i)); + return 0; + }, + fetchTAF: func(airport, i) { + if (!ATSU.working) { + me.sent = 0; + return 2; + } + if (ecam.vhf3_voice.active) { + me.sent = 0; + return 1; + } + http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&timeType=issue&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport) + .fail(func print("Download failed!")) + .done(func(r) me.processTAF(r, i)); + return 0; + }, + processMETAR: func(r, i) { + var raw = r.response; + raw = split("", raw)[1]; + raw = split("", raw)[0]; + me.lastMETAR = raw; + settimer(func() { + me.received = 1; + mcdu.mcdu_message(i, "WX UPLINK"); + + var receivedTime = left(getprop("/sim/time/gmt-string"), 5); + me.receivedTime = split(":", receivedTime)[0] ~ "." ~ split(":", receivedTime)[1] ~ "Z"; + var message = mcdu.ACARSMessage.new(me.receivedTime, me.lastMETAR); + mcdu.ReceivedMessagesDatabase.addMessage(message); + }, math.max(rand()*6, 2.25)); + }, + processTAF: func(r, i) { + var raw = r.response; + raw = split("", raw)[1]; + raw = split("", raw)[0]; + me.lastTAF = raw; + settimer(func() { + me.received = 1; + mcdu.mcdu_message(i, "WX UPLINK"); + + var receivedTime = left(getprop("/sim/time/gmt-string"), 5); + me.receivedTime = split(":", receivedTime)[0] ~ "." ~ split(":", receivedTime)[1] ~ "Z"; + var message = mcdu.ACARSMessage.new(me.receivedTime, me.lastTAF); + mcdu.ReceivedMessagesDatabase.addMessage(message); + }, math.max(rand()*6, 2.25)); + }, }; \ No newline at end of file