Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented MCDU AIRWAYS page #284

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions Nasal/MCDU/AIRWAYS.nas
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var airwaysPage = {
scroll: 0,
vector: [],
index: nil,
curWP: nil,
computer: nil,
titleColour: nil,
new: func(computer, waypoint) {
Expand All @@ -40,10 +41,12 @@ var airwaysPage = {
_setupPageWithData: func() {
me.title = ["AIRWAYS", " FROM ", me.waypoint.wp_name];
me.titleColour = "grn";
me.index = "L1";
me.L1 = ["[ ]", " VIA", "blu"];
me.R1 = [nil, "TO ", "blu"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
me.curWP = me.waypoint;
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
makeTmpy: func() {
Expand All @@ -64,17 +67,22 @@ var airwaysPage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
},
updateAirways: func(index, airwayName) {
if (index == 1) {
me.L1[0] = airwayName;
} elsif (index == 2) {
me.L2[0] = airwayName;
} elsif (index == 3) {
me.L3[0] = airwayName;
} elsif (index == 4) {
me.L4[0] = airwayName;
} elsif (index == 5) {
me.L5[0] = airwayName;
updateAirways: func(name) { # Find route to waypoint by airway
var fix = [];
if (size(name) <= 3) {
fix = findNavaidsByID(name);
} else {
fix = findFixesByID(name);
}
if (size(fix) == 0) {
return 0;
}
fix = createWPFrom(fix[0]);
var rt = airwaysRoute(me.curWP, fix);
append(rt, fix);
fmgc.flightPlanController.flightplans[me.computer].insertWaypoints(rt, fmgc.flightPlanController.flightplans[me.computer].indexOfWP(me.curWP) + 1);
fmgc.flightPlanController.flightPlanChanged(me.computer);
me.curWP = fix;
return 1;
},
};
119 changes: 119 additions & 0 deletions Nasal/MCDU/MCDU.nas
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,16 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "L1") {
canvas_mcdu.myAirways[i].L1 = [mcdu_scratchpad.scratchpads[i].scratchpad, " VIA", "wht"];
canvas_mcdu.myAirways[i].index = "R1";
canvas_mcdu.myAirways[i].R1 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(1);
} else if (page == "DIRTO") {
Expand Down Expand Up @@ -406,6 +416,16 @@ var lskbutton = func(btn, i) {
perfDESInput("L2",i);
} else if (page == "DATA") {
dataInput("L2",i);
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "L2") {
canvas_mcdu.myAirways[i].L2 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "R2";
canvas_mcdu.myAirways[i].R2 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(2);
} else if (page == "DEPARTURE") {
Expand Down Expand Up @@ -555,6 +575,16 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "L3") {
canvas_mcdu.myAirways[i].L3 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "R3";
canvas_mcdu.myAirways[i].R3 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "DUPLICATENAMES") {
canvas_mcdu.myDuplicate[i].pushButtonLeft(3);
} else if (page == "COMMMENU") {
Expand Down Expand Up @@ -662,6 +692,16 @@ var lskbutton = func(btn, i) {
perfAPPRInput("L4",i);
} else if (page == "RADNAV") {
radnavInput("L4",i);
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "L4") {
canvas_mcdu.myAirways[i].L4 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "R4";
canvas_mcdu.myAirways[i].R4 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(4);
} else if (page == "DEPARTURE") {
Expand Down Expand Up @@ -784,6 +824,16 @@ var lskbutton = func(btn, i) {
dataInput("L5",i);
} else if (page == "DATA2") {
data2Input("L5",i);
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "L5") {
canvas_mcdu.myAirways[i].L5 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "R5";
canvas_mcdu.myAirways[i].R5 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonLeft(5);
} else if (page == "DEPARTURE") {
Expand Down Expand Up @@ -937,6 +987,20 @@ var rskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "R1") {
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == 0) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].R1 = [mcdu_scratchpad.scratchpads[i].scratchpad, "TO ", "wht"];
canvas_mcdu.myAirways[i].index = "L2";
canvas_mcdu.myAirways[i].L2 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(1);
} else if (page == "DATA2") {
Expand Down Expand Up @@ -1016,6 +1080,20 @@ var rskbutton = func(btn, i) {
canvas_mcdu.myDeparture[i].depPushbuttonRight(2);
} else if (page == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(2);
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "R2") {
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == 0) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].R2 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "L3";
canvas_mcdu.myAirways[i].L3 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(2);
} else if (page == "NOTIFICATION") {
Expand Down Expand Up @@ -1065,6 +1143,20 @@ var rskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "R3") {
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == 0) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].R3 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "L4";
canvas_mcdu.myAirways[i].L4 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(3);
} else if (page == "AOCMENU") {
Expand Down Expand Up @@ -1148,6 +1240,20 @@ var rskbutton = func(btn, i) {
canvas_mcdu.myDeparture[i].depPushbuttonRight(4);
} else if (page == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(4);
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "R4") {
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == 0) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].R4 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = "L5";
canvas_mcdu.myAirways[i].L5 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(4);
} else if (page == "ATIS") {
Expand Down Expand Up @@ -1227,6 +1333,19 @@ var rskbutton = func(btn, i) {
canvas_mcdu.myDeparture[i].depPushbuttonRight(5);
} else if (page == "ARRIVAL") {
canvas_mcdu.myArrival[i].arrPushbuttonRight(5);
} else if (page == "AIRWAYS") {
if (size(mcdu_scratchpad.scratchpads[i].scratchpad) > 0 and canvas_mcdu.myAirways[i].index == "R5") {
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == 0) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].R5 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
canvas_mcdu.myAirways[i].index = nil;
mcdu_scratchpad.scratchpads[i].empty();
canvas_mcdu.myAirways[i].updateTmpy();
}
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "F-PLNA" or page == "F-PLNB") {
canvas_mcdu.myFpln[i].pushButtonRight(5);
} else if (page == "LATREV") {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You can find a Checklist to download and print [here](https://raw.githubusercont
## Navdata
It is highly reccomended to purchase a NAVIGRAPH subscription and download their level d FMSDATA / waypoint / navaid data! If you do not wish to do that, there is older data linked below. But it won't have most of the newer procedures, and is only for a limited number of airports, as naturally it is not possible to distribute commercial data. If runway numbering changed, it is quite possible that it will not work due to FlightGear limitations in the routing code.

To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml.
To install navdata, create a folder FMSDATA, and add it to your additional scenery folders, at the top of the list. Inside that folder, place all the XXXX.procedures.xml files, in the format FMSDATA/X/X/X/XXXX.procedures.xml. For instance, FMSDATA/Airports/E/G/K/EGKK.procedures.xml. For further details, please refer to [this](https://wiki.flightgear.org/Route_manager#SIDs_and_STARs).

## Remote MCDU
If you want to run the MCDU on a your smarthphone or tablet for better realism and easier input, run FlightGear with enabled HTTP server (i.e. command line --httpd=<Port; e.g. 8080>) then go to main menu -> Instruments -> Remote MCDU.
Expand Down