Fix nasal errors with alt-wind, allow clearing of alt-wind/sat
This commit is contained in:
parent
d6b2b82c92
commit
96eba4ea29
5 changed files with 30 additions and 35 deletions
|
@ -68,7 +68,7 @@ var fuelPredInput = func(key, i) {
|
||||||
} else {
|
} else {
|
||||||
mcdu_message(i, "NOT ALLOWED");
|
mcdu_message(i, "NOT ALLOWED");
|
||||||
}
|
}
|
||||||
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) {
|
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) {
|
||||||
if (scratchpad == "CLR") {
|
if (scratchpad == "CLR") {
|
||||||
setprop("/FMGC/internal/alt-fuel", 0.0);
|
setprop("/FMGC/internal/alt-fuel", 0.0);
|
||||||
setprop("/FMGC/internal/alt-time", "0000");
|
setprop("/FMGC/internal/alt-time", "0000");
|
||||||
|
|
|
@ -71,7 +71,7 @@ var initInputB = func(key, i) {
|
||||||
} else {
|
} else {
|
||||||
mcdu_message(i, "NOT ALLOWED");
|
mcdu_message(i, "NOT ALLOWED");
|
||||||
}
|
}
|
||||||
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and getprop("/FMGC/internal/alt-set")) {
|
} else if (key == "L4" and getprop("/FMGC/internal/block-confirmed") and !getprop("/FMGC/internal/fuel-calculating") and fmgc.FMGCInternal.altAirportSet) {
|
||||||
if (scratchpad == "CLR") {
|
if (scratchpad == "CLR") {
|
||||||
setprop("/FMGC/internal/alt-fuel", 0.0);
|
setprop("/FMGC/internal/alt-fuel", 0.0);
|
||||||
setprop("/FMGC/internal/alt-time", "0000");
|
setprop("/FMGC/internal/alt-time", "0000");
|
||||||
|
|
|
@ -196,7 +196,7 @@ var windCLBPage = {
|
||||||
if (size(winds) < 3) {
|
if (size(winds) < 3) {
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
# not implemented yet
|
# not implemented yet
|
||||||
} else if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
} else if (size(winds) == 3 and size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
||||||
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
||||||
size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
||||||
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
||||||
|
|
|
@ -283,7 +283,8 @@ var windCRZPage = {
|
||||||
} else if (index == 5) {
|
} else if (index == 5) {
|
||||||
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 6 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 9) {
|
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 6 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 9) {
|
||||||
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
|
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
|
||||||
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= 99 and
|
# to-do, allow independent entry
|
||||||
|
if (size(winds) == 2 and size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= 99 and
|
||||||
size(winds[1]) >= 4 and size(winds[1]) <= 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or
|
size(winds[1]) >= 4 and size(winds[1]) <= 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or
|
||||||
(num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) {
|
(num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) {
|
||||||
me.makeTmpy();
|
me.makeTmpy();
|
||||||
|
@ -310,14 +311,8 @@ var windCRZPage = {
|
||||||
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||||
computer_temp = me.computer;
|
computer_temp = me.computer;
|
||||||
}
|
}
|
||||||
#print(computer_temp);
|
fmgc.windController.crz_winds[computer_temp].sat1.temp = 0;
|
||||||
if (me.singleCRZ == 1) {
|
fmgc.windController.crz_winds[computer_temp].sat1.altitude = "";
|
||||||
fmgc.windController.crz_winds[computer_temp].sat1.temp = 0;
|
|
||||||
fmgc.windController.crz_winds[computer_temp].sat1.altitude = "";
|
|
||||||
} else {
|
|
||||||
fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = 0;
|
|
||||||
fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = "";
|
|
||||||
}
|
|
||||||
mcdu_scratchpad.scratchpads[me.computer].empty();
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
me._setupPageWithData();
|
me._setupPageWithData();
|
||||||
me.updateTmpy();
|
me.updateTmpy();
|
||||||
|
@ -330,7 +325,7 @@ var windCRZPage = {
|
||||||
if (size(winds) < 3) {
|
if (size(winds) < 3) {
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
# not implemented yet
|
# not implemented yet
|
||||||
} else if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
} else if (size(winds) == 3 and size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
||||||
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
||||||
size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
||||||
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
||||||
|
|
|
@ -135,7 +135,7 @@ var windDESPage = {
|
||||||
|
|
||||||
me.L6 = [" RETURN", nil, "wht"];
|
me.L6 = [" RETURN", nil, "wht"];
|
||||||
|
|
||||||
if (getprop("/FMGC/internal/alt-set")) {
|
if (fmgc.FMGCInternal.altAirportSet) {
|
||||||
var windStore = fmgc.windController.des_winds[computer_temp].alt1;
|
var windStore = fmgc.windController.des_winds[computer_temp].alt1;
|
||||||
if (windStore.heading != 0 and windStore.magnitude != 0) {
|
if (windStore.heading != 0 and windStore.magnitude != 0) {
|
||||||
me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"];
|
me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"];
|
||||||
|
@ -228,7 +228,7 @@ var windDESPage = {
|
||||||
if (size(winds) < 3) {
|
if (size(winds) < 3) {
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
# not implemented yet
|
# not implemented yet
|
||||||
} else if (size(winds[0]) >= 0 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
} else if (size(winds) == 3 and size(winds[0]) >= 0 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
||||||
size(winds[1]) >= 0 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
size(winds[1]) >= 0 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and
|
||||||
size(winds[2]) >= 4 and size(winds[2]) <= 5 and (winds[2] == "GRND" or (num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
size(winds[2]) >= 4 and size(winds[2]) <= 5 and (winds[2] == "GRND" or (num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or
|
||||||
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
(num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) {
|
||||||
|
@ -328,26 +328,8 @@ var windDESPage = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
pushButtonRight: func(index) {
|
pushButtonRight: func(index) {
|
||||||
if (index == 1 and getprop("/FMGC/internal/alt-set")) {
|
if (index == 1 and fmgc.FMGCInternal.altAirportSet) {
|
||||||
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 3 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 7) {
|
if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
|
||||||
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
|
|
||||||
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
|
||||||
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200) {
|
|
||||||
me.makeTmpy();
|
|
||||||
var computer_temp = 2;
|
|
||||||
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
|
||||||
computer_temp = me.computer;
|
|
||||||
}
|
|
||||||
#print(computer_temp);
|
|
||||||
fmgc.windController.des_winds[computer_temp].alt1.heading = winds[0];
|
|
||||||
fmgc.windController.des_winds[computer_temp].alt1.magnitude = winds[1];
|
|
||||||
mcdu_scratchpad.scratchpads[me.computer].empty();
|
|
||||||
me._setupPageWithData();
|
|
||||||
me.updateTmpy();
|
|
||||||
} else {
|
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
|
||||||
}
|
|
||||||
} else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
|
|
||||||
var computer_temp = 2;
|
var computer_temp = 2;
|
||||||
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||||
computer_temp = me.computer;
|
computer_temp = me.computer;
|
||||||
|
@ -357,6 +339,24 @@ var windDESPage = {
|
||||||
mcdu_scratchpad.scratchpads[me.computer].empty();
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
me._setupPageWithData();
|
me._setupPageWithData();
|
||||||
me.updateTmpy();
|
me.updateTmpy();
|
||||||
|
} else if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 3 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 7) {
|
||||||
|
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
|
||||||
|
# to-do, allow independent entry
|
||||||
|
if (size(winds) == 2 and size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
|
||||||
|
size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200) {
|
||||||
|
me.makeTmpy();
|
||||||
|
var computer_temp = 2;
|
||||||
|
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
|
||||||
|
computer_temp = me.computer;
|
||||||
|
}
|
||||||
|
fmgc.windController.des_winds[computer_temp].alt1.heading = winds[0];
|
||||||
|
fmgc.windController.des_winds[computer_temp].alt1.magnitude = winds[1];
|
||||||
|
mcdu_scratchpad.scratchpads[me.computer].empty();
|
||||||
|
me._setupPageWithData();
|
||||||
|
me.updateTmpy();
|
||||||
|
} else {
|
||||||
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mcdu_message(me.computer, "NOT ALLOWED");
|
mcdu_message(me.computer, "NOT ALLOWED");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue