1
0
Fork 0

Basic text entry logic (clb only)

This commit is contained in:
Matthew Maring 2020-05-31 14:15:53 -04:00
parent f9f6d301a8
commit 3c8402dbbc
4 changed files with 110 additions and 57 deletions

View file

@ -223,11 +223,9 @@ var initInputA = func(key, i) {
} else if (key == "R3") { } else if (key == "R3") {
setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); setprop("MCDU[" ~ i ~ "]/page", "IRSINIT");
} else if (key == "R4") { } else if (key == "R4") {
if (canvas_mcdu.myCLBWIND[i] != nil) { if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i].del(); canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} }
canvas_mcdu.myCLBWIND[i] = nil;
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {

View file

@ -207,6 +207,8 @@ var lskbutton = func(btn, i) {
initInputIRS("L1",i); initInputIRS("L1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("L1",i); initInputB("L1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") {
progTOInput("L1",i); progTOInput("L1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") {
@ -250,6 +252,8 @@ var lskbutton = func(btn, i) {
} else if (btn == "2") { } else if (btn == "2") {
if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") {
initInputA("L2",i); initInputA("L2",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(2);
} else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L2",i); perfTOInput("L2",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -288,6 +292,8 @@ var lskbutton = func(btn, i) {
initInputB("L3",i); initInputB("L3",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L3",i); fuelPredInput("L3",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(3);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L3",i); perfTOInput("L3",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -331,6 +337,8 @@ var lskbutton = func(btn, i) {
initInputB("L4",i); initInputB("L4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L4",i); fuelPredInput("L4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(4);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L4",i); perfTOInput("L4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") {
@ -359,6 +367,8 @@ var lskbutton = func(btn, i) {
initInputB("L5",i); initInputB("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") {
fuelPredInput("L5",i); fuelPredInput("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
canvas_mcdu.myCLBWIND[i].pushButtonLeft(5);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("L5",i); perfTOInput("L5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") {
@ -405,11 +415,9 @@ var lskbutton = func(btn, i) {
} else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") {
initInputIRS("L6",i); initInputIRS("L6",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") {
if (canvas_mcdu.myCLBWIND[i] != nil) { if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i].del(); canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} }
canvas_mcdu.myCLBWIND[i] = nil;
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") {
initInputROUTESEL("L6",i); initInputROUTESEL("L6",i);
@ -454,11 +462,9 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("R1",i); initInputB("R1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
if (canvas_mcdu.myHISTWIND[i] != nil) { if (canvas_mcdu.myHISTWIND[i] == nil) {
canvas_mcdu.myHISTWIND[i].del(); canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i);
} }
canvas_mcdu.myHISTWIND[i] = nil;
canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i);
setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); setprop("MCDU[" ~ i ~ "]/page", "WINDHIST");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") {
radnavInput("R1",i); radnavInput("R1",i);
@ -551,17 +557,13 @@ var rskbutton = func(btn, i) {
fuelPredInput("R4",i); fuelPredInput("R4",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
if (canvas_mcdu.myCLBWIND[i] == nil) { if (canvas_mcdu.myCLBWIND[i] == nil) {
canvas_mcdu.myCLBWIND[i].del(); canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
} }
canvas_mcdu.myCLBWIND[i] = nil;
canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i);
setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
if (canvas_mcdu.myCRZWIND[i] != nil) { if (canvas_mcdu.myCRZWIND[i] == nil) {
canvas_mcdu.myCRZWIND[i].del(); canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, "");
} }
canvas_mcdu.myCRZWIND[i] = nil;
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, "");
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") {
perfTOInput("R4",i); perfTOInput("R4",i);
@ -586,18 +588,14 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("R5",i); initInputB("R5",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
if (canvas_mcdu.myCRZWIND[i] != nil) { if (canvas_mcdu.myCRZWIND[i] == nil) {
canvas_mcdu.myCRZWIND[i].del(); canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, "");
} }
canvas_mcdu.myCRZWIND[i] = nil;
canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, "");
setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") {
if (canvas_mcdu.myDESWIND[i] != nil) { if (canvas_mcdu.myDESWIND[i] == nil) {
canvas_mcdu.myDESWIND[i].del(); canvas_mcdu.myDESWIND[i] = windDESPage.new(i, "");
} }
canvas_mcdu.myDESWIND[i] = nil;
canvas_mcdu.myDESWIND[i] = windDESPage.new(i, "");
setprop("MCDU[" ~ i ~ "]/page", "WINDDES"); setprop("MCDU[" ~ i ~ "]/page", "WINDDES");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") {
statusInput("R5",i); statusInput("R5",i);

View file

@ -45,42 +45,72 @@ var windCLBPage = {
me.title = "CLIMB WIND"; me.title = "CLIMB WIND";
#me.title = "DRAFT CLIMB WIND"; #me.title = "DRAFT CLIMB WIND";
me.titleColour = "wht"; me.titleColour = "wht";
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
if (size(me.windList) >= 5) { if (size(me.windList) >= 5) {
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; if (me.windList[4] != nil) {
me.L5 = [me.windList[4][0] ~ "/" ~ me.windList[4][1] ~ "/" ~ me.windList[4][2], nil, "blu"];
me.fontMatrix[0][4] = 0;
} else {
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][4] = 1;
}
} else { } else {
me.L5 = [nil, nil, "ack"]; me.L5 = [nil, nil, "ack"];
} }
if (size(me.windList) >= 4) { if (size(me.windList) >= 4) {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; if (me.windList[3] != nil) {
me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"];
me.fontMatrix[0][3] = 0;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else { } else {
me.L4 = [nil, nil, "ack"]; me.L4 = [nil, nil, "ack"];
} }
if (size(me.windList) >= 3) { if (size(me.windList) >= 3) {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; if (me.windList[2] != nil) {
me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"];
me.fontMatrix[0][2] = 0;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else { } else {
me.L3 = [nil, nil, "ack"]; me.L3 = [nil, nil, "ack"];
} }
if (size(me.windList) >= 2) { if (size(me.windList) >= 2) {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; if (me.windList[1] != nil) {
me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"];
me.fontMatrix[0][1] = 0;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else { } else {
me.L2 = [nil, nil, "ack"]; me.L2 = [nil, nil, "ack"];
} }
if (size(me.windList) >= 1) { if (size(me.windList) >= 1) {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; if (me.windList[0] != nil) {
me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 0;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
} }
me.R1 = [" HISTORY ", "WIND ", "wht"]; me.R1 = [" HISTORY ", "WIND ", "wht"];
me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R3 = [" REQUEST ", "WIND ", "amb"];
me.R5 = [" PHASE ", "NEXT ", "wht"]; me.R5 = [" PHASE ", "NEXT ", "wht"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]];
me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]];
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
makeTmpy: func() { makeTmpy: func() {
@ -112,5 +142,24 @@ var windCLBPage = {
#draft title #draft title
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} }
},
pushButtonLeft: func(index) {
if (size(me.windList) >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
me.windList[index - 1] = [winds[0], winds[1], winds[2]];
mcdu_scratchpad.scratchpads[me.computer].empty();
if (index != 5) {
append(me.windList, nil);
}
me._setupPageWithData();
me.makeTmpy();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
} }
}; };

View file

@ -33,7 +33,7 @@ var windHISTPage = {
var whp = {parents:[windHISTPage]}; var whp = {parents:[windHISTPage]};
whp.computer = computer; whp.computer = computer;
whp._setupPageWithData(); whp._setupPageWithData();
#whp.updateTmpy(); whp.updateTmpy();
return whp; return whp;
}, },
del: func() { del: func() {
@ -71,27 +71,35 @@ var windHISTPage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
makeTmpy: func() { makeTmpy: func() {
# if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
# } }
}, },
updateTmpy: func() { updateTmpy: func() {
# if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
# me.L1[2] = "yel"; me.L1[2] = "yel";
# me.L2[2] = "yel"; me.L2[2] = "yel";
# me.L6 = [" F-PLN", " TMPY", "yel"]; me.L3[2] = "yel";
# me.R6 = ["INSERT* ", " TMPY", "yel"]; me.L4[2] = "yel";
# me.arrowsColour[0][5] = "yel"; me.L5[2] = "yel";
# me.titleColour = "yel"; me.C1[2] = "yel";
# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); me.C2[2] = "yel";
# } else { me.C3[2] = "yel";
# me.L1[2] = "blu"; me.C4[2] = "yel";
# me.L2[2] = "blu"; me.C5[2] = "yel";
# me.L6 = [" RETURN", nil, "wht"]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
# me.R6 = [nil, nil, "ack"]; } else {
# me.arrowsColour[0][5] = "wht"; me.L1[2] = "blu";
# me.titleColour = "wht"; me.L2[2] = "blu";
# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); me.L3[2] = "blu";
# } me.L4[2] = "blu";
me.L5[2] = "blu";
me.C1[2] = "blu";
me.C2[2] = "blu";
me.C3[2] = "blu";
me.C4[2] = "blu";
me.C5[2] = "blu";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}
} }
}; };