1
0
Fork 0

Merge pull request #174 from legoboyvdlp/hist-winds

History winds
This commit is contained in:
Matthew Maring 2020-08-05 22:02:47 -04:00 committed by GitHub
commit 2de52d1b11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 327 additions and 72 deletions

View file

@ -710,6 +710,48 @@ var masterFMGC = maketimer(0.2, func {
############################
updateFuel();
############################
# wind
############################
if (FMGCInternal.phase == 3 or FMGCInternal.phase == 4 or FMGCInternal.phase == 6) {
var windsDidChange = 0;
if (FMGCInternal.crzFt > 5000 and alt > 4980 and alt < 5020) {
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl050_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl050_wind[1]) {
fmgc.windController.fl050_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
fmgc.windController.fl050_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
fmgc.windController.fl050_wind[2] = "FL050";
windsDidChange = 1;
}
}
if (FMGCInternal.crzFt > 15000 and alt > 14980 and alt < 15020) {
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl150_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl150_wind[1]) {
fmgc.windController.fl150_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
fmgc.windController.fl150_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
fmgc.windController.fl150_wind[2] = "FL150";
windsDidChange = 1;
}
}
if (FMGCInternal.crzFt > 25000 and alt > 24980 and alt < 25020) {
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.fl250_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.fl250_wind[1]) {
fmgc.windController.fl250_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
fmgc.windController.fl250_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
fmgc.windController.fl250_wind[2] = "FL250";
windsDidChange = 1;
}
}
if (FMGCInternal.crzSet and alt > FMGCInternal.crzFt - 20 and alt < FMGCInternal.crzFt + 20) {
if (sprintf("%03d", getprop("/environment/wind-from-heading-deg/")) != fmgc.windController.flcrz_wind[0] or sprintf("%03d", getprop("/environment/wind-speed-kt/")) != fmgc.windController.flcrz_wind[1]) {
fmgc.windController.flcrz_wind[0] = sprintf("%03d", getprop("/environment/wind-from-heading-deg/"));
fmgc.windController.flcrz_wind[1] = sprintf("%03d", getprop("/environment/wind-speed-kt/"));
fmgc.windController.flcrz_wind[2] = "FL" ~ FMGCInternal.crzFl;
windsDidChange = 1;
}
}
if (windsDidChange) {
fmgc.windController.write();
}
}
############################
# calculate speeds
############################

View file

@ -93,6 +93,11 @@ var windController = {
clb_winds: [0, 0, 0],
crz_winds: [0, 0, 0],
des_winds: [0, 0, 0],
hist_winds: 0,
fl050_wind: [-1, -1, ""],
fl150_wind: [-1, -1, ""],
fl250_wind: [-1, -1, ""],
flcrz_wind: [-1, -1, ""],
winds: [[], [], []], #waypoint winds used if route includes navaids
nav_indicies: [[], [], []],
windSizes: [0, 0, 0],
@ -104,6 +109,8 @@ var windController = {
me.clb_winds[2] = waypoint_winds.new("climb", "waypoint", 1);
me.crz_winds[2] = waypoint_winds.new("cruize", "waypoint", 1);
me.des_winds[2] = waypoint_winds.new("descent", "waypoint", 1);
me.hist_winds = waypoint_winds.new("history", "waypoint", 1);
me.read();
},
reset: func() {
@ -217,6 +224,83 @@ var windController = {
me.waypointsChanged();
#me.temporaryFlag[n] = 0;
},
# read - read from hist wind file, create one if it doesn't exist
read: func() {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt";
# create file if it doesn't exist
if (io.stat(path) == nil) {
me.write();
}
var file = io.open(path);
if (file != nil) {
var line = io.readln(file);
var temp_line = split(",", line);
me.hist_winds.wind1.heading = temp_line[0];
me.hist_winds.wind1.magnitude = temp_line[1];
me.hist_winds.wind1.altitude = temp_line[2];
line = io.readln(file);
temp_line = split(",", line);
me.hist_winds.wind2.heading = temp_line[0];
me.hist_winds.wind2.magnitude = temp_line[1];
me.hist_winds.wind2.altitude = temp_line[2];
line = io.readln(file);
temp_line = split(",", line);
me.hist_winds.wind3.heading = temp_line[0];
me.hist_winds.wind3.magnitude = temp_line[1];
me.hist_winds.wind3.altitude = temp_line[2];
line = io.readln(file);
temp_line = split(",", line);
me.hist_winds.wind4.heading = temp_line[0];
me.hist_winds.wind4.magnitude = temp_line[1];
me.hist_winds.wind4.altitude = temp_line[2];
line = io.readln(file);
temp_line = split(",", line);
me.hist_winds.wind5.heading = temp_line[0];
me.hist_winds.wind5.magnitude = temp_line[1];
me.hist_winds.wind5.altitude = temp_line[2];
}
},
# write - write to hist wind file, called whenever winds changed
write: func() {
if (me.des_winds[2] != 0) {
var path = getprop("/sim/fg-home") ~ "/Export/A320SavedWinds.txt";
var file = io.open(path, "wb");
var winds_added = 0;
if (me.fl050_wind[2] != "") {
io.write(file, me.fl050_wind[0] ~ "," ~ me.fl050_wind[1] ~ "," ~ me.fl050_wind[2] ~ "\n");
winds_added += 1;
}
if (me.fl150_wind[2] != "") {
io.write(file, me.fl150_wind[0] ~ "," ~ me.fl150_wind[1] ~ "," ~ me.fl150_wind[2] ~ "\n");
winds_added += 1;
}
if (me.fl250_wind[2] != "") {
io.write(file, me.fl250_wind[0] ~ "," ~ me.fl250_wind[1] ~ "," ~ me.fl250_wind[2] ~ "\n");
winds_added += 1;
}
if (me.flcrz_wind[2] != "") {
io.write(file, me.flcrz_wind[0] ~ "," ~ me.flcrz_wind[1] ~ "," ~ me.flcrz_wind[2] ~ "\n");
winds_added += 1;
}
while (winds_added < 5) {
io.write(file, "-1,-1,\n");
winds_added += 1;
}
io.close(file);
} else {
print("no wind data");
}
},
insertWind: func(plan, index, value, id) {
if (me.windSizes[plan] == index) {

View file

@ -525,8 +525,6 @@ var lskbutton = func(btn, i) {
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);
@ -592,12 +590,16 @@ var rskbutton = func(btn, i) {
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") {
initInputB("R1",i);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") {
if (canvas_mcdu.myHISTWIND[i] == nil) {
canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i);
if (fmgc.FMGCInternal.phase == 0) {
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 {
canvas_mcdu.myHISTWIND[i].reload();
mcdu_message(i, "NOT ALLOWED");
}
setprop("MCDU[" ~ i ~ "]/page", "WINDHIST");
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") {
canvas_mcdu.myDESWIND[i].pushButtonRight(1);
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") {
@ -889,8 +891,8 @@ var rskbutton = func(btn, i) {
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") == "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

@ -81,7 +81,7 @@ var perfAPPRInput = func(key, i) {
mcdu_scratchpad.scratchpads[i].empty();
} else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/vapp-speed-set", 1);
setprop("/FMGC/internal/computed-speeds/vapp_appr", scratchpad);
fmgc.FMGCInternal.vapp_appr = scratchpad;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -71,7 +71,7 @@ var windCLBPage = {
me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][4] = 1;
} else {
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L5 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][4] = 1;
}
} else {
@ -84,7 +84,7 @@ var windCLBPage = {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
@ -97,7 +97,7 @@ var windCLBPage = {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
@ -110,7 +110,7 @@ var windCLBPage = {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
@ -123,7 +123,7 @@ var windCLBPage = {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}

View file

@ -98,7 +98,7 @@ var windCRZPage = {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
@ -111,7 +111,7 @@ var windCRZPage = {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
@ -124,7 +124,7 @@ var windCRZPage = {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
@ -137,7 +137,7 @@ var windCRZPage = {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}
@ -157,7 +157,7 @@ var windCRZPage = {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
@ -170,7 +170,7 @@ var windCRZPage = {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
@ -183,7 +183,7 @@ var windCRZPage = {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
@ -196,7 +196,7 @@ var windCRZPage = {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}

View file

@ -72,7 +72,7 @@ var windDESPage = {
me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][4] = 1;
} else {
me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L5 = ["[ ]/°[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][4] = 1;
}
} else {
@ -85,7 +85,7 @@ var windDESPage = {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L4 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][3] = 1;
}
} else {
@ -98,7 +98,7 @@ var windDESPage = {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L3 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][2] = 1;
}
} else {
@ -111,7 +111,7 @@ var windDESPage = {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"];
me.L2 = ["[ ]°/[ ]/[ ]", nil, "blu"];
me.fontMatrix[0][1] = 1;
}
} else {
@ -124,7 +124,7 @@ var windDESPage = {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.L1 = ["[ ]°/[ ]/[ ]", "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
}
}
@ -137,7 +137,7 @@ var windDESPage = {
me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"];
me.fontMatrix[1][0] = 1;
} else {
me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"];
me.R1 = ["[ ]°/[ ]", "ALTN WIND ", "blu"];
me.fontMatrix[1][0] = 1;
}
} else {

View file

@ -33,7 +33,7 @@ var windHISTPage = {
var whp = {parents:[windHISTPage]};
whp.computer = computer;
whp._setupPageWithData();
whp.updateTmpy();
#whp.updateTmpy();
return whp;
},
del: func() {
@ -42,17 +42,97 @@ var windHISTPage = {
_setupPageWithData: func() {
me.title = "HISTORY WIND";
me.titleColour = "wht";
me.L1 = ["----/---", "", "blu"];
me.L2 = ["----/---", "", "blu"];
me.L3 = ["----/---", "", "blu"];
me.L4 = ["----/---", "", "blu"];
me.L5 = ["----/---", "", "blu"];
var lastIndex = 0;
if (fmgc.windController.hist_winds.wind5.altitude != "") {
lastIndex = 5;
} else if (fmgc.windController.hist_winds.wind4.altitude != "") {
lastIndex = 4;
} else if (fmgc.windController.hist_winds.wind3.altitude != "") {
lastIndex = 3;
} else if (fmgc.windController.hist_winds.wind2.altitude != "") {
lastIndex = 2;
} else if (fmgc.windController.hist_winds.wind1.altitude != "") {
lastIndex = 1;
}
if (fmgc.windController.hist_winds.wind1.altitude != "") {
me.L1 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind1.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind1.magnitude), "", "grn"];
if (lastIndex == 1) {
me.C1 = [" " ~ fmgc.windController.hist_winds.wind1.altitude ~ " CRZ FL", "", "grn"];
} else {
me.C1 = [fmgc.windController.hist_winds.wind1.altitude, "", "grn"];
}
fmgc.windController.hist_winds.wind1.set = 1;
} else {
me.L1 = ["", "", "grn"];
me.C1 = ["", "", "grn"];
#me.L1 = ["----/---", "", "grn"];
#me.C1 = ["FL050", "", "grn"];
}
if (fmgc.windController.hist_winds.wind2.altitude != "") {
me.L2 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind2.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind2.magnitude), "", "grn"];
if (lastIndex == 2) {
me.C2 = [" " ~ fmgc.windController.hist_winds.wind2.altitude ~ " CRZ FL", "", "grn"];
} else {
me.C2 = [fmgc.windController.hist_winds.wind2.altitude, "", "grn"];
}
fmgc.windController.hist_winds.wind2.set = 1;
} else {
me.L2 = ["", "", "grn"];
me.C2 = ["", "", "grn"];
#me.L2 = ["----/---", "", "grn"];
#me.C2 = ["FL150", "", "grn"];
}
if (fmgc.windController.hist_winds.wind3.altitude != "") {
me.L3 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind3.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind3.magnitude), "", "grn"];
if (lastIndex == 3) {
me.C3 = [" " ~ fmgc.windController.hist_winds.wind3.altitude ~ " CRZ FL", "", "grn"];
} else {
me.C3 = [fmgc.windController.hist_winds.wind3.altitude, "", "grn"];
}
fmgc.windController.hist_winds.wind3.set = 1;
} else {
me.L3 = ["", "", "grn"];
me.C3 = ["", "", "grn"];
#me.L3 = ["----/---", "", "grn"];
#me.C3 = ["FL250", "", "grn"];
}
if (fmgc.windController.hist_winds.wind4.altitude != "") {
me.L4 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind4.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind4.magnitude), "", "grn"];
if (lastIndex == 4) {
me.C4 = [" " ~ fmgc.windController.hist_winds.wind4.altitude ~ " CRZ FL", "", "grn"];
} else {
me.C4 = [fmgc.windController.hist_winds.wind4.altitude, "", "grn"];
}
fmgc.windController.hist_winds.wind4.set = 1;
} else {
me.L4 = ["", "", "grn"];
me.C4 = ["", "", "grn"];
#me.L4 = ["----/---", "", "grn"];
#me.C4 = [" FL--- CRZ FL", "", "grn"];
}
if (fmgc.windController.hist_winds.wind5.altitude != "") {
me.L5 = [sprintf("%03d°/", fmgc.windController.hist_winds.wind5.heading) ~ sprintf("%03d", fmgc.windController.hist_winds.wind5.magnitude), "", "grn"];
if (lastIndex == 5) {
me.C5 = [" " ~ fmgc.windController.hist_winds.wind5.altitude ~ " CRZ FL", "", "grn"];
} else {
me.C5 = [fmgc.windController.hist_winds.wind5.altitude, "", "grn"];
}
fmgc.windController.hist_winds.wind5.set = 1;
} else {
me.L5 = ["", "", "grn"];
me.C5 = ["", "", "grn"];
#me.L5 = ["----/---", "", "grn"];
#me.C5 = ["FL370", "", "grn"];
}
me.L6 = [" CLIMB WIND", "", "wht"];
me.C1 = ["FL050", "", "blu"];
me.C2 = ["FL150", "", "blu"];
me.C3 = ["FL250", "", "blu"];
me.C4 = [" FL--- CRZ FL", "", "blu"];
me.C5 = ["FL370", "", "blu"];
me.R6 = ["SELECT ", "", "amb"];
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
@ -60,40 +140,87 @@ var windHISTPage = {
me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]];
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
makeTmpy: func() {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
}
},
updateTmpy: func() {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
me.L1[2] = "yel";
me.L2[2] = "yel";
me.L3[2] = "yel";
me.L4[2] = "yel";
me.L5[2] = "yel";
me.C1[2] = "yel";
me.C2[2] = "yel";
me.C3[2] = "yel";
me.C4[2] = "yel";
me.C5[2] = "yel";
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
} else {
me.L1[2] = "blu";
me.L2[2] = "blu";
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);
}
},
# makeTmpy: func() {
# if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer);
# }
# },
# updateTmpy: func() {
# if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
# me.L1[2] = "yel";
# me.L2[2] = "yel";
# me.L3[2] = "yel";
# me.L4[2] = "yel";
# me.L5[2] = "yel";
# me.C1[2] = "yel";
# me.C2[2] = "yel";
# me.C3[2] = "yel";
# me.C4[2] = "yel";
# me.C5[2] = "yel";
# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
# } else {
# me.L1[2] = "blu";
# me.L2[2] = "blu";
# 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);
# }
# },
reload: func() {
me._setupPageWithData();
me.updateTmpy();
#me.updateTmpy();
},
pushButtonRight: func(index) {
if (index == 6) {
var hist_winds = fmgc.windController.hist_winds;
if (hist_winds.wind1.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set or hist_winds.wind2.set) {
if (hist_winds.wind1.set) {
fmgc.windController.clb_winds[2].wind1.heading = hist_winds.wind1.heading;
fmgc.windController.clb_winds[2].wind1.magnitude = hist_winds.wind1.magnitude;
fmgc.windController.clb_winds[2].wind1.altitude = hist_winds.wind1.altitude;
fmgc.windController.clb_winds[2].wind1.set = 1;
}
if (hist_winds.wind2.set) {
fmgc.windController.clb_winds[2].wind2.heading = hist_winds.wind2.heading;
fmgc.windController.clb_winds[2].wind2.magnitude = hist_winds.wind2.magnitude;
fmgc.windController.clb_winds[2].wind2.altitude = hist_winds.wind2.altitude;
fmgc.windController.clb_winds[2].wind2.set = 1;
}
if (hist_winds.wind3.set) {
fmgc.windController.clb_winds[2].wind3.heading = hist_winds.wind3.heading;
fmgc.windController.clb_winds[2].wind3.magnitude = hist_winds.wind3.magnitude;
fmgc.windController.clb_winds[2].wind3.altitude = hist_winds.wind3.altitude;
fmgc.windController.clb_winds[2].wind3.set = 1;
}
if (hist_winds.wind4.set) {
fmgc.windController.clb_winds[2].wind4.heading = hist_winds.wind4.heading;
fmgc.windController.clb_winds[2].wind4.magnitude = hist_winds.wind4.magnitude;
fmgc.windController.clb_winds[2].wind4.altitude = hist_winds.wind4.altitude;
fmgc.windController.clb_winds[2].wind4.set = 1;
}
if (hist_winds.wind5.set) {
fmgc.windController.clb_winds[2].wind5.heading = hist_winds.wind5.heading;
fmgc.windController.clb_winds[2].wind5.magnitude = hist_winds.wind5.magnitude;
fmgc.windController.clb_winds[2].wind5.altitude = hist_winds.wind5.altitude;
fmgc.windController.clb_winds[2].wind5.set = 1;
}
if (canvas_mcdu.myCLBWIND[me.computer] == nil) {
canvas_mcdu.myCLBWIND[me.computer] = windCLBPage.new(me.computer);
} else {
canvas_mcdu.myCLBWIND[me.computer].reload();
}
setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCLB");
} else {
mcdu_message(me.computer, "NO WINDS");
}
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}
}
};