diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index fc5619c4..32ec576c 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -232,7 +232,8 @@ var canvas_MCDU_base = { "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","WEATHERREQSEND", - "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE","ATISSend1","ATISSend2","ATISSend3","ATISSend4"]; + "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE","ATISSend1","ATISSend2","ATISSend3","ATISSend4", + "ATISArrows"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -369,6 +370,9 @@ var canvas_MCDU_base = { me["ATISSend3"].hide(); me["ATISSend4"].hide(); } + if (page != "ATISDETAIL") { + me["ATISArrows"].hide(); + } if (page == "F-PLNA" or page == "F-PLNB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -980,6 +984,17 @@ var canvas_MCDU_base = { me.colorRight(myAtis[i].R1[2],myAtis[i].R2[2],myAtis[i].R3[2],myAtis[i].R4[2],myAtis[i].R5[2],myAtis[i].R6[2]); } + + if (myAtis[i].getNumPages() > 1) { + me["Simple_PageNum"].show(); + me["ATISArrows"].show(); + print(myAtis[i].page); + me["Simple_PageNum"].setText(myAtis[i].page ~ "/" ~ myAtis[i].getNumPages()); + } else { + me["Simple_PageNum"].hide(); + me["ATISArrows"].hide(); + } + pageSwitch[i].setBoolValue(1); } } else if (page == "ATIS") { diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 89be56b3..9eb38288 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -41,13 +41,13 @@ inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="17.863704" - inkscape:cx="1222.2874" - inkscape:cy="575.96236" + inkscape:zoom="3.1578866" + inkscape:cx="1122.1906" + inkscape:cy="986.92422" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="PERFAPPR" + inkscape:current-layer="svg2" showguides="false" inkscape:snap-global="false" units="px" @@ -3189,64 +3189,117 @@ d="m 974.36752,294.79468 20.17349,-20.1735" style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + + + + + + + + + id="g1338" + inkscape:label="#g4241" + transform="matrix(0,1,1,0,667.65035,-414.17373)" + style="stroke:#ffffff;stroke-opacity:1"> + - - + id="path1336" + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:none;stroke:#ffffff;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="stroke:#ffffff;stroke-opacity:1" + transform="matrix(0,-1,-1,0,801.59015,1459.2436)" + inkscape:label="#g4241" + id="g1346"> - + id="path1342" + d="M 936.70791,32.6968 921.8587,47.4328" + 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/MCDU/ATIS.nas b/Nasal/MCDU/ATIS.nas index a0516b2d..b424f90f 100644 --- a/Nasal/MCDU/ATIS.nas +++ b/Nasal/MCDU/ATIS.nas @@ -26,33 +26,38 @@ var atisPage = { new: func(computer, index) { var ap = {parents:[atisPage]}; ap.computer = computer; - ap.lineOffset = 0; + ap.page = 1; ap.index = index; ap.message = atsu.ATISInstances[index].lastATIS; ap._setupPageWithData(); + ap._numPages = 1; ap.update(); return ap; }, del: func() { return nil; }, - getNumLines: func() { - me._numLines = size(me.message) / 30; - me.lineOffset = math.ceil(me._numLines); + getNumPages: func() { + me._numPages = math.ceil(size(me.message) / 210); + return me._numPages; }, scrollUp: func() { - me.lineOffset -= 1; - if (me.lineOffset < 0) { - me.lineOffset = me.getNumLines(); + print(me.page); + me.page -= 1; + if (me.page < 1) { + me.page = me.getNumPages(); } me.update(); + print(me.page); }, scrollDown: func() { - me.lineOffset += 1; - if (me.lineOffset > me.getNumLines()) { - me.lineOffset = 1; + print(me.page); + me.page += 1; + if (me.page > me.getNumPages()) { + me.page = 1; } me.update(); + print(me.page); }, _clearPage: func() { me.L2 = [nil, nil, "wht"]; @@ -70,8 +75,7 @@ var atisPage = { me.arrowsMatrix = [[0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 0]]; }, _setupPageWithData: func() { - me.title = atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP") ~ " ATIS"; - me.title = atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP") ~ " ATIS"; + me.title = atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP") ~ " ATIS "; me.L5 = [" PREV ATIS", nil, "wht"]; me.L6 = [" RETURN", " ATIS MENU", "wht"]; me.R6 = ["PRINT ", nil, "blu"]; @@ -83,30 +87,29 @@ var atisPage = { update: func() { me._clearPage(); var message = atsu.ATISInstances[me.index].lastATIS; - var start = left(message, size(message) > (30 + (me.lineOffset * 30)) ? (30 + (me.lineOffset * 30)) : size(message)); - start = right(start, 30); - - me.L1 = [start, atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP"), "wht"]; - # dictionary for code + var pageMinusOne = (me.page - 1); + var numberExtraChar = pageMinusOne * 210; + me.L1 = [substr(message, numberExtraChar, 30), atsu.ATISInstances[me.index].station ~ "/" ~ (atsu.ATISInstances[me.index].type == 0 ? "ARR" : "DEP"), "wht"]; me.R1 = [" ",atsu.ATISInstances[me.index].receivedCode ~ " " ~ atsu.ATISInstances[me.index].receivedTime ~ "Z", "wht"]; if (size(message) > 30) { - me.L2[1] = left(split(me.L1[0], message)[1], size(message) > (60 + (me.lineOffset * 30)) ? 30 : size(message) - (30 + (me.lineOffset * 30))); + me.L2[1] = substr(message, numberExtraChar + 30, 30); } if (size(message) > 60) { - me.L2[0] = left(split(me.L2[1], message)[1], size(message) > (90 + (me.lineOffset * 30)) ? 30 : size(message) - (60 + (me.lineOffset * 30))); + me.L2[0] = substr(message, numberExtraChar + 60, 30); } if (size(message) > 90) { - me.L3[1] = left(split(me.L2[0], message)[1], size(message) > (120 + (me.lineOffset * 30)) ? 30 : size(message) - (90 + (me.lineOffset * 30))); + me.L3[1] = substr(message, numberExtraChar + 90, 30); } if (size(message) > 120) { - me.L3[0] = left(split(me.L3[1], message)[1], size(message) > (150 + (me.lineOffset * 30)) ? 30 : size(message) - (120 + (me.lineOffset * 30))); + me.L3[0] = substr(message, numberExtraChar + 120, 30); } if (size(message) > 150) { - me.L4[1] = left(split(me.L3[0], message)[1], size(message) > (180 + (me.lineOffset * 30)) ? 30 : size(message) - (150 + (me.lineOffset * 30))); + me.L4[1] = substr(message, numberExtraChar + 150, 30); } if (size(message) > 180) { - me.L4[0] = left(split(me.L4[1], message)[1], size(message) > (210 + (me.lineOffset * 30)) ? 30 : size(message) - (180 + (me.lineOffset * 30))); + me.L4[0] = substr(message, numberExtraChar + 180, 30); } + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, }; \ No newline at end of file diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index c652fdc9..f3fd315f 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -856,6 +856,8 @@ var lskbutton = func(btn, i) { pageNode[i].setValue("COMMMENU"); } else if (page == "ATIS") { pageNode[i].setValue("ATCMENU2"); + } else if (page == "ATISDETAIL") { + pageNode[i].setValue("ATIS"); } else { mcdu_message(i, "NOT ALLOWED"); } diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index cb26cc5e..4e9bf48e 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -324,6 +324,7 @@ var ATIS = { raw = split('"}', raw)[0]; } } + var code = ""; if (find("INFO ", raw) != -1) { code = split("INFO ", raw)[1]; @@ -367,12 +368,13 @@ var ATIS = { } else if (find("Z SPECIAL", raw) != -1) { time = split("Z SPECIAL", raw)[0]; time = right(time, 4); - } else if (find("Z SPECIAL", raw) != -1) { - time = split("Z SPECIAL", raw)[0]; - time = right(time, 4); } else if (find("metreport", raw) != -1) { time = split("metreport", raw)[0]; time = right(time, 4); + } else if (find((code ~ " "), raw) != -1) { + if (size(split(" ",split(code ~ " ", raw)[1])[0]) == 4) { + time = split(" ",split(code ~ " ", raw)[1])[0]; + } } else { print("Failed to find a valid ATIS time for " ~ me.station); debug.dump(raw); @@ -381,6 +383,8 @@ var ATIS = { if (size(time) == 3) { time ~= " "; } + debug.dump(code); + debug.dump(time); settimer(func() { me.sent = 0; me.received = 1;