1
0
Fork 0

Add ability to display ATIS in MCDU

This commit is contained in:
legoboyvdlp R 2020-10-23 20:38:12 +01:00
parent d83e2554d2
commit 5c60cafb68
4 changed files with 153 additions and 80 deletions

View file

@ -4320,21 +4320,22 @@
</fmgc>
<mcdu>
<file>Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas</file> <!-- dynamic page - init before others as used in various pages -->
<file>Aircraft/A320-family/Nasal/MCDU/DIRTO.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/LATREV.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/VERTREV.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDDES.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas</file> <!-- dynamic page - init before MCDU -->
<file>Aircraft/A320-family/Nasal/MCDU/DIRTO.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/LATREV.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/VERTREV.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/DEPARTURE.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/WINDDES.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/ATIS.nas</file> <!-- Last Dynamic Page -->
<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file>

View file

@ -25,6 +25,7 @@ var myCLBWIND = [nil, nil];
var myCRZWIND = [nil, nil];
var myDESWIND = [nil, nil];
var myHISTWIND = [nil, nil];
var myAtis = [nil, nil];
var default = "BoeingCDU-Large.ttf";
#var symbol = "helvetica_medium.txf";
var symbol = "LiberationMonoCustom.ttf";
@ -930,6 +931,57 @@ var canvas_MCDU_base = {
me["Simple_R1"].setText("ATIS ");
pageSwitch[i].setBoolValue(1);
}
} else if (page == "ATISDETAIL") {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHide();
me["Simple_PageNum"].hide();
me["ArrowLeft"].hide();
me["ArrowRight"].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(small, small, small, small, normal, 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.colorRightS("grn", "wht", "wht", "wht", "wht", "wht");
if (myAtis[i] != nil) {
me["Simple_Title"].setText(sprintf("%s", myAtis[i].title));
me.dynamicPageArrowFunc(myAtis[i]);
me.colorLeftArrow(myAtis[i].arrowsColour[0][0],myAtis[i].arrowsColour[0][1],myAtis[i].arrowsColour[0][2],myAtis[i].arrowsColour[0][3],myAtis[i].arrowsColour[0][4],myAtis[i].arrowsColour[0][5]);
me.colorRightArrow(myAtis[i].arrowsColour[1][0],myAtis[i].arrowsColour[1][1],myAtis[i].arrowsColour[1][2],myAtis[i].arrowsColour[1][3],myAtis[i].arrowsColour[1][4],myAtis[i].arrowsColour[1][5]);
me.dynamicPageFunc(myAtis[i].L1, "Simple_L1");
me.dynamicPageFunc(myAtis[i].L2, "Simple_L2");
me.dynamicPageFunc(myAtis[i].L3, "Simple_L3");
me.dynamicPageFunc(myAtis[i].L4, "Simple_L4");
me.dynamicPageFunc(myAtis[i].L5, "Simple_L5");
me.dynamicPageFunc(myAtis[i].L6, "Simple_L6");
me.colorLeft(myAtis[i].L1[2],myAtis[i].L2[2],myAtis[i].L3[2],myAtis[i].L4[2],myAtis[i].L5[2],myAtis[i].L6[2]);
me.dynamicPageFunc(myAtis[i].R1, "Simple_R1");
me.dynamicPageFunc(myAtis[i].R2, "Simple_R2");
me.dynamicPageFunc(myAtis[i].R3, "Simple_R3");
me.dynamicPageFunc(myAtis[i].R4, "Simple_R4");
me.dynamicPageFunc(myAtis[i].R5, "Simple_R5");
me.dynamicPageFunc(myAtis[i].R6, "Simple_R6");
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]);
}
pageSwitch[i].setBoolValue(1);
}
} else if (page == "ATIS") {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHideWithCenter();

View file

@ -1,4 +1,4 @@
var receivedMessagePage = {
var atisPage = {
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]],
@ -24,10 +24,11 @@ var receivedMessagePage = {
computer: nil,
size: 0,
new: func(computer, index) {
var ap = {parents:[receivedMessagePage]};
var ap = {parents:[atisPage]};
ap.computer = computer;
ap.curPage = index + 1;
ReceivedMessagesDatabase.database.vector[ap.curPage - 1].viewed = 1;
ap.lineOffset = 0;
ap.index = index;
ap.message = atsu.ATISInstances[index].lastATIS;
ap._setupPageWithData();
ap.update();
return ap;
@ -35,89 +36,76 @@ var receivedMessagePage = {
del: func() {
return nil;
},
scrollLeft: func() {
me.curPage -= 1;
if (me.curPage < 1) {
me.curPage = ReceivedMessagesDatabase.getSize();
getNumLines: func() {
me._numLines = size(me.message) / 30;
me.lineOffset = math.ceil(me._numLines);
},
scrollUp: func() {
me.lineOffset -= 1;
if (me.lineOffset < 0) {
me.lineOffset = me.getNumLines();
}
ReceivedMessagesDatabase.database.vector[me.curPage - 1].viewed = 1;
me.update();
},
scrollRight: func() {
me.curPage += 1;
if (me.curPage > ReceivedMessagesDatabase.getSize()) {
me.curPage = 1;
scrollDown: func() {
me.lineOffset += 1;
if (me.lineOffset > me.getNumLines()) {
me.lineOffset = 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.L2 = [nil, nil, "wht"];
me.L3 = [nil, nil, "wht"];
me.L4 = [nil, nil, "wht"];
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]];
me.arrowsMatrix = [[0, 0, 0, 0, 1, 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.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"];
me.arrowsMatrix = [[0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 0, 1]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "wht", "wht"], ["ack", "ack", "ack", "ack", "ack", "blu"]];
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);
}
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
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)));
}
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)));
}
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)));
}
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)));
}
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)));
}
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)));
}
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},

View file

@ -299,6 +299,13 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (size(scratchpad) == 0) {
if (atsu.ATISInstances[0].received) {
canvas_mcdu.myAtis[i] = atisPage.new(i, 0);
pageNode[i].setValue("ATISDETAIL");
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (find("/", scratchpad) != -1) {
var str = split("/", scratchpad);
if (size(str[0]) > 0 and size(str[1]) == 0) {
@ -432,7 +439,14 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (find("/", scratchpad) != -1) {
} elsif (size(scratchpad) == 0) {
if (atsu.ATISInstances[1].received) {
canvas_mcdu.myAtis[i] = atisPage.new(i, 1);
pageNode[i].setValue("ATISDETAIL");
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (find("/", scratchpad) != -1) {
var str = split("/", scratchpad);
if (size(str[0]) > 0 and size(str[1]) == 0) {
var result = atsu.ATISInstances[1].newStation(str[0]);
@ -548,6 +562,13 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (size(scratchpad) == 0) {
if (atsu.ATISInstances[2].received) {
canvas_mcdu.myAtis[i] = atisPage.new(i, 2);
pageNode[i].setValue("ATISDETAIL");
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (find("/", scratchpad) != -1) {
var str = split("/", scratchpad);
if (size(str[0]) > 0 and size(str[1]) == 0) {
@ -653,6 +674,13 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (size(scratchpad) == 0) {
if (atsu.ATISInstances[3].received) {
canvas_mcdu.myAtis[i] = atisPage.new(i, 3);
pageNode[i].setValue("ATISDETAIL");
} else {
mcdu_message(i, "NOT ALLOWED");
}
} elsif (find("/", scratchpad) != -1) {
var str = split("/", scratchpad);
if (size(str[0]) > 0 and size(str[1]) == 0) {
@ -1305,6 +1333,8 @@ var arrowbutton = func(btn, i) {
initInputIRS("up",i);
} else if (page == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonUp();
} else if (page == "ATISDETAIL") {
canvas_mcdu.myAtis[i].scrollUp();
}
} else if (btn == "down") {
if (page == "F-PLNA" or page == "F-PLNB") {
@ -1319,6 +1349,8 @@ var arrowbutton = func(btn, i) {
initInputIRS("down",i);
} else if (page == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonDown();
} else if (page == "ATISDETAIL") {
canvas_mcdu.myAtis[i].scrollDown();
}
}
}