1
0
Fork 0

Enable wind cancel/insert buttons

This commit is contained in:
Matthew Maring 2020-06-10 20:18:11 -04:00
parent 6b523801b8
commit 3fd01a904d
5 changed files with 117 additions and 66 deletions

View file

@ -287,9 +287,19 @@ var windController = {
canvas_mcdu.myCLBWIND[0]._setupPageWithData();
}
if (canvas_mcdu.myCRZWIND[1] != nil) {
# if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) {
# canvas_mcdu.myCRZWIND[1].del();
# canvas_mcdu.myCRZWIND[1] = nil;
# canvas_mcdu.myCRZWIND[1] = windCRZPage.new(1, fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]), 0);
# }
canvas_mcdu.myCRZWIND[1]._setupPageWithData();
}
if (canvas_mcdu.myCRZWIND[0] != nil) {
# if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) {
# canvas_mcdu.myCRZWIND[0].del();
# canvas_mcdu.myCRZWIND[0] = nil;
# canvas_mcdu.myCRZWIND[0] = windCRZPage.new(0, fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]), 0);
# }
canvas_mcdu.myCRZWIND[0]._setupPageWithData();
}
if (canvas_mcdu.myDESWIND[1] != nil) {
@ -298,67 +308,5 @@ var windController = {
if (canvas_mcdu.myDESWIND[0] != nil) {
canvas_mcdu.myDESWIND[0]._setupPageWithData();
}
},
updateWind: func(n) {
if (n == 0) {
if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) {
canvas_mcdu.myCLBWIND[1]._setupPageWithData();
}
if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) {
if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) {
canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList;
} else {
canvas_mcdu.myCRZWIND[1].del();
canvas_mcdu.myCRZWIND[1] = nil;
canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0);
}
canvas_mcdu.myCRZWIND[1]._setupPageWithData();
} else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) {
canvas_mcdu.myCRZWIND[1].del();
canvas_mcdu.myCRZWIND[1] = nil;
canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0);
canvas_mcdu.myCRZWIND[1]._setupPageWithData();
}
if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) {
canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList;
canvas_mcdu.myDESWIND[1]._setupPageWithData();
}
if (canvas_mcdu.myHISTWIND[1] != nil) {
canvas_mcdu.myHISTWIND[1]._setupPageWithData();
}
} else {
if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) {
canvas_mcdu.myCLBWIND[0]._setupPageWithData();
}
if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) {
if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) {
canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList;
} else {
canvas_mcdu.myCRZWIND[0].del();
canvas_mcdu.myCRZWIND[0] = nil;
canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0);
}
canvas_mcdu.myCRZWIND[0]._setupPageWithData();
} else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) {
canvas_mcdu.myCRZWIND[0].del();
canvas_mcdu.myCRZWIND[0] = nil;
canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0);
canvas_mcdu.myCRZWIND[0]._setupPageWithData();
}
if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) {
canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList;
canvas_mcdu.myDESWIND[0]._setupPageWithData();
}
if (canvas_mcdu.myHISTWIND[0] != nil) {
canvas_mcdu.myHISTWIND[0]._setupPageWithData();
}
}
}
};

View file

@ -434,6 +434,14 @@ var lskbutton = func(btn, i) {
fuelPredInput("L6",i);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("L6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonLeft(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonLeft(6);
#} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
# canvas_mcdu.myHISTWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
@ -721,6 +729,14 @@ var rskbutton = func(btn, i) {
initInputA("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
canvas_mcdu.myCRZWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonRight(6);
#} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
# canvas_mcdu.myHISTWIND[i].pushButtonRight(6);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("R6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") {

View file

@ -174,7 +174,19 @@ var windCLBPage = {
me.updateTmpy();
},
pushButtonLeft: func(index) {
if (me.items >= index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonLeft(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
@ -223,5 +235,22 @@ var windCLBPage = {
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonRight: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonRight(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
}
};

View file

@ -83,7 +83,7 @@ var windCRZPage = {
me.items = 1;
} else if (fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude == "") {
me.items = 2;
} else if (fmgc.windController.crz_winds[computer_temp][me.match_location].wind3.altitude == "") {
} else if (fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude == "") {
me.items = 3;
} else {
me.items = 4;
@ -236,7 +236,19 @@ var windCRZPage = {
me.updateTmpy();
},
pushButtonLeft: func(index) {
if (me.items >= index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonLeft(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
@ -310,6 +322,23 @@ var windCRZPage = {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonRight: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonRight(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonUp: func() {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {

View file

@ -176,7 +176,19 @@ var windDESPage = {
me.updateTmpy();
},
pushButtonLeft: func(index) {
if (me.items >= index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonLeft(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
@ -225,5 +237,22 @@ var windDESPage = {
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
},
pushButtonRight: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
canvas_mcdu.myFpln[me.computer].pushButtonRight(index);
} else {
fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1);
# push update to fuel
if (getprop("/FMGC/internal/block-confirmed")) {
setprop("/FMGC/internal/fuel-calculating", 0);
setprop("/FMGC/internal/fuel-calculating", 1);
}
}
me.reload();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
}
};