Enabling cycling through waypoints
This commit is contained in:
parent
efc771c89e
commit
b7f153a601
7 changed files with 105 additions and 11 deletions
|
@ -527,6 +527,17 @@ var flightPlanController = {
|
|||
return 2;
|
||||
},
|
||||
|
||||
getWaypointList: func(plan) {
|
||||
var waypointsList = [];
|
||||
for (var index = 1; index < me.arrivalIndex[plan]; index += 1) {
|
||||
#print(me.flightplans[plan].getWP(index).wp_name);
|
||||
if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt") {
|
||||
append(waypointsList, me.flightplans[plan].getWP(index));
|
||||
}
|
||||
}
|
||||
return waypointsList;
|
||||
},
|
||||
|
||||
# getWPforPBD - parse scratchpad text to find waypoint ghost for PBD
|
||||
# args: text, index, plan
|
||||
# text: scratchpad text
|
||||
|
|
|
@ -225,6 +225,8 @@ var initInputA = func(key, i) {
|
|||
} else if (key == "R4") {
|
||||
if (canvas_mcdu.myCLBWIND[i] == nil) {
|
||||
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
|
||||
} else {
|
||||
canvas_mcdu.myCLBWIND[i].reload();
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
|
||||
} else if (key == "R5") {
|
||||
|
|
|
@ -417,6 +417,8 @@ var lskbutton = func(btn, i) {
|
|||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
|
||||
if (canvas_mcdu.myCLBWIND[i] == nil) {
|
||||
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
|
||||
} else {
|
||||
canvas_mcdu.myCLBWIND[i].reload();
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") {
|
||||
|
@ -464,6 +466,8 @@ var rskbutton = func(btn, i) {
|
|||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
if (canvas_mcdu.myHISTWIND[i] == nil) {
|
||||
canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i);
|
||||
} else {
|
||||
canvas_mcdu.myHISTWIND[i].reload();
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDHIST");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") {
|
||||
|
@ -558,13 +562,26 @@ var rskbutton = func(btn, i) {
|
|||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
if (canvas_mcdu.myCLBWIND[i] == nil) {
|
||||
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
|
||||
} else {
|
||||
canvas_mcdu.myCLBWIND[i].reload();
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
|
||||
if (canvas_mcdu.myCRZWIND[i] == nil) {
|
||||
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, "");
|
||||
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) {
|
||||
if (canvas_mcdu.myCRZWIND[i] != nil) {
|
||||
canvas_mcdu.myCRZWIND[i].del();
|
||||
}
|
||||
canvas_mcdu.myCRZWIND[i] = nil;
|
||||
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0);
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
|
||||
} else {
|
||||
if (canvas_mcdu.myCRZWIND[i] != nil) {
|
||||
canvas_mcdu.myCRZWIND[i].del();
|
||||
}
|
||||
canvas_mcdu.myCRZWIND[i] = nil;
|
||||
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil);
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
|
||||
perfTOInput("R4",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
|
||||
|
@ -588,13 +605,26 @@ var rskbutton = func(btn, i) {
|
|||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
|
||||
initInputB("R5",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
|
||||
if (canvas_mcdu.myCRZWIND[i] == nil) {
|
||||
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, "");
|
||||
if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) {
|
||||
if (canvas_mcdu.myCRZWIND[i] != nil) {
|
||||
canvas_mcdu.myCRZWIND[i].del();
|
||||
}
|
||||
canvas_mcdu.myCRZWIND[i] = nil;
|
||||
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0);
|
||||
} else {
|
||||
if (canvas_mcdu.myCRZWIND[i] != nil) {
|
||||
canvas_mcdu.myCRZWIND[i].del();
|
||||
}
|
||||
canvas_mcdu.myCRZWIND[i] = nil;
|
||||
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil);
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
if (canvas_mcdu.myDESWIND[i] == nil) {
|
||||
canvas_mcdu.myDESWIND[i] = windDESPage.new(i, "");
|
||||
} else {
|
||||
canvas_mcdu.myDESWIND[i].reload();
|
||||
}
|
||||
setprop("MCDU[" ~ i ~ "]/page", "WINDDES");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") {
|
||||
|
@ -737,6 +767,8 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myDirTo[i].scrollUp();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
|
||||
initInputIRS("up",i);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
canvas_mcdu.myCRZWIND[i].pushButtonUp();
|
||||
}
|
||||
} else if (btn == "down") {
|
||||
if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
|
@ -749,7 +781,9 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myDirTo[i].scrollDn();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
|
||||
initInputIRS("down",i);
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
|
||||
canvas_mcdu.myCRZWIND[i].pushButtonDown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,10 @@ var windCLBPage = {
|
|||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
reload: func() {
|
||||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
},
|
||||
pushButtonLeft: func(index) {
|
||||
if (size(me.windList) >= index) {
|
||||
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
|
||||
|
|
|
@ -27,14 +27,20 @@ var windCRZPage = {
|
|||
R6: [nil, nil, "ack"],
|
||||
scroll: 0,
|
||||
vector: [],
|
||||
index: nil,
|
||||
#index: nil,
|
||||
computer: nil,
|
||||
cur_location: 0,
|
||||
windList: [],
|
||||
new: func(computer) { #, waypoint
|
||||
singleCRZ: 0,
|
||||
new: func(computer, waypoint, cur_location) {
|
||||
var wcp = {parents:[windCRZPage]};
|
||||
wcp.computer = computer;
|
||||
wcp.windList = [nil];
|
||||
#wcp.waypoint = waypoint;
|
||||
wcp.waypoint = waypoint;
|
||||
wcp.cur_location = cur_location;
|
||||
if (waypoint == nil) {
|
||||
wcp.singleCRZ = 1;
|
||||
}
|
||||
wcp._setupPageWithData();
|
||||
wcp.updateTmpy();
|
||||
return wcp;
|
||||
|
@ -43,8 +49,11 @@ var windCRZPage = {
|
|||
return nil;
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = ["CRZ WIND", " AT ", "TEMP"];
|
||||
#me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
|
||||
if (me.singleCRZ == 1) {
|
||||
me.title = ["","CRZ WIND",""];
|
||||
} else {
|
||||
me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name];
|
||||
}
|
||||
me.titleColour = "wht";
|
||||
|
||||
if (size(me.windList) >= 4) {
|
||||
|
@ -108,5 +117,31 @@ var windCRZPage = {
|
|||
#draft title
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
reload: func() {
|
||||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
},
|
||||
pushButtonUp: func() {
|
||||
if (me.cur_location < size(fmgc.flightPlanController.getWaypointList(2)) - 1) {
|
||||
me.cur_location = me.cur_location + 1;
|
||||
} else {
|
||||
me.cur_location = 0;
|
||||
}
|
||||
me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location];
|
||||
me.windList = [];
|
||||
#load stored data here
|
||||
me.reload();
|
||||
},
|
||||
pushButtonDown: func() {
|
||||
if (me.cur_location > 0) {
|
||||
me.cur_location = me.cur_location - 1;
|
||||
} else {
|
||||
me.cur_location = size(fmgc.flightPlanController.getWaypointList(2)) - 1;
|
||||
}
|
||||
me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location];
|
||||
me.windList = [];
|
||||
#load stored data here
|
||||
me.reload();
|
||||
}
|
||||
};
|
|
@ -115,5 +115,9 @@ var windDESPage = {
|
|||
#draft title
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
reload: func() {
|
||||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
}
|
||||
};
|
|
@ -101,5 +101,9 @@ var windHISTPage = {
|
|||
me.C5[2] = "blu";
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
}
|
||||
},
|
||||
reload: func() {
|
||||
me._setupPageWithData();
|
||||
me.updateTmpy();
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue