Skip to content

Commit

Permalink
Implemented MCDU AIRWAYS page, fixed legoboyvdlp#280 legoboyvdlp#283
Browse files Browse the repository at this point in the history
  • Loading branch information
noteas committed Dec 24, 2022
1 parent 5dcb70a commit 567bc61
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 13 deletions.
27 changes: 15 additions & 12 deletions Nasal/MCDU/AIRWAYS.nas
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ var airwaysPage = {
R6: [nil, nil, "ack"],
scroll: 0,
vector: [],
index: nil,
index: "L1",
wpIndex: nil
computer: nil,
titleColour: nil,
new: func(computer, waypoint) {
Expand All @@ -44,6 +45,7 @@ var airwaysPage = {
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.wpIndex = me.waypoint;
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
makeTmpy: func() {
Expand All @@ -64,17 +66,18 @@ 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 = findFixesByID(name);
if (fix == nil) {
return nil;
}
fix = fix[0];
var rt = airwaysRoute(me.wpIndex, fix);
if (rt == nil) {
return nil;
}
fmgc.flightPlanController.flightplans[me.computer].insertWaypoints(rt, fmgc.flightPlanController.flightplans[me.computer].indexOfWP(me.wpIndex) + 1);
me.wpIndex = rt[-1];
return 1;
},
};
109 changes: 109 additions & 0 deletions Nasal/MCDU/MCDU.nas
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,15 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil 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();
} 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 +415,15 @@ var lskbutton = func(btn, i) {
perfDESInput("L2",i);
} else if (page == "DATA") {
dataInput("L2",i);
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil 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();
} 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 +573,15 @@ var lskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil 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();
} 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 +689,15 @@ var lskbutton = func(btn, i) {
perfAPPRInput("L4",i);
} else if (page == "RADNAV") {
radnavInput("L4",i);
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil 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();
} 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 +820,15 @@ var lskbutton = func(btn, i) {
dataInput("L5",i);
} else if (page == "DATA2") {
data2Input("L5",i);
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil 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();
} 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 +982,19 @@ var rskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil and canvas_mcdu.myAirways[i].index == "R1") {
canvas_mcdu.myAirways[i].R1 = [mcdu_scratchpad.scratchpads[i].scratchpad, "TO ", "wht"];
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == nil) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].index = "L2";
canvas_mcdu.myAirways[i].L2 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
}
} 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 +1074,19 @@ 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 (mcdu_scratchpad.scratchpads[i].scratchpad != nil and canvas_mcdu.myAirways[i].index == "R2") {
canvas_mcdu.myAirways[i].R2 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == nil) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].index = "L3";
canvas_mcdu.myAirways[i].L3 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
}
} 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 +1136,19 @@ var rskbutton = func(btn, i) {
} else {
mcdu_message(i, "NOT ALLOWED");
}
} else if (page == "AIRWAYS") {
if (mcdu_scratchpad.scratchpads[i].scratchpad != nil and canvas_mcdu.myAirways[i].index == "R3") {
canvas_mcdu.myAirways[i].R3 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == nil) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].index = "L4";
canvas_mcdu.myAirways[i].L4 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
}
} 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 +1232,19 @@ 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 (mcdu_scratchpad.scratchpads[i].scratchpad != nil and canvas_mcdu.myAirways[i].index == "R4") {
canvas_mcdu.myAirways[i].R4 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == nil) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].index = "L5";
canvas_mcdu.myAirways[i].L5 = ["[ ]", nil, "blu"];
mcdu_scratchpad.scratchpads[i].empty();
}
} 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 +1324,18 @@ 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 (mcdu_scratchpad.scratchpads[i].scratchpad != nil and canvas_mcdu.myAirways[i].index == "R5") {
canvas_mcdu.myAirways[i].R5 = [mcdu_scratchpad.scratchpads[i].scratchpad, nil, "wht"];
if (canvas_mcdu.myAirways[i].updateAirways(mcdu_scratchpad.scratchpads[i].scratchpad) == nil) {
mcdu_message(i, "NOT IN DATA BASE");
} else {
canvas_mcdu.myAirways[i].index = nil;
mcdu_scratchpad.scratchpads[i].empty();
}
} 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

0 comments on commit 567bc61

Please sign in to comment.