1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2020-07-30 14:41:35 +01:00
commit cb46f306b9
12 changed files with 296 additions and 194 deletions

View file

@ -180,10 +180,6 @@ var activate_twice = props.globals.getNode("/FMGC/internal/activate-twice", 1);
# APPR PERF
var dest_qnh = props.globals.getNode("/FMGC/internal/dest-qnh", 1);
var dest_temp = props.globals.getNode("/FMGC/internal/dest-temp", 1);
var dest_mag = props.globals.getNode("/FMGC/internal/dest-mag", 1);
var dest_wind = props.globals.getNode("/FMGC/internal/dest-wind", 1);
# var grnd_mag = props.globals.getNode("/FMGC/internal/dest-mag-grnd", 1);
# var grnd_wind = props.globals.getNode("/FMGC/internal/dest-wind-grnd", 1);
var vapp_speed_set = props.globals.getNode("/FMGC/internal/vapp-speed-set", 1);
var final = props.globals.getNode("/FMGC/internal/final", 1);
var radio = props.globals.getNode("/FMGC/internal/radio", 1);
@ -3632,12 +3628,20 @@ var canvas_MCDU_base = {
}
me["Simple_L3S"].setText("MAG WIND");
if (dest_mag.getValue() != -1 and dest_wind.getValue() != -1) {
me["Simple_L3"].setText(sprintf("%03.0fg", dest_mag.getValue()) ~ sprintf("/%.0f", dest_wind.getValue()));
# } else if (grnd_mag.getValue() != -1 and grnd_wind.getValue() != -1) {
# me["Simple_L3"].setText(sprintf("%03.0fg", grnd_mag.getValue()) ~ sprintf("/%.0f", grnd_wind.getValue()));
if (fmgc.FMGCInternal.destMagSet and fmgc.FMGCInternal.destWindSet) {
me["Simple_L3"].setText(sprintf("%03.0fg", fmgc.FMGCInternal.destMag) ~ sprintf("/%.0f", fmgc.FMGCInternal.destWind));
me["Simple_L3"].setFontSize(normal);
} else {
me["Simple_L3"].setText("---g/---");;
me["Simple_L3"].setFontSize(small);
if (myDESWIND[i] != nil and myDESWIND[i].returnGRND() != nil) {
var result = myDESWIND[i].returnGRND();
me["Simple_L3"].setText(sprintf("%03.0fg", result[0]) ~ sprintf("/%.0f", result[1]));
} else if (myDESWIND[math.abs(i-1)] != nil and myDESWIND[math.abs(i-1)].returnGRND() != nil) {
var result = myDESWIND[math.abs(i-1)].returnGRND();
me["Simple_L3"].setText(sprintf("%03.0fg", result[0]) ~ sprintf("/%.0f", result[1]));
} else {
me["Simple_L3"].setText("---g/---");
}
}
me["Simple_L4S"].setText("TRANS FL");

View file

@ -140,14 +140,22 @@ var FMGCInternal = {
vmo_mmo: 0,
# PERF
transAlt: 18000,
transAltSet: 0,
# PERF TO
v1: 0,
v1set: 0,
vr: 0,
vrset: 0,
v2: 0,
v2set: 0,
transAlt: 18000,
transAltSet: 0,
# PERF APPR
destMag: 0,
destMagSet: 0,
destWind: 0,
destWindSet: 0,
# INIT A
altAirport: "",
@ -607,7 +615,6 @@ var masterFMGC = maketimer(0.2, func {
tow = getprop("/FMGC/internal/tow") or 0;
lw = getprop("/FMGC/internal/lw") or 0;
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
dest_wind = getprop("/FMGC/internal/dest-wind") or 0;
# current speeds
clean = 2 * weight_lbs * 0.45359237 + 85;
@ -634,12 +641,12 @@ var masterFMGC = maketimer(0.2, func {
}
setprop("/FMGC/internal/computed-speeds/vls", vls);
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (dest_wind < 5) {
if (fmgc.FMGCInternal.destWind < 5) {
vapp = vls + 5;
} else if (dest_wind > 15) {
} else if (fmgc.FMGCInternal.destWind > 15) {
vapp = vls + 15;
} else {
vapp = vls + dest_wind;
vapp = vls + fmgc.FMGCInternal.destWind;
}
setprop("/FMGC/internal/computed-speeds/vapp", vapp);
}
@ -702,12 +709,12 @@ var masterFMGC = maketimer(0.2, func {
}
setprop("/FMGC/internal/computed-speeds/vls_appr", vls_appr);
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (dest_wind < 5) {
if (fmgc.FMGCInternal.destWind < 5) {
vapp_appr = vls_appr + 5;
} else if (dest_wind > 15) {
} else if (fmgc.FMGCInternal.destWind > 15) {
vapp_appr = vls_appr + 15;
} else {
vapp_appr = vls_appr + dest_wind;
vapp_appr = vls_appr + fmgc.FMGCInternal.destWind;
}
setprop("/FMGC/internal/computed-speeds/vapp_appr", vapp_appr);
}
@ -848,6 +855,7 @@ var reset_FMGC = func {
FMGCinit();
flightPlanController.reset();
windController.reset();
windController.init();
mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1);

View file

@ -4,17 +4,19 @@
var wind = {
new: func() {
var w = {parents: [wind]};
w.heading = 0;
w.magnitude = 0;
w.heading = -1;
w.magnitude = -1;
w.altitude = "";
w.set = 0;
return w;
},
newcopy: func(heading, magnitude, altitude) {
newcopy: func(heading, magnitude, altitude, set) {
var w = {parents: [wind]};
w.heading = heading;
w.magnitude = magnitude;
w.altitude = altitude;
w.set = set;
return w;
}
};
@ -22,15 +24,17 @@ var wind = {
var alt_wind = {
new: func() {
var aw = {parents: [alt_wind]};
aw.heading = 0;
aw.magnitude = 0;
aw.heading = -1;
aw.magnitude = -1;
aw.set = 0;
return aw;
},
newcopy: func(heading, magnitude) {
newcopy: func(heading, magnitude, set) {
var aw = {parents: [alt_wind]};
aw.heading = heading ;
aw.heading = heading;
aw.magnitude = magnitude;
aw.set = set;
return aw;
}
};
@ -38,15 +42,17 @@ var alt_wind = {
var sat_temp = {
new: func() {
var st = {parents: [sat_temp]};
st.temp = 0;
st.temp = -999;
st.altitude = "";
st.set = 0;
return st;
},
newcopy: func(temp, altitude) {
newcopy: func(temp, altitude, set) {
var st = {parents: [sat_temp]};
st.temp = temp;
st.altitude = altitude;
st.set = set;
return st;
}
};
@ -117,17 +123,23 @@ var windController = {
me.windSizes[n] = 0;
},
resetDesWinds: func() {
me.des_winds[0] = 0;
me.des_winds[1] = 0;
me.des_winds[2] = waypoint_winds.new("descent", "waypoint", 1);
},
copyClbWind: func(n) {
var id = me.clb_winds[n].id;
var type = me.clb_winds[n].type;
var includeWind = me.clb_winds[n].includeWind;
var wind1 = wind.newcopy(me.clb_winds[n].wind1.heading, me.clb_winds[n].wind1.magnitude, me.clb_winds[n].wind1.altitude);
var wind2 = wind.newcopy(me.clb_winds[n].wind2.heading, me.clb_winds[n].wind2.magnitude, me.clb_winds[n].wind2.altitude);
var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude);
var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude);
var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude);
var sat1 = sat_temp.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude);
var alt1 = alt_wind.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude);
var wind1 = wind.newcopy(me.clb_winds[n].wind1.heading, me.clb_winds[n].wind1.magnitude, me.clb_winds[n].wind1.altitude, me.clb_winds[n].wind1.set);
var wind2 = wind.newcopy(me.clb_winds[n].wind2.heading, me.clb_winds[n].wind2.magnitude, me.clb_winds[n].wind2.altitude, me.clb_winds[n].wind2.set);
var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude, me.clb_winds[n].wind3.set);
var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude, me.clb_winds[n].wind4.set);
var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude, me.clb_winds[n].wind5.set);
var sat1 = sat_temp.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude, me.clb_winds[n].sat1.set);
var alt1 = alt_wind.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude, me.clb_winds[n].alt1.set);
return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
},
@ -135,13 +147,13 @@ var windController = {
var id = me.crz_winds[n].id;
var type = me.crz_winds[n].type;
var includeWind = me.crz_winds[n].includeWind;
var wind1 = wind.newcopy(me.crz_winds[n].wind1.heading, me.crz_winds[n].wind1.magnitude, me.crz_winds[n].wind1.altitude);
var wind2 = wind.newcopy(me.crz_winds[n].wind2.heading, me.crz_winds[n].wind2.magnitude, me.crz_winds[n].wind2.altitude);
var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude);
var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude);
var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude);
var sat1 = sat_temp.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude);
var alt1 = alt_wind.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude);
var wind1 = wind.newcopy(me.crz_winds[n].wind1.heading, me.crz_winds[n].wind1.magnitude, me.crz_winds[n].wind1.altitude, me.crz_winds[n].wind1.set);
var wind2 = wind.newcopy(me.crz_winds[n].wind2.heading, me.crz_winds[n].wind2.magnitude, me.crz_winds[n].wind2.altitude, me.crz_winds[n].wind2.set);
var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude, me.crz_winds[n].wind3.set);
var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude, me.crz_winds[n].wind4.set);
var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude, me.crz_winds[n].wind5.set);
var sat1 = sat_temp.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude, me.crz_winds[n].sat1.set);
var alt1 = alt_wind.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude, me.crz_winds[n].alt1.set);
return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
},
@ -149,13 +161,13 @@ var windController = {
var id = me.des_winds[n].id;
var type = me.des_winds[n].type;
var includeWind = me.des_winds[n].includeWind;
var wind1 = wind.newcopy(me.des_winds[n].wind1.heading, me.des_winds[n].wind1.magnitude, me.des_winds[n].wind1.altitude);
var wind2 = wind.newcopy(me.des_winds[n].wind2.heading, me.des_winds[n].wind2.magnitude, me.des_winds[n].wind2.altitude);
var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude);
var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude);
var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude);
var sat1 = sat_temp.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude);
var alt1 = alt_wind.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude);
var wind1 = wind.newcopy(me.des_winds[n].wind1.heading, me.des_winds[n].wind1.magnitude, me.des_winds[n].wind1.altitude, me.des_winds[n].wind1.set);
var wind2 = wind.newcopy(me.des_winds[n].wind2.heading, me.des_winds[n].wind2.magnitude, me.des_winds[n].wind2.altitude, me.des_winds[n].wind2.set);
var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude, me.des_winds[n].wind3.set);
var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude, me.des_winds[n].wind4.set);
var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude, me.des_winds[n].wind5.set);
var sat1 = sat_temp.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude, me.des_winds[n].sat1.set);
var alt1 = alt_wind.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude, me.des_winds[n].alt1.set);
return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1);
},
@ -165,13 +177,13 @@ var windController = {
var id = me.winds[n][i].id;
var type = me.winds[n][i].type;
var includeWind = me.winds[n][i].includeWind;
var wind1 = wind.newcopy(me.winds[n][i].wind1.heading, me.winds[n][i].wind1.magnitude, me.winds[n][i].wind1.altitude);
var wind2 = wind.newcopy(me.winds[n][i].wind2.heading, me.winds[n][i].wind2.magnitude, me.winds[n][i].wind2.altitude);
var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude);
var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude);
var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude);
var sat1 = sat_temp.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude);
var alt1 = alt_wind.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude);
var wind1 = wind.newcopy(me.winds[n][i].wind1.heading, me.winds[n][i].wind1.magnitude, me.winds[n][i].wind1.altitude, me.winds[n][i].wind1.set);
var wind2 = wind.newcopy(me.winds[n][i].wind2.heading, me.winds[n][i].wind2.magnitude, me.winds[n][i].wind2.altitude, me.winds[n][i].wind2.set);
var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude, me.winds[n][i].wind3.set);
var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude, me.winds[n][i].wind4.set);
var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude, me.winds[n][i].wind5.set);
var sat1 = sat_temp.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude, me.winds[n][i].sat1.set);
var alt1 = alt_wind.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude, me.winds[n][i].alt1.set);
append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1));
}
return tempWind;

View file

@ -68,7 +68,7 @@ var fuelPredInput = func(key, i) {
} else {
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") {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");

View file

@ -175,6 +175,7 @@ var initInputA = func(key, i) {
fmgc.FMGCInternal.arrApt = "";
fmgc.FMGCInternal.toFromSet = 0;
fmgc.FMGCNodes.toFromSet.setValue(0);
fmgc.windController.resetDesWinds();
setprop("/FMGC/internal/align-ref-lat", 0);
setprop("/FMGC/internal/align-ref-long", 0);
setprop("/FMGC/internal/align-ref-lat-edit", 0);
@ -184,9 +185,7 @@ var initInputA = func(key, i) {
setprop("/FMGC/internal/fuel-calculating", 1);
}
fmgc.flightPlanController.reset(2);
fmgc.windController.reset(2);
fmgc.flightPlanController.init();
fmgc.windController.init();
mcdu_scratchpad.scratchpads[i].empty();
#} else if (scratchpad == "") {
#fmgc.FMGCInternal.altSelected = 0;
@ -200,6 +199,9 @@ var initInputA = func(key, i) {
var tos = size(fromto[1]);
if (froms == 4 and tos == 4) {
#route
if (fmgc.FMGCInternal.toFromSet == 1 and fmgc.FMGCInternal.arrApt != fromto[1]) {
fmgc.windController.resetDesWinds();
}
fmgc.FMGCInternal.depApt = fromto[0];
fmgc.FMGCInternal.arrApt = fromto[1];
fmgc.FMGCInternal.toFromSet = 1;

View file

@ -71,7 +71,7 @@ var initInputB = func(key, i) {
} else {
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") {
setprop("/FMGC/internal/alt-fuel", 0.0);
setprop("/FMGC/internal/alt-time", "0000");

View file

@ -172,10 +172,10 @@ var MCDU_reset = func(i) {
# APPR PERF
setprop("/FMGC/internal/dest-qnh", -1);
setprop("/FMGC/internal/dest-temp", -999);
setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1);
# setprop("/FMGC/internal/dest-mag-grnd", -1);
# setprop("/FMGC/internal/dest-wind-grnd", -1);
fmgc.FMGCInternal.destMag = 0;
fmgc.FMGCInternal.destMagSet = 0;
fmgc.FMGCInternal.destWind = 0;
fmgc.FMGCInternal.destWindSet = 0;
setprop("/FMGC/internal/vapp-speed-set", 0);
setprop("/FMGC/internal/final", "");
setprop("/FMGC/internal/baro", 99999);

View file

@ -30,8 +30,10 @@ var perfAPPRInput = func(key, i) {
} else if (key == "L3") {
var tfs = size(scratchpad);
if (scratchpad == "CLR") {
setprop("/FMGC/internal/dest-mag", -1);
setprop("/FMGC/internal/dest-wind", -1);
fmgc.FMGCInternal.destMag = 0;
fmgc.FMGCInternal.destMagSet = 0;
fmgc.FMGCInternal.destWind = 0;
fmgc.FMGCInternal.destWindSet = 0;
mcdu_scratchpad.scratchpads[i].empty();
} else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) {
var weather = split("/", scratchpad);
@ -39,8 +41,10 @@ var perfAPPRInput = func(key, i) {
var winds = size(weather[1]);
if (mags >= 1 and mags <= 3 and winds >= 1 and winds <= 3) {
if (num(weather[0]) != nil and num(weather[1]) != nil and int(weather[0]) >= 0 and int(weather[0]) <= 360 and int(weather[1]) >= 0 and int(weather[1]) <= 200) {
setprop("/FMGC/internal/dest-mag", weather[0]);
setprop("/FMGC/internal/dest-wind", weather[1]);
fmgc.FMGCInternal.destMag = weather[0];
fmgc.FMGCInternal.destMagSet = 1;
fmgc.FMGCInternal.destWind = weather[1];
fmgc.FMGCInternal.destWindSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
fmgc.updateARPT();
} else {

View file

@ -154,15 +154,17 @@ var vertRev = {
fmgc.windController.accessPage[me.computer] = "VERTREV";
setprop("MCDU[" ~ me.computer ~ "]/page", "WINDDES");
} else if (me.wp.wp_role == nil and me.wp.wp_type == "navaid") {
if (canvas_mcdu.myCRZWIND[me.computer] == nil) {
cur_location = 0;
for (i = 0; i < size(fmgc.windController.nav_indicies[me.plan]); i += 1) {
if (fmgc.windController.nav_indicies[me.plan][i] == me.index) {
cur_location = i;
}
cur_location = 0;
for (i = 0; i < size(fmgc.windController.nav_indicies[me.plan]); i += 1) {
if (fmgc.windController.nav_indicies[me.plan][i] == me.index) {
cur_location = i;
}
}
if (canvas_mcdu.myCRZWIND[me.computer] == nil) {
canvas_mcdu.myCRZWIND[me.computer] = windCRZPage.new(me.computer, me.wp, cur_location);
} else {
canvas_mcdu.myCRZWIND[me.computer].waypoint = me.wp;
canvas_mcdu.myCRZWIND[me.computer].cur_location = cur_location;
canvas_mcdu.myCRZWIND[me.computer].reload();
}
fmgc.windController.accessPage[me.computer] = "VERTREV";

View file

@ -53,17 +53,13 @@ var windCLBPage = {
computer_temp = me.computer;
}
#debug.dump(fmgc.windController.clb_winds[0]);
#debug.dump(fmgc.windController.clb_winds[1]);
#debug.dump(fmgc.windController.clb_winds[2]);
if (fmgc.windController.clb_winds[computer_temp] == 0 or fmgc.windController.clb_winds[computer_temp].wind1.altitude == "") {
if (fmgc.windController.clb_winds[computer_temp] == 0 or !fmgc.windController.clb_winds[computer_temp].wind1.set) {
me.items = 1;
} else if (fmgc.windController.clb_winds[computer_temp].wind2.altitude == "") {
} else if (!fmgc.windController.clb_winds[computer_temp].wind2.set) {
me.items = 2;
} else if (fmgc.windController.clb_winds[computer_temp].wind3.altitude == "") {
} else if (!fmgc.windController.clb_winds[computer_temp].wind3.set) {
me.items = 3;
} else if (fmgc.windController.clb_winds[computer_temp].wind4.altitude == "") {
} else if (!fmgc.windController.clb_winds[computer_temp].wind4.set) {
me.items = 4;
} else {
me.items = 5;
@ -71,7 +67,7 @@ var windCLBPage = {
if (me.items >= 5) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind5;
if (windStore.altitude != "") {
if (windStore.set) {
me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][4] = 1;
} else {
@ -84,7 +80,7 @@ var windCLBPage = {
if (me.items >= 4) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind4;
if (windStore.altitude != "") {
if (windStore.set) {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
@ -97,7 +93,7 @@ var windCLBPage = {
if (me.items >= 3) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind3;
if (windStore.altitude != "") {
if (windStore.set) {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
@ -110,7 +106,7 @@ var windCLBPage = {
if (me.items >= 2) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind2;
if (windStore.altitude != "") {
if (windStore.set) {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
@ -123,7 +119,7 @@ var windCLBPage = {
if (me.items >= 1) {
var windStore = fmgc.windController.clb_winds[computer_temp].wind1;
if (windStore.altitude != "") {
if (windStore.set) {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
@ -193,7 +189,10 @@ var windCLBPage = {
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) {
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
if (size(winds) < 3) {
mcdu_message(me.computer, "NOT ALLOWED");
# not implemented yet
} 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[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))) {
@ -202,27 +201,31 @@ var windCLBPage = {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (index == 5) {
fmgc.windController.clb_winds[computer_temp].wind5.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind5.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind5.altitude = winds[2];
fmgc.windController.clb_winds[computer_temp].wind5.set = 1;
} else if (index == 4) {
fmgc.windController.clb_winds[computer_temp].wind4.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind4.altitude = winds[2];
fmgc.windController.clb_winds[computer_temp].wind4.set = 1;
} else if (index == 3) {
fmgc.windController.clb_winds[computer_temp].wind3.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind3.altitude = winds[2];
fmgc.windController.clb_winds[computer_temp].wind3.set = 1;
} else if (index == 2) {
fmgc.windController.clb_winds[computer_temp].wind2.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind2.altitude = winds[2];
fmgc.windController.clb_winds[computer_temp].wind2.set = 1;
} else if (index == 1) {
fmgc.windController.clb_winds[computer_temp].wind1.heading = winds[0];
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = winds[1];
fmgc.windController.clb_winds[computer_temp].wind1.altitude = winds[2];
fmgc.windController.clb_winds[computer_temp].wind1.set = 1;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
if (me.items == index and index != 5) {
@ -240,47 +243,60 @@ var windCLBPage = {
}
if (me.items == index) {
if (index == 5) {
fmgc.windController.clb_winds[computer_temp].wind5.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind5.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind5.heading = -1;
fmgc.windController.clb_winds[computer_temp].wind5.magnitude = -1;
fmgc.windController.clb_winds[computer_temp].wind5.altitude = "";
fmgc.windController.clb_winds[computer_temp].wind5.set = 0;
} else if (index == 4) {
fmgc.windController.clb_winds[computer_temp].wind4.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind4.heading = -1;
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = -1;
fmgc.windController.clb_winds[computer_temp].wind4.altitude = "";
fmgc.windController.clb_winds[computer_temp].wind4.set = 0;
} else if (index == 3) {
fmgc.windController.clb_winds[computer_temp].wind3.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind3.heading = -1;
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = -1;
fmgc.windController.clb_winds[computer_temp].wind3.altitude = "";
fmgc.windController.clb_winds[computer_temp].wind3.set = 0;
} else if (index == 2) {
fmgc.windController.clb_winds[computer_temp].wind2.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind2.heading = -1;
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = -1;
fmgc.windController.clb_winds[computer_temp].wind2.altitude = "";
fmgc.windController.clb_winds[computer_temp].wind2.set = 0;
} else if (index == 1) {
fmgc.windController.clb_winds[computer_temp].wind1.heading = 0;
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = 0;
fmgc.windController.clb_winds[computer_temp].wind1.heading = -1;
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = -1;
fmgc.windController.clb_winds[computer_temp].wind1.altitude = "";
fmgc.windController.clb_winds[computer_temp].wind1.set = 0;
}
} else {
if (index <= 1) {
fmgc.windController.clb_winds[computer_temp].wind1.heading = fmgc.windController.clb_winds[computer_temp].wind2.heading;
fmgc.windController.clb_winds[computer_temp].wind1.magnitude = fmgc.windController.clb_winds[computer_temp].wind2.magnitude;
fmgc.windController.clb_winds[computer_temp].wind1.altitude = fmgc.windController.clb_winds[computer_temp].wind2.altitude;
fmgc.windController.clb_winds[computer_temp].wind1.set = fmgc.windController.clb_winds[computer_temp].wind2.set;
}
if (index <= 2) {
fmgc.windController.clb_winds[computer_temp].wind2.heading = fmgc.windController.clb_winds[computer_temp].wind3.heading;
fmgc.windController.clb_winds[computer_temp].wind2.magnitude = fmgc.windController.clb_winds[computer_temp].wind3.magnitude;
fmgc.windController.clb_winds[computer_temp].wind2.altitude = fmgc.windController.clb_winds[computer_temp].wind3.altitude;
fmgc.windController.clb_winds[computer_temp].wind2.set = fmgc.windController.clb_winds[computer_temp].wind3.set;
}
if (index <= 3) {
fmgc.windController.clb_winds[computer_temp].wind3.heading = fmgc.windController.clb_winds[computer_temp].wind4.heading;
fmgc.windController.clb_winds[computer_temp].wind3.magnitude = fmgc.windController.clb_winds[computer_temp].wind4.magnitude;
fmgc.windController.clb_winds[computer_temp].wind3.altitude = fmgc.windController.clb_winds[computer_temp].wind4.altitude;
fmgc.windController.clb_winds[computer_temp].wind3.set = fmgc.windController.clb_winds[computer_temp].wind4.set;
}
if (index <= 4) {
fmgc.windController.clb_winds[computer_temp].wind4.heading = fmgc.windController.clb_winds[computer_temp].wind5.heading;
fmgc.windController.clb_winds[computer_temp].wind4.magnitude = fmgc.windController.clb_winds[computer_temp].wind5.magnitude;
fmgc.windController.clb_winds[computer_temp].wind4.altitude = fmgc.windController.clb_winds[computer_temp].wind5.altitude;
}
fmgc.windController.clb_winds[computer_temp].wind4.set = fmgc.windController.clb_winds[computer_temp].wind5.set;
}
fmgc.windController.clb_winds[computer_temp].wind5.heading = -1;
fmgc.windController.clb_winds[computer_temp].wind5.magnitude = -1;
fmgc.windController.clb_winds[computer_temp].wind5.altitude = "";
fmgc.windController.clb_winds[computer_temp].wind5.set = 0;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me.items -= 1;

View file

@ -66,27 +66,23 @@ var windCRZPage = {
computer_temp = me.computer;
}
#debug.dump(fmgc.windController.crz_winds[0]);
#debug.dump(fmgc.windController.crz_winds[1]);
#debug.dump(fmgc.windController.crz_winds[2]);
if (me.singleCRZ == 1) {
if (fmgc.windController.crz_winds[computer_temp] == 0 or fmgc.windController.crz_winds[computer_temp].wind1.altitude == "") {
if (fmgc.windController.crz_winds[computer_temp] == 0 or !fmgc.windController.crz_winds[computer_temp].wind1.set) {
me.items = 1;
} else if (fmgc.windController.crz_winds[computer_temp].wind2.altitude == "") {
} else if (!fmgc.windController.crz_winds[computer_temp].wind2.set) {
me.items = 2;
} else if (fmgc.windController.crz_winds[computer_temp].wind3.altitude == "") {
} else if (!fmgc.windController.crz_winds[computer_temp].wind3.set) {
me.items = 3;
} else {
me.items = 4;
}
} else {
me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location];
if (size(fmgc.windController.winds[computer_temp]) == 0 or fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude == "") {
if (size(fmgc.windController.winds[computer_temp]) == 0 or !fmgc.windController.winds[computer_temp][me.match_location].wind1.set) {
me.items = 1;
} else if (fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude == "") {
} else if (!fmgc.windController.winds[computer_temp][me.match_location].wind2.set) {
me.items = 2;
} else if (fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude == "") {
} else if (!fmgc.windController.winds[computer_temp][me.match_location].wind3.set) {
me.items = 3;
} else {
me.items = 4;
@ -97,7 +93,7 @@ var windCRZPage = {
if (me.singleCRZ == 1) {
if (me.items >= 4) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind4;
if (windStore.altitude != "") {
if (windStore.set) {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
@ -110,7 +106,7 @@ var windCRZPage = {
if (me.items >= 3) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind3;
if (windStore.altitude != "") {
if (windStore.set) {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
@ -123,7 +119,7 @@ var windCRZPage = {
if (me.items >= 2) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind2;
if (windStore.altitude != "") {
if (windStore.set) {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
@ -136,7 +132,7 @@ var windCRZPage = {
if (me.items >= 1) {
var windStore = fmgc.windController.crz_winds[computer_temp].wind1;
if (windStore.altitude != "") {
if (windStore.set) {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
@ -146,7 +142,7 @@ var windCRZPage = {
}
var windStore = fmgc.windController.crz_winds[computer_temp].sat1;
if (windStore.altitude != "") {
if (windStore.set) {
me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"];
me.fontMatrix[0][4] = 1;
} else {
@ -156,7 +152,7 @@ var windCRZPage = {
} else {
if (me.items >= 4) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind4;
if (windStore.altitude != "") {
if (windStore.set) {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
@ -169,7 +165,7 @@ var windCRZPage = {
if (me.items >= 3) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind3;
if (windStore.altitude != "") {
if (windStore.set) {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
@ -182,7 +178,7 @@ var windCRZPage = {
if (me.items >= 2) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind2;
if (windStore.altitude != "") {
if (windStore.set) {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
@ -195,7 +191,7 @@ var windCRZPage = {
if (me.items >= 1) {
var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind1;
if (windStore.altitude != "") {
if (windStore.set) {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
@ -205,7 +201,7 @@ var windCRZPage = {
}
var windStore = fmgc.windController.winds[computer_temp][me.match_location].sat1;
if (windStore.altitude != "") {
if (windStore.set) {
me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"];
me.fontMatrix[0][4] = 1;
} else {
@ -283,7 +279,8 @@ var windCRZPage = {
} else if (index == 5) {
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);
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
(num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) {
me.makeTmpy();
@ -291,13 +288,14 @@ var windCRZPage = {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
fmgc.windController.crz_winds[computer_temp].sat1.temp = winds[0];
fmgc.windController.crz_winds[computer_temp].sat1.altitude = winds[1];
fmgc.windController.crz_winds[computer_temp].sat1.set = 1;
} else {
fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].sat1.set = 1;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
@ -310,14 +308,9 @@ var windCRZPage = {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
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 = "";
}
fmgc.windController.crz_winds[computer_temp].sat1.temp = -999;
fmgc.windController.crz_winds[computer_temp].sat1.altitude = "";
fmgc.windController.crz_winds[computer_temp].sat1.set = 0;
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
me.updateTmpy();
@ -327,7 +320,10 @@ var windCRZPage = {
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) {
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
if (size(winds) < 3) {
mcdu_message(me.computer, "NOT ALLOWED");
# not implemented yet
} 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[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))) {
@ -336,42 +332,49 @@ var windCRZPage = {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
if (index == 4) {
fmgc.windController.crz_winds[computer_temp].wind4.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind4.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind4.altitude = winds[2];
fmgc.windController.crz_winds[computer_temp].wind4.set = 1;
} else if (index == 3) {
fmgc.windController.crz_winds[computer_temp].wind3.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind3.altitude = winds[2];
fmgc.windController.crz_winds[computer_temp].wind3.set = 1;
} else if (index == 2) {
fmgc.windController.crz_winds[computer_temp].wind2.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind2.altitude = winds[2];
fmgc.windController.crz_winds[computer_temp].wind2.set = 1;
} else if (index == 1) {
fmgc.windController.crz_winds[computer_temp].wind1.heading = winds[0];
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = winds[1];
fmgc.windController.crz_winds[computer_temp].wind1.altitude = winds[2];
fmgc.windController.crz_winds[computer_temp].wind1.set = 1;
}
} else {
if (index == 4) {
fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = winds[2];
fmgc.windController.winds[computer_temp][me.match_location].wind4.set = 1;
} else if (index == 3) {
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = winds[2];
fmgc.windController.winds[computer_temp][me.match_location].wind3.set = 1;
} else if (index == 2) {
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = winds[2];
fmgc.windController.winds[computer_temp][me.match_location].wind2.set = 1;
} else if (index == 1) {
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = winds[0];
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = winds[1];
fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = winds[2];
fmgc.windController.winds[computer_temp][me.match_location].wind1.set = 1;
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();
@ -388,78 +391,99 @@ var windCRZPage = {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
#print(computer_temp);
if (me.singleCRZ == 1) {
if (me.items == index) {
if (index == 4) {
fmgc.windController.crz_winds[computer_temp].wind4.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind4.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind4.heading = -1;
fmgc.windController.crz_winds[computer_temp].wind4.magnitude = -1;
fmgc.windController.crz_winds[computer_temp].wind4.altitude = "";
fmgc.windController.crz_winds[computer_temp].wind4.set = 0;
} else if (index == 3) {
fmgc.windController.crz_winds[computer_temp].wind3.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind3.heading = -1;
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = -1;
fmgc.windController.crz_winds[computer_temp].wind3.altitude = "";
fmgc.windController.crz_winds[computer_temp].wind3.set = 0;
} else if (index == 2) {
fmgc.windController.crz_winds[computer_temp].wind2.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind2.heading = -1;
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = -1;
fmgc.windController.crz_winds[computer_temp].wind2.altitude = "";
fmgc.windController.crz_winds[computer_temp].wind2.set = 0;
} else if (index == 1) {
fmgc.windController.crz_winds[computer_temp].wind1.heading = 0;
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = 0;
fmgc.windController.crz_winds[computer_temp].wind1.heading = -1;
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = -1;
fmgc.windController.crz_winds[computer_temp].wind1.altitude = "";
fmgc.windController.crz_winds[computer_temp].wind1.set = 0;
}
} else {
if (index <= 1) {
fmgc.windController.crz_winds[computer_temp].wind1.heading = fmgc.windController.crz_winds[computer_temp].wind2.heading;
fmgc.windController.crz_winds[computer_temp].wind1.magnitude = fmgc.windController.crz_winds[computer_temp].wind2.magnitude;
fmgc.windController.crz_winds[computer_temp].wind1.altitude = fmgc.windController.crz_winds[computer_temp].wind2.altitude;
fmgc.windController.crz_winds[computer_temp].wind1.set = fmgc.windController.crz_winds[computer_temp].wind2.set;
}
if (index <= 2) {
fmgc.windController.crz_winds[computer_temp].wind2.heading = fmgc.windController.crz_winds[computer_temp].wind3.heading;
fmgc.windController.crz_winds[computer_temp].wind2.magnitude = fmgc.windController.crz_winds[computer_temp].wind3.magnitude;
fmgc.windController.crz_winds[computer_temp].wind2.altitude = fmgc.windController.crz_winds[computer_temp].wind3.altitude;
fmgc.windController.crz_winds[computer_temp].wind2.set = fmgc.windController.crz_winds[computer_temp].wind3.set;
}
if (index <= 3) {
fmgc.windController.crz_winds[computer_temp].wind3.heading = fmgc.windController.crz_winds[computer_temp].wind4.heading;
fmgc.windController.crz_winds[computer_temp].wind3.magnitude = fmgc.windController.crz_winds[computer_temp].wind4.magnitude;
fmgc.windController.crz_winds[computer_temp].wind3.altitude = fmgc.windController.crz_winds[computer_temp].wind4.altitude;
fmgc.windController.crz_winds[computer_temp].wind3.set = fmgc.windController.crz_winds[computer_temp].wind4.set;
}
fmgc.windController.crz_winds[computer_temp].wind4.heading = -1;
fmgc.windController.crz_winds[computer_temp].wind4.magnitude = -1;
fmgc.windController.crz_winds[computer_temp].wind4.altitude = "";
fmgc.windController.crz_winds[computer_temp].wind4.set = 0;
}
} else {
if (me.items == index) {
if (index == 4) {
fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = "";
fmgc.windController.winds[computer_temp][me.match_location].wind4.set = 0;
} else if (index == 3) {
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = "";
fmgc.windController.winds[computer_temp][me.match_location].wind3.set = 0;
} else if (index == 2) {
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = "";
fmgc.windController.winds[computer_temp][me.match_location].wind2.set = 0;
} else if (index == 1) {
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = 0;
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = "";
fmgc.windController.winds[computer_temp][me.match_location].wind1.set = 0;
}
} else {
if (index <= 1) {
fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = fmgc.windController.winds[computer_temp][me.match_location].wind2.heading;
fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude;
fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude;
fmgc.windController.winds[computer_temp][me.match_location].wind1.set = fmgc.windController.winds[computer_temp][me.match_location].wind2.set;
}
if (index <= 2) {
fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = fmgc.windController.winds[computer_temp][me.match_location].wind3.heading;
fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude;
fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude;
fmgc.windController.winds[computer_temp][me.match_location].wind2.set = fmgc.windController.winds[computer_temp][me.match_location].wind3.set;
}
if (index <= 3) {
fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = fmgc.windController.winds[computer_temp][me.match_location].wind4.heading;
fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude;
fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude;
fmgc.windController.winds[computer_temp][me.match_location].wind3.set = fmgc.windController.winds[computer_temp][me.match_location].wind4.set;
}
fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = -1;
fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = "";
fmgc.windController.winds[computer_temp][me.match_location].wind4.set = 0;
}
}
mcdu_scratchpad.scratchpads[me.computer].empty();

View file

@ -54,17 +54,13 @@ var windDESPage = {
computer_temp = me.computer;
}
# debug.dump(fmgc.windController.des_winds[0]);
# debug.dump(fmgc.windController.des_winds[1]);
# debug.dump(fmgc.windController.des_winds[2]);
if (fmgc.windController.des_winds[computer_temp] == 0 or fmgc.windController.des_winds[computer_temp].wind1.altitude == "") {
if (fmgc.windController.des_winds[computer_temp] == 0 or !fmgc.windController.des_winds[computer_temp].wind1.set) {
me.items = 1;
} else if (fmgc.windController.des_winds[computer_temp].wind2.altitude == "") {
} else if (!fmgc.windController.des_winds[computer_temp].wind2.set) {
me.items = 2;
} else if (fmgc.windController.des_winds[computer_temp].wind3.altitude == "") {
} else if (!fmgc.windController.des_winds[computer_temp].wind3.set) {
me.items = 3;
} else if (fmgc.windController.des_winds[computer_temp].wind4.altitude == "") {
} else if (!fmgc.windController.des_winds[computer_temp].wind4.set) {
me.items = 4;
} else {
me.items = 5;
@ -72,7 +68,7 @@ var windDESPage = {
if (me.items >= 5) {
var windStore = fmgc.windController.des_winds[computer_temp].wind5;
if (windStore.altitude != "") {
if (windStore.set) {
me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][4] = 1;
} else {
@ -85,7 +81,7 @@ var windDESPage = {
if (me.items >= 4) {
var windStore = fmgc.windController.des_winds[computer_temp].wind4;
if (windStore.altitude != "") {
if (windStore.set) {
me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][3] = 1;
} else {
@ -98,7 +94,7 @@ var windDESPage = {
if (me.items >= 3) {
var windStore = fmgc.windController.des_winds[computer_temp].wind3;
if (windStore.altitude != "") {
if (windStore.set) {
me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][2] = 1;
} else {
@ -111,7 +107,7 @@ var windDESPage = {
if (me.items >= 2) {
var windStore = fmgc.windController.des_winds[computer_temp].wind2;
if (windStore.altitude != "") {
if (windStore.set) {
me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"];
me.fontMatrix[0][1] = 1;
} else {
@ -124,7 +120,7 @@ var windDESPage = {
if (me.items >= 1) {
var windStore = fmgc.windController.des_winds[computer_temp].wind1;
if (windStore.altitude != "") {
if (windStore.set) {
me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"];
me.fontMatrix[0][0] = 1;
} else {
@ -135,9 +131,9 @@ var windDESPage = {
me.L6 = [" RETURN", nil, "wht"];
if (getprop("/FMGC/internal/alt-set")) {
if (fmgc.FMGCInternal.altAirportSet) {
var windStore = fmgc.windController.des_winds[computer_temp].alt1;
if (windStore.heading != 0 and windStore.magnitude != 0) {
if (windStore.set) {
me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"];
me.fontMatrix[1][0] = 1;
} else {
@ -191,6 +187,22 @@ var windDESPage = {
me._setupPageWithData();
me.updateTmpy();
},
returnGRND: func() {
var wind = fmgc.windController.des_winds[2];
if (wind.wind5.altitude == "GRND") {
return [geo.normdeg(wind.wind5.heading - getprop("/environment/magnetic-variation-deg")), wind.wind5.magnitude];
} else if (wind.wind4.altitude == "GRND") {
return [geo.normdeg(wind.wind4.heading - getprop("/environment/magnetic-variation-deg")), wind.wind4.magnitude];
} else if (wind.wind3.altitude == "GRND") {
return [geo.normdeg(wind.wind3.heading - getprop("/environment/magnetic-variation-deg")), wind.wind3.magnitude];
} else if (wind.wind2.altitude == "GRND") {
return [geo.normdeg(wind.wind2.heading - getprop("/environment/magnetic-variation-deg")), wind.wind2.magnitude];
} else if (wind.wind1.altitude == "GRND") {
return [geo.normdeg(wind.wind1.heading - getprop("/environment/magnetic-variation-deg")), wind.wind1.magnitude];
} else {
return nil;
}
},
pushButtonLeft: func(index) {
if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) {
if (canvas_mcdu.myFpln[me.computer] != nil) {
@ -209,7 +221,10 @@ var windDESPage = {
} else if (me.items >= index) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) {
var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad);
if (size(winds[0]) >= 0 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and
if (size(winds) < 3) {
mcdu_message(me.computer, "NOT ALLOWED");
# not implemented yet
} 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[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))) {
@ -218,31 +233,31 @@ var windDESPage = {
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
# if (winds[2] == "GRND") {
# setprop("/FMGC/internal/dest-mag-grnd", winds[0]);
# setprop("/FMGC/internal/dest-wind-grnd", winds[1]);
# }
#print(computer_temp);
if (index == 5) {
fmgc.windController.des_winds[computer_temp].wind5.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind5.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind5.altitude = winds[2];
fmgc.windController.des_winds[computer_temp].wind5.set = 1;
} else if (index == 4) {
fmgc.windController.des_winds[computer_temp].wind4.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind4.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind4.altitude = winds[2];
fmgc.windController.des_winds[computer_temp].wind4.set = 1;
} else if (index == 3) {
fmgc.windController.des_winds[computer_temp].wind3.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind3.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind3.altitude = winds[2];
fmgc.windController.des_winds[computer_temp].wind3.set = 1;
} else if (index == 2) {
fmgc.windController.des_winds[computer_temp].wind2.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind2.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind2.altitude = winds[2];
fmgc.windController.des_winds[computer_temp].wind2.set = 1;
} else if (index == 1) {
fmgc.windController.des_winds[computer_temp].wind1.heading = winds[0];
fmgc.windController.des_winds[computer_temp].wind1.magnitude = winds[1];
fmgc.windController.des_winds[computer_temp].wind1.altitude = winds[2];
fmgc.windController.des_winds[computer_temp].wind1.set = 1;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
if (me.items == index and index != 5) {
@ -260,47 +275,60 @@ var windDESPage = {
}
if (me.items == index) {
if (index == 5) {
fmgc.windController.des_winds[computer_temp].wind5.heading = 0;
fmgc.windController.des_winds[computer_temp].wind5.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind5.heading = -1;
fmgc.windController.des_winds[computer_temp].wind5.magnitude = -1;
fmgc.windController.des_winds[computer_temp].wind5.altitude = "";
fmgc.windController.des_winds[computer_temp].wind5.set = 0;
} else if (index == 4) {
fmgc.windController.des_winds[computer_temp].wind4.heading = 0;
fmgc.windController.des_winds[computer_temp].wind4.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind4.heading = -1;
fmgc.windController.des_winds[computer_temp].wind4.magnitude = -1;
fmgc.windController.des_winds[computer_temp].wind4.altitude = "";
fmgc.windController.des_winds[computer_temp].wind4.set = 0;
} else if (index == 3) {
fmgc.windController.des_winds[computer_temp].wind3.heading = 0;
fmgc.windController.des_winds[computer_temp].wind3.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind3.heading = -1;
fmgc.windController.des_winds[computer_temp].wind3.magnitude = -1;
fmgc.windController.des_winds[computer_temp].wind3.altitude = "";
fmgc.windController.des_winds[computer_temp].wind3.set = 0;
} else if (index == 2) {
fmgc.windController.des_winds[computer_temp].wind2.heading = 0;
fmgc.windController.des_winds[computer_temp].wind2.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind2.heading = -1;
fmgc.windController.des_winds[computer_temp].wind2.magnitude = -1;
fmgc.windController.des_winds[computer_temp].wind2.altitude = "";
fmgc.windController.des_winds[computer_temp].wind2.set = 0;
} else if (index == 1) {
fmgc.windController.des_winds[computer_temp].wind1.heading = 0;
fmgc.windController.des_winds[computer_temp].wind1.magnitude = 0;
fmgc.windController.des_winds[computer_temp].wind1.heading = -1;
fmgc.windController.des_winds[computer_temp].wind1.magnitude = -1;
fmgc.windController.des_winds[computer_temp].wind1.altitude = "";
fmgc.windController.des_winds[computer_temp].wind1.set = 0;
}
} else {
if (index <= 1) {
fmgc.windController.des_winds[computer_temp].wind1.heading = fmgc.windController.des_winds[computer_temp].wind2.heading;
fmgc.windController.des_winds[computer_temp].wind1.magnitude = fmgc.windController.des_winds[computer_temp].wind2.magnitude;
fmgc.windController.des_winds[computer_temp].wind1.altitude = fmgc.windController.des_winds[computer_temp].wind2.altitude;
fmgc.windController.des_winds[computer_temp].wind1.set = fmgc.windController.des_winds[computer_temp].wind2.set;
}
if (index <= 2) {
fmgc.windController.des_winds[computer_temp].wind2.heading = fmgc.windController.des_winds[computer_temp].wind3.heading;
fmgc.windController.des_winds[computer_temp].wind2.magnitude = fmgc.windController.des_winds[computer_temp].wind3.magnitude;
fmgc.windController.des_winds[computer_temp].wind2.altitude = fmgc.windController.des_winds[computer_temp].wind3.altitude;
fmgc.windController.des_winds[computer_temp].wind2.set = fmgc.windController.des_winds[computer_temp].wind3.set;
}
if (index <= 3) {
fmgc.windController.des_winds[computer_temp].wind3.heading = fmgc.windController.des_winds[computer_temp].wind4.heading;
fmgc.windController.des_winds[computer_temp].wind3.magnitude = fmgc.windController.des_winds[computer_temp].wind4.magnitude;
fmgc.windController.des_winds[computer_temp].wind3.altitude = fmgc.windController.des_winds[computer_temp].wind4.altitude;
fmgc.windController.des_winds[computer_temp].wind3.set = fmgc.windController.des_winds[computer_temp].wind4.set;
}
if (index <= 4) {
fmgc.windController.des_winds[computer_temp].wind4.heading = fmgc.windController.des_winds[computer_temp].wind5.heading;
fmgc.windController.des_winds[computer_temp].wind4.magnitude = fmgc.windController.des_winds[computer_temp].wind5.magnitude;
fmgc.windController.des_winds[computer_temp].wind4.altitude = fmgc.windController.des_winds[computer_temp].wind5.altitude;
}
fmgc.windController.des_winds[computer_temp].wind4.set = fmgc.windController.des_winds[computer_temp].wind5.set;
}
fmgc.windController.des_winds[computer_temp].wind5.heading = -1;
fmgc.windController.des_winds[computer_temp].wind5.magnitude = -1;
fmgc.windController.des_winds[computer_temp].wind5.altitude = "";
fmgc.windController.des_winds[computer_temp].wind5.set = 0;
}
mcdu_scratchpad.scratchpads[me.computer].empty();
me.items -= 1;
@ -314,35 +342,37 @@ var windDESPage = {
}
},
pushButtonRight: func(index) {
if (index == 1 and getprop("/FMGC/internal/alt-set")) {
if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 3 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 7) {
if (index == 1 and fmgc.FMGCInternal.altAirportSet) {
if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") {
var computer_temp = 2;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
fmgc.windController.des_winds[computer_temp].alt1.heading = -1;
fmgc.windController.des_winds[computer_temp].alt1.magnitude = -1;
fmgc.windController.des_winds[computer_temp].alt1.set = 0;
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
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);
if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 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] >= 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];
fmgc.windController.des_winds[computer_temp].alt1.set = 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;
if (fmgc.flightPlanController.temporaryFlag[me.computer]) {
computer_temp = me.computer;
}
fmgc.windController.des_winds[computer_temp].alt1.heading = 0;
fmgc.windController.des_winds[computer_temp].alt1.magnitude = 0;
mcdu_scratchpad.scratchpads[me.computer].empty();
me._setupPageWithData();
me.updateTmpy();
} else {
mcdu_message(me.computer, "NOT ALLOWED");
}