diff --git a/A320-main.xml b/A320-main.xml index 881df496..5a687a5d 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4583,6 +4583,7 @@ Aircraft/A320-family/Nasal/Systems/Comm/Dictionary.nas Aircraft/A320-family/Nasal/Systems/Comm/Notification.nas + Aircraft/A320-family/Nasal/Systems/Comm/CPDLC.nas Aircraft/A320-family/Nasal/Displays/DMC.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index bbe49b26..37877a24 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -924,9 +924,9 @@ var canvas_MCDU_base = { 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.showRight(1, 1, 1, 1, 1, 1); me.showRightS(-1, -1, -1, -1, 1, -1); - me.showRightArrow(1, 1, 1, -1, 1, 1); + me.showRightArrow(1, 1, 1, 1, 1, 1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); @@ -950,12 +950,103 @@ var canvas_MCDU_base = { me["Simple_R1"].setText("VERT REQ "); me["Simple_R2"].setText("OTHER "); me["Simple_R3"].setText("TEXT "); - me["Simple_R3"].setText("REPORTS "); + me["Simple_R4"].setText("REPORTS "); me["Simple_R5"].setText("STATUS "); me["Simple_R5S"].setText("CONNECTION "); me["Simple_R6"].setText("EMERGENCY "); pageSwitch[i].setBoolValue(1); } + } else if (page == "MCDUTEXT") { + if (!pageSwitch[i].getBoolValue()) { + me.defaultHideWithCenter(); + me["Simple_Title"].setText("TEXT"); + me["Simple_Title"].setColor(1, 1, 1); + me["Simple_PageNum"].setText("1/2"); + me["Simple_PageNum"].show(); + me["ArrowLeft"].show(); + me["ArrowRight"].show(); + + 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.showCenter(-1, -1, -1, -1, -1, -1); + me.showCenterS(-1, -1, -1, 1, -1, -1); + me.showRightS(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["Simple_L4"].setFont(symbol); + + me.colorLeft("wht", "wht", "wht", "blu", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("blu", "blu", "blu", "wht", "wht", "wht"); + me.colorRight("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "blu"); + me.colorRightArrow("blu", "blu", "blu", "wht", "wht", "blu"); + + + me["Simple_L1"].setText(" A/C PERFORM."); + me["Simple_L1S"].setText(" DUE TO"); + me["Simple_L2"].setText(" WEATHER"); + me["Simple_L2S"].setText(" DUE TO"); + me["Simple_L3"].setText(" TURBULENCE"); + me["Simple_L3S"].setText(" DUE TO"); + me["Simple_R1"].setText("MEDICAL "); + me["Simple_R1S"].setText("DUE TO "); + me["Simple_R2"].setText("TECHNICAL "); + me["Simple_R2S"].setText("DUE TO" ); + me["Simple_R3"].setText("DISCRETION "); + me["Simple_R3S"].setText("AT PILOTS "); + me["Simple_C4S"].setText("-------- FREE TEXT --------"); + me["Simple_L4"].setText("[ ]"); + me["Simple_L5"].setText(" ERASE"); + me["Simple_L5S"].setText(" ALL FIELDS"); + me["Simple_L6S"].setText(" ATC MENU"); + me["Simple_L6"].setText(" RETURN"); + me["Simple_R6S"].setText("ATC "); + me["Simple_R6"].setText("TEXT DISPL "); + pageSwitch[i].setBoolValue(1); + } + + if (atsu.freeTexts[i].selection == 0) { + pageSwitch[i].setBoolValue(0); + me["Simple_L1_Arrow"].hide(); + me["Simple_L1"].setColor(BLUE); + me["Simple_L1S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 1) { + pageSwitch[i].setBoolValue(0); + me["Simple_L2_Arrow"].hide(); + me["Simple_L2"].setColor(BLUE); + me["Simple_L2S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 2) { + pageSwitch[i].setBoolValue(0); + me["Simple_L3_Arrow"].hide(); + me["Simple_L3"].setColor(BLUE); + me["Simple_L3S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 3) { + pageSwitch[i].setBoolValue(0); + me["Simple_R1_Arrow"].hide(); + me["Simple_R1"].setColor(BLUE); + me["Simple_R1S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 4) { + pageSwitch[i].setBoolValue(0); + me["Simple_R2_Arrow"].hide(); + me["Simple_R2"].setColor(BLUE); + me["Simple_R2S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 5) { + pageSwitch[i].setBoolValue(0); + me["Simple_R3_Arrow"].hide(); + me["Simple_R3"].setColor(BLUE); + me["Simple_R3S"].setColor(BLUE); + } elsif (atsu.freeTexts[i].selection == 9) { + pageSwitch[i].setBoolValue(0); + me["Simple_L5_Arrow"].hide(); + } } else if (page == "ATCMENU2") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 05d5d240..f4bfac92 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -354,6 +354,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 0; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -495,6 +498,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 1; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -619,6 +625,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 2; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -786,6 +795,9 @@ var lskbutton = func(btn, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (page == "ATCMENU") { pageNode[i].setValue("NOTIFICATION"); + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 9; + atsu.freeTexts[i].changed = 1; } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(5); } else { @@ -845,7 +857,7 @@ var lskbutton = func(btn, i) { canvas_mcdu.myClosestAirport[i].freeze(); } else if (page == "AOCMENU" or page == "ATCMENU" or page == "ATCMENU2") { pageNode[i].setValue("ATSUDLINK"); - } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS") { + } else if (page == "NOTIFICATION" or page == "CONNECTSTATUS" or page == "MCDUTEXT") { pageNode[i].setValue("ATCMENU"); } else if (page == "WEATHERREQ" or page == "RECEIVEDMSGS") { pageNode[i].setValue("AOCMENU"); @@ -951,6 +963,9 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 3; + atsu.freeTexts[i].changed = 1; } else { mcdu_message(i, "NOT ALLOWED"); } @@ -991,7 +1006,10 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } - } else { + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 4; + atsu.freeTexts[i].changed = 1; + } else { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "3") { @@ -1037,6 +1055,11 @@ var rskbutton = func(btn, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + } else if (page == "MCDUTEXT") { + atsu.freeTexts[i].selection = 5; + atsu.freeTexts[i].changed = 1; + } else if (page == "ATCMENU") { + pageNode[i].setValue("MCDUTEXT"); } else { mcdu_message(i, "NOT ALLOWED"); } @@ -1247,6 +1270,9 @@ var rskbutton = func(btn, i) { } } else if (page == "NOTIFICATION") { pageNode[i].setValue("CONNECTSTATUS"); + } else if (page == "MCDUTEXT") { + # todo transfer to DCDU + pageNode[i].setValue("ATCMENU"); } else if (page == "ATSUDLINK") { pageNode[i].setValue("COMMMENU"); } else if (page == "CONNECTSTATUS") { @@ -1406,7 +1432,7 @@ var pagebutton = func(btn, i) { pageNode[i].setValue("DATA"); } else if (btn == "mcdu") { var page = page; - if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" 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" and page != "ATIS" and page != "ATISDETAIL") { + if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "MCDUTEXT" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT" and page != "ATIS" and page != "ATISDETAIL") { setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page); } else { setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page); diff --git a/Nasal/Systems/Comm/CPDLC.nas b/Nasal/Systems/Comm/CPDLC.nas index fb680947..d145e758 100644 --- a/Nasal/Systems/Comm/CPDLC.nas +++ b/Nasal/Systems/Comm/CPDLC.nas @@ -3,11 +3,35 @@ # Copyright (c) 2020 Josh Davidson (Octal450) var CPDLCmessage = { - new: func(text) { + new: func(text, response = 0) { var cpdlcMessage = {parents: [CPDLCmessage] }; cpdlcMessage.text = text; + cpdlcMessage.response = response; return cpdlcMessage; }, }; -makeNewDictionaryItem(CPDLCmessage.new("CONNECT"), "CONNECT"); \ No newline at end of file +makeNewDictionaryItem(CPDLCmessage.new("CONNECT",0), "CONNECT"); + + +makeNewDictionaryItem(CPDLCmessage.new("WILCO",0), "WILCO"); +makeNewDictionaryItem(CPDLCmessage.new("UNABLE",0), "UNABLE"); +makeNewDictionaryItem(CPDLCmessage.new("STANDBY",0), "STANDBY"); +makeNewDictionaryItem(CPDLCmessage.new("ROGER",0), "ROGER"); +makeNewDictionaryItem(CPDLCmessage.new("AFFIRM",0), "AFFIRM"); +makeNewDictionaryItem(CPDLCmessage.new("NEGATIVE",0), "NEGATIVE"); + + +makeNewDictionaryItem(CPDLCmessage.new("REQUEST ALTITUDE",0), "REQUEST ALTITUDE"); + +var freeText = { + new: func(index) { + var freeTextObj = {parents: [freeText]}; + freeTextObj.index = index; + return freeTextObj; + }, + selection: 9, + changed: 0, +}; + +var freeTexts = [freeText.new(0), freeText.new(1)]; \ No newline at end of file