1
0
Fork 0

Refactor version checks. Improve altitude alerter code so it uses less properties. FMGC: use less properties

This commit is contained in:
legoboyvdlp R 2020-09-28 20:15:19 +01:00
parent d38496f196
commit e236de2f69
8 changed files with 86 additions and 76 deletions

View file

@ -142,13 +142,9 @@ var activate_twice = props.globals.getNode("/FMGC/internal/activate-twice", 1);
# APPR PERF # APPR PERF
var dest_qnh = props.globals.getNode("/FMGC/internal/dest-qnh", 1); var dest_qnh = props.globals.getNode("/FMGC/internal/dest-qnh", 1);
var dest_temp = props.globals.getNode("/FMGC/internal/dest-temp", 1); var dest_temp = props.globals.getNode("/FMGC/internal/dest-temp", 1);
var vapp_speed_set = props.globals.getNode("/FMGC/internal/vapp-speed-set", 1);
var final = props.globals.getNode("/FMGC/internal/final", 1); var final = props.globals.getNode("/FMGC/internal/final", 1);
var radio = props.globals.getNode("/FMGC/internal/radio", 1); var radio = props.globals.getNode("/FMGC/internal/radio", 1);
var baro = props.globals.getNode("/FMGC/internal/baro", 1); var baro = props.globals.getNode("/FMGC/internal/baro", 1);
var radio_no = props.globals.getNode("/FMGC/internal/radio-no", 1);
var ldg_config_3_set = props.globals.getNode("/FMGC/internal/ldg-config-3-set", 1);
var ldg_config_f_set = props.globals.getNode("/FMGC/internal/ldg-config-f-set", 1);
# GA PERF # GA PERF
@ -3730,7 +3726,7 @@ var canvas_MCDU_base = {
me["Simple_R3"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio"))); me["Simple_R3"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio")));
me.fontRight(0, 0, default, 0, 0, 0); me.fontRight(0, 0, default, 0, 0, 0);
me.fontSizeRight(0, 0, normal, 0, 0, 0); me.fontSizeRight(0, 0, normal, 0, 0, 0);
} else if (getprop("/FMGC/internal/radio-no")) { } else if (fmgc.FMGCInternal.radioNo) {
me["Simple_R3"].setText("NO"); me["Simple_R3"].setText("NO");
me.fontRight(0, 0, default, 0, 0, 0); me.fontRight(0, 0, default, 0, 0, 0);
me.fontSizeRight(0, 0, normal, 0, 0, 0); me.fontSizeRight(0, 0, normal, 0, 0, 0);
@ -3743,7 +3739,7 @@ var canvas_MCDU_base = {
me["Simple_R4S"].setText("LDG CONF "); me["Simple_R4S"].setText("LDG CONF ");
me["Simple_R4"].setText("CONF3 "); me["Simple_R4"].setText("CONF3 ");
me["Simple_R5"].setText("FULL "); me["Simple_R5"].setText("FULL ");
if (ldg_config_3_set.getValue() == 1 and ldg_config_f_set.getValue() == 0) { if (fmgc.FMGCInternal.ldgConfig3 == 1 and fmgc.FMGCInternal.ldgConfigFull == 0) {
me["PERFAPPR_LDG_3"].hide(); me["PERFAPPR_LDG_3"].hide();
me["PERFAPPR_LDG_F"].show(); me["PERFAPPR_LDG_F"].show();
me.fontSizeRight(0, 0, 0, normal, small, 0); me.fontSizeRight(0, 0, 0, normal, small, 0);
@ -3767,7 +3763,7 @@ var canvas_MCDU_base = {
me["Simple_C5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vls_appr)); me["Simple_C5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vls_appr));
me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr)); me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr));
me.fontLeft(0, 0, 0, 0, default, 0); me.fontLeft(0, 0, 0, 0, default, 0);
if (vapp_speed_set.getValue()) { if (fmgc.FMGCInternal.vappSpeedSet) {
me.fontSizeLeft(0, 0, 0, 0, normal, 0); me.fontSizeLeft(0, 0, 0, 0, normal, 0);
} else { } else {
me.fontSizeLeft(0, 0, 0, 0, small, 0); me.fontSizeLeft(0, 0, 0, 0, small, 0);
@ -3777,7 +3773,7 @@ var canvas_MCDU_base = {
me["Simple_C2"].setText(" ---"); me["Simple_C2"].setText(" ---");
me["Simple_C3"].setText(" ---"); me["Simple_C3"].setText(" ---");
me["Simple_C5"].setText(" ---"); me["Simple_C5"].setText(" ---");
if (vapp_speed_set.getValue()) { if (fmgc.FMGCInternal.vappSpeedSet) {
me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr)); me["Simple_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr));
me.fontLeft(0, 0, 0, 0, default, 0); me.fontLeft(0, 0, 0, 0, default, 0);
me.fontSizeLeft(0, 0, 0, 0, normal, 0); me.fontSizeLeft(0, 0, 0, 0, normal, 0);

View file

@ -794,7 +794,7 @@ var canvas_PFD_base = {
} else { } else {
me["AI_agl"].setColor(0.0509,0.7529,0.2941); me["AI_agl"].setColor(0.0509,0.7529,0.2941);
} }
} else if (getprop("/FMGC/internal/radio-no")) { } else if (fmgc.FMGCInternal.radioNo) {
me["FMA_dh"].setText("BARO"); me["FMA_dh"].setText("BARO");
me["FMA_dh"].show(); me["FMA_dh"].show();
me["FMA_dhn"].setText("100"); me["FMA_dhn"].setText("100");
@ -835,7 +835,7 @@ var canvas_PFD_base = {
me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro"))); me["FMA_dhn"].setText(sprintf("%.0f", getprop("/FMGC/internal/baro")));
me["FMA_dhn"].show(); me["FMA_dhn"].show();
me["FMA_nodh"].hide(); me["FMA_nodh"].hide();
} else if (getprop("/FMGC/internal/radio-no")) { } else if (fmgc.FMGCInternal.radioNo) {
me["FMA_dh"].setText("BARO"); me["FMA_dh"].setText("BARO");
me["FMA_dh"].show(); me["FMA_dh"].show();
me["FMA_dhn"].setText("100"); me["FMA_dhn"].setText("100");
@ -1259,7 +1259,7 @@ var canvas_PFD_1 = {
if (managed_spd.getValue() == 1) { if (managed_spd.getValue() == 1) {
if (getprop("/FMGC/internal/decel") == 1) { if (getprop("/FMGC/internal/decel") == 1) {
if (getprop("/FMGC/internal/vapp-speed-set")) { if (fmgc.FMGCInternal.vappSpeedSet) {
vapp = fmgc.FMGCInternal.vapp_appr; vapp = fmgc.FMGCInternal.vapp_appr;
} else { } else {
vapp = fmgc.FMGCInternal.vapp; vapp = fmgc.FMGCInternal.vapp;
@ -1690,13 +1690,13 @@ var canvas_PFD_1 = {
me["ground"].hide(); me["ground"].hide();
} }
if (!getprop("/ECAM/alt-alert-flash") and !getprop("/ECAM/alt-alert-steady")) { if (!ecam.altAlertFlash and !ecam.altAlertSteady) {
alt_going1 = 0; alt_going1 = 0;
amber_going1 = 0; amber_going1 = 0;
me["ALT_box_flash"].hide(); me["ALT_box_flash"].hide();
me["ALT_box_amber"].hide(); me["ALT_box_amber"].hide();
} else { } else {
if (getprop("/ECAM/alt-alert-flash")) { if (ecam.altAlertFlash) {
if (alt_going1 == 1) { if (alt_going1 == 1) {
me["ALT_box_flash"].hide(); me["ALT_box_flash"].hide();
altTimer1.stop(); altTimer1.stop();
@ -1714,7 +1714,7 @@ var canvas_PFD_1 = {
} else { } else {
me["ALT_box_amber"].show(); me["ALT_box_amber"].show();
} }
} elsif (getprop("/ECAM/alt-alert-steady")) { } elsif (ecam.altAlertSteady) {
if (amber_going1 == 1) { if (amber_going1 == 1) {
me["ALT_box"].show(); me["ALT_box"].show();
me["ALT_box_amber"].hide(); me["ALT_box_amber"].hide();
@ -1997,7 +1997,7 @@ var canvas_PFD_2 = {
if (managed_spd.getValue() == 1) { if (managed_spd.getValue() == 1) {
if (getprop("/FMGC/internal/decel") == 1) { if (getprop("/FMGC/internal/decel") == 1) {
if (getprop("/FMGC/internal/vapp-speed-set")) { if (fmgc.FMGCInternal.vappSpeedSet) {
vapp = fmgc.FMGCInternal.vapp_appr; vapp = fmgc.FMGCInternal.vapp_appr;
} else { } else {
vapp = fmgc.FMGCInternal.vapp; vapp = fmgc.FMGCInternal.vapp;
@ -2428,13 +2428,13 @@ var canvas_PFD_2 = {
me["ground"].hide(); me["ground"].hide();
} }
if (!getprop("/ECAM/alt-alert-flash") and !getprop("/ECAM/alt-alert-steady")) { if (!ecam.altAlertFlash and !ecam.altAlertSteady) {
alt_going2 = 0; alt_going2 = 0;
amber_going2 = 0; amber_going2 = 0;
me["ALT_box_flash"].hide(); me["ALT_box_flash"].hide();
me["ALT_box_amber"].hide(); me["ALT_box_amber"].hide();
} else { } else {
if (getprop("/ECAM/alt-alert-flash")) { if (ecam.altAlertFlash) {
if (alt_going2 == 1) { if (alt_going2 == 1) {
me["ALT_box_flash"].hide(); me["ALT_box_flash"].hide();
altTimer2.stop(); altTimer2.stop();
@ -2452,7 +2452,7 @@ var canvas_PFD_2 = {
} else { } else {
me["ALT_box_amber"].hide(); me["ALT_box_amber"].hide();
} }
} elsif (getprop("/ECAM/alt-alert-steady")) { } elsif (ecam.altAlertSteady) {
if (amber_going2 == 1) { if (amber_going2 == 1) {
me["ALT_box"].show(); me["ALT_box"].show();
me["ALT_box_amber"].hide(); me["ALT_box_amber"].hide();

View file

@ -39,6 +39,9 @@ var alt200 = nil;
var alt750 = nil; var alt750 = nil;
var bigThree = nil; var bigThree = nil;
var altAlertSteady = 0;
var altAlertFlash = 0;
var messages_priority_3 = func { var messages_priority_3 = func {
phaseVar3 = phaseNode.getValue(); phaseVar3 = phaseNode.getValue();
@ -780,21 +783,21 @@ var messages_priority_3 = func {
} }
if (alt750 and alt200 and !altAlertInhibit) { if (alt750 and alt200 and !altAlertInhibit) {
setprop("ECAM/flipflop/alt-alert-2-rs-set", 1); setprop("/ECAM/flipflop/alt-alert-2-rs-set", 1);
} else { } else {
setprop("ECAM/flipflop/alt-alert-2-rs-set", 0); setprop("/ECAM/flipflop/alt-alert-2-rs-set", 0);
} }
if (getprop("/ECAM/flipflop/alt-alert-rs-reset") or (!alt750 and !alt200 and !altAlertInhibit)) { if (getprop("/ECAM/flipflop/alt-alert-rs-reset") or (!alt750 and !alt200 and !altAlertInhibit)) {
setprop("ECAM/flipflop/alt-alert-2-rs-reset", 1); setprop("/ECAM/flipflop/alt-alert-2-rs-reset", 1);
} else { } else {
setprop("ECAM/flipflop/alt-alert-2-rs-reset", 0); setprop("/ECAM/flipflop/alt-alert-2-rs-reset", 0);
} }
if (alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-2-rs-output")) { if (alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-2-rs-output")) {
setprop("ECAM/flipflop/alt-alert-3-rs-set", 1); setprop("/ECAM/flipflop/alt-alert-3-rs-set", 1);
} else { } else {
setprop("ECAM/flipflop/alt-alert-3-rs-set", 0); setprop("/ECAM/flipflop/alt-alert-3-rs-set", 0);
} }
if ((!alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-rs-output")) or (!alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-3-rs-output")) or getprop("/ECAM/flipflop/alt-alert-3-rs-set")) { if ((!alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-rs-output")) or (!alt750 and !alt200 and !altAlertInhibit and getprop("/ECAM/flipflop/alt-alert-3-rs-output")) or getprop("/ECAM/flipflop/alt-alert-3-rs-set")) {
@ -815,15 +818,15 @@ var messages_priority_3 = func {
} }
if (FWC.Timer.gnd.getValue() != 1 and getprop("/ECAM/flipflop/alt-alert-3-rs-set") != 1 and alt750 and !alt200 and !altAlertInhibit) { if (FWC.Timer.gnd.getValue() != 1 and getprop("/ECAM/flipflop/alt-alert-3-rs-set") != 1 and alt750 and !alt200 and !altAlertInhibit) {
setprop("ECAM/alt-alert-steady", 1); altAlertSteady = 1;
} else { } else {
setprop("ECAM/alt-alert-steady", 0); altAlertSteady = 0;
} }
if (FWC.Timer.gnd.getValue() != 1 and bigThree) { if (FWC.Timer.gnd.getValue() != 1 and bigThree) {
setprop("ECAM/alt-alert-flash", 1); altAlertFlash = 1;
} else { } else {
setprop("ECAM/alt-alert-flash", 0); altAlertFlash = 0;
} }
if (!systems.cargoTestBtn.getBoolValue()) { if (!systems.cargoTestBtn.getBoolValue()) {
@ -2025,21 +2028,21 @@ var messages_priority_0 = func {
var messages_config_memo = func { var messages_config_memo = func {
phaseVarMemo = phaseNode.getValue(); phaseVarMemo = phaseNode.getValue();
if (getprop("/controls/flight/flaps-input") == 0 or getprop("/controls/flight/flaps-input") == 4 or getprop("/controls/flight/speedbrake") != 0 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 1.75 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -3.65 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.55 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.55) { if (getprop("/controls/flight/flaps-input") == 0 or getprop("/controls/flight/flaps-input") == 4 or getprop("/controls/flight/speedbrake") != 0 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") > 1.75 or getprop("/fdm/jsbsim/hydraulics/elevator-trim/final-deg") < -3.65 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") < -3.55 or getprop("/fdm/jsbsim/hydraulics/rudder/trim-cmd-deg") > 3.55) {
setprop("ECAM/to-config-normal", 0); setprop("/ECAM/to-config-normal", 0);
} else { } else {
setprop("ECAM/to-config-normal", 1); setprop("/ECAM/to-config-normal", 1);
} }
if (getprop("/ECAM/to-config-test") and (phaseVarMemo == 2 or phaseVarMemo == 9)) { if (getprop("/ECAM/to-config-test") and (phaseVarMemo == 2 or phaseVarMemo == 9)) {
setprop("ECAM/to-config-set", 1); setprop("/ECAM/to-config-set", 1);
} else { } else {
setprop("ECAM/to-config-set", 0); setprop("/ECAM/to-config-set", 0);
} }
if (!getprop("/ECAM/to-config-normal") or phaseVarMemo == 6) { if (!getprop("/ECAM/to-config-normal") or phaseVarMemo == 6) {
setprop("ECAM/to-config-reset", 1); setprop("/ECAM/to-config-reset", 1);
} else { } else {
setprop("ECAM/to-config-reset", 0); setprop("/ECAM/to-config-reset", 0);
} }
if (getprop("/controls/autobrake/mode") == 3) { if (getprop("/controls/autobrake/mode") == 3) {
@ -2083,15 +2086,15 @@ var messages_config_memo = func {
} }
if (getprop("/ECAM/to-config-test") and (phaseVarMemo == 2 or phaseVarMemo == 9)) { if (getprop("/ECAM/to-config-test") and (phaseVarMemo == 2 or phaseVarMemo == 9)) {
setprop("ECAM/to-memo-set", 1); setprop("/ECAM/to-memo-set", 1);
} else { } else {
setprop("ECAM/to-memo-set", 0); setprop("/ECAM/to-memo-set", 0);
} }
if (phaseVarMemo == 1 or phaseVarMemo == 3 or phaseVarMemo == 6 or phaseVarMemo == 10) { if (phaseVarMemo == 1 or phaseVarMemo == 3 or phaseVarMemo == 6 or phaseVarMemo == 10) {
setprop("ECAM/to-memo-reset", 1); setprop("/ECAM/to-memo-reset", 1);
} else { } else {
setprop("ECAM/to-memo-reset", 0); setprop("/ECAM/to-memo-reset", 0);
} }
if ((phaseVarMemo == 2 and getprop("/ECAM/engine-start-time") != 0 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec")) or getprop("/ECAM/to-memo-flipflop")) { if ((phaseVarMemo == 2 and getprop("/ECAM/engine-start-time") != 0 and getprop("/ECAM/engine-start-time") + 120 < getprop("/sim/time/elapsed-sec")) or getprop("/ECAM/to-memo-flipflop")) {
@ -2152,27 +2155,27 @@ var messages_config_memo = func {
gear_agl_cur = pts.Position.gearAglFt.getValue(); gear_agl_cur = pts.Position.gearAglFt.getValue();
if (gear_agl_cur < 2000) { if (gear_agl_cur < 2000) {
setprop("ECAM/ldg-memo-set", 1); setprop("/ECAM/ldg-memo-set", 1);
} else { } else {
setprop("ECAM/ldg-memo-set", 0); setprop("/ECAM/ldg-memo-set", 0);
} }
if (gear_agl_cur > 2200) { if (gear_agl_cur > 2200) {
setprop("ECAM/ldg-memo-reset", 1); setprop("/ECAM/ldg-memo-reset", 1);
} else { } else {
setprop("ECAM/ldg-memo-reset", 0); setprop("/ECAM/ldg-memo-reset", 0);
} }
if (gear_agl_cur > 2200) { if (gear_agl_cur > 2200) {
setprop("ECAM/ldg-memo-2200-set", 1); setprop("/ECAM/ldg-memo-2200-set", 1);
} else { } else {
setprop("ECAM/ldg-memo-2200-set", 0); setprop("/ECAM/ldg-memo-2200-set", 0);
} }
if (phaseVarMemo != 6 and phaseVarMemo != 7 and phaseVarMemo != 8) { if (phaseVarMemo != 6 and phaseVarMemo != 7 and phaseVarMemo != 8) {
setprop("ECAM/ldg-memo-2200-reset", 1); setprop("/ECAM/ldg-memo-2200-reset", 1);
} else { } else {
setprop("ECAM/ldg-memo-2200-reset", 0); setprop("/ECAM/ldg-memo-2200-reset", 0);
} }
if ((phaseVarMemo == 6 and getprop("/ECAM/ldg-memo-flipflop") and getprop("/ECAM/ldg-memo-2200-flipflop")) or phaseVarMemo == 7 or phaseVarMemo == 8) { if ((phaseVarMemo == 6 and getprop("/ECAM/ldg-memo-flipflop") and getprop("/ECAM/ldg-memo-2200-flipflop")) or phaseVarMemo == 7 or phaseVarMemo == 8) {

View file

@ -170,6 +170,7 @@ var FMGCInternal = {
flap2_appr: 0, flap2_appr: 0,
vls_appr: 0, vls_appr: 0,
vapp_appr: 0, vapp_appr: 0,
vappSpeedSet: 0,
# PERF # PERF
transAlt: 18000, transAlt: 18000,
@ -188,6 +189,9 @@ var FMGCInternal = {
destMagSet: 0, destMagSet: 0,
destWind: 0, destWind: 0,
destWindSet: 0, destWindSet: 0,
radioNo: 0,
ldgConfig3: 0,
ldgConfigFull: 0,
# INIT A # INIT A
altAirport: "", altAirport: "",
@ -774,7 +778,7 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.slat = FMGCInternal.vs1g_clean * 1.23; FMGCInternal.slat = FMGCInternal.vs1g_clean * 1.23;
FMGCInternal.flap2 = FMGCInternal.vs1g_conf_2 * 1.47; FMGCInternal.flap2 = FMGCInternal.vs1g_conf_2 * 1.47;
FMGCInternal.flap3 = FMGCInternal.vs1g_conf_3 * 1.36; FMGCInternal.flap3 = FMGCInternal.vs1g_conf_3 * 1.36;
if (getprop("/FMGC/internal/ldg-config-3-set")) { if (FMGCInternal.ldgConfig3) {
FMGCInternal.vls = FMGCInternal.vs1g_conf_3 * 1.23; FMGCInternal.vls = FMGCInternal.vs1g_conf_3 * 1.23;
} else { } else {
FMGCInternal.vls = FMGCInternal.vs1g_conf_full * 1.23 FMGCInternal.vls = FMGCInternal.vs1g_conf_full * 1.23
@ -782,7 +786,7 @@ var masterFMGC = maketimer(0.2, func {
if (FMGCInternal.vls < 113) { if (FMGCInternal.vls < 113) {
FMGCInternal.vls = 113; FMGCInternal.vls = 113;
} }
if (!getprop("/FMGC/internal/vapp-speed-set")) { if (!fmgc.FMGCInternal.vappSpeedSet) {
if (FMGCInternal.destWind < 5) { if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp = FMGCInternal.vls + 5; FMGCInternal.vapp = FMGCInternal.vls + 5;
} else if (FMGCInternal.destWind > 15) { } else if (FMGCInternal.destWind > 15) {
@ -824,7 +828,7 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.slat_appr = FMGCInternal.slat; FMGCInternal.slat_appr = FMGCInternal.slat;
FMGCInternal.flap2_appr = FMGCInternal.flap2; FMGCInternal.flap2_appr = FMGCInternal.flap2;
FMGCInternal.vls_appr = FMGCInternal.vls; FMGCInternal.vls_appr = FMGCInternal.vls;
if (!getprop("/FMGC/internal/vapp-speed-set")) { if (!fmgc.FMGCInternal.vappSpeedSet) {
FMGCInternal.vapp_appr = FMGCInternal.vapp; FMGCInternal.vapp_appr = FMGCInternal.vapp;
} }
} else { } else {
@ -838,7 +842,7 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.vs1g_conf_full_appr = -0.0007 * FMGCInternal.lw * FMGCInternal.lw + 0.6002 * FMGCInternal.lw + 38.479; FMGCInternal.vs1g_conf_full_appr = -0.0007 * FMGCInternal.lw * FMGCInternal.lw + 0.6002 * FMGCInternal.lw + 38.479;
FMGCInternal.slat_appr = FMGCInternal.vs1g_clean_appr * 1.23; FMGCInternal.slat_appr = FMGCInternal.vs1g_clean_appr * 1.23;
FMGCInternal.flap2_appr = FMGCInternal.vs1g_conf_2_appr * 1.47; FMGCInternal.flap2_appr = FMGCInternal.vs1g_conf_2_appr * 1.47;
if (getprop("/FMGC/internal/ldg-config-3-set")) { if (FMGCInternal.ldgConfig3) {
FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_3_appr * 1.23; FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_3_appr * 1.23;
} else { } else {
FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_full_appr * 1.23 FMGCInternal.vls_appr = FMGCInternal.vs1g_conf_full_appr * 1.23
@ -846,7 +850,7 @@ var masterFMGC = maketimer(0.2, func {
if (FMGCInternal.vls_appr < 113) { if (FMGCInternal.vls_appr < 113) {
FMGCInternal.vls_appr = 113; FMGCInternal.vls_appr = 113;
} }
if (!getprop("/FMGC/internal/vapp-speed-set")) { if (!fmgc.FMGCInternal.vappSpeedSet) {
if (FMGCInternal.destWind < 5) { if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5; FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5;
} else if (FMGCInternal.destWind > 15) { } else if (FMGCInternal.destWind > 15) {

View file

@ -190,6 +190,7 @@ var Sim = {
deltaRealtimeSec: props.globals.getNode("/sim/time/delta-realtime-sec"), deltaRealtimeSec: props.globals.getNode("/sim/time/delta-realtime-sec"),
elapsedSec: props.globals.getNode("/sim/time/elapsed-sec"), elapsedSec: props.globals.getNode("/sim/time/elapsed-sec"),
}, },
Version: props.globals.getNode("/sim/version/flightgear"),
}; };
var Systems = { var Systems = {

View file

@ -2,6 +2,8 @@ var isNoStar = [0, 0, 0];
var isNoTransArr = [0, 0, 0]; var isNoTransArr = [0, 0, 0];
var isNoVia = [0, 0, 0]; var isNoVia = [0, 0, 0];
var version = nil;
var arrivalPage = { var arrivalPage = {
title: [nil, nil, nil], title: [nil, nil, nil],
subtitle: [nil, nil], subtitle: [nil, nil],
@ -74,7 +76,8 @@ var arrivalPage = {
if (fmgc.flightPlanController.flightplans[2].approach != nil) { if (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") { version = pts.Sim.Version.getValue();
if (version == "2020.2.0" or version == "2020.2.1" or version == "2020.3.0") {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
} elsif (isNoVia[2] == 1) { } elsif (isNoVia[2] == 1) {
@ -98,7 +101,8 @@ var arrivalPage = {
} else { } else {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") { version = pts.Sim.Version.getValue();
if (version == "2020.2.0" or version == "2020.2.1" or version == "2020.3.0") {
if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans; me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans;
} elsif (isNoVia[me.computer] == 1) { } elsif (isNoVia[me.computer] == 1) {
@ -107,7 +111,8 @@ var arrivalPage = {
} }
} elsif (fmgc.flightPlanController.flightplans[2].approach != nil) { } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach;
if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") { version = pts.Sim.Version.getValue();
if (version == "2020.2.0" or version == "2020.2.1" or version == "2020.3.0") {
if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
} }
@ -232,7 +237,8 @@ var arrivalPage = {
}, },
updateActiveVIAs: func() { updateActiveVIAs: func() {
if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; } version = pts.Sim.Version.getValue();
if (version != "2020.2.0" and version != "2020.2.1" and version != "2020.3.0") { return; }
if (me.selectedVIA == "NO VIA") { if (me.selectedVIA == "NO VIA") {
if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
@ -503,7 +509,8 @@ var arrivalPage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
}, },
updateVIAs: func() { updateVIAs: func() {
if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; } version = pts.Sim.Version.getValue();
if (version != "2020.2.0" and version != "2020.2.1" and version != "2020.3.0") { return; }
if (me.selectedApproach == nil or me.activePage != 2) { if (me.selectedApproach == nil or me.activePage != 2) {
me.clearVias(); me.clearVias();
return; return;
@ -746,7 +753,8 @@ var arrivalPage = {
}, },
arrPushbuttonLeft: func(index) { arrPushbuttonLeft: func(index) {
if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) { if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) {
if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; } version = pts.Sim.Version.getValue();
if (version != "2020.2.0" and version != "2020.2.1" and version != "2020.3.0") { return; }
me.oldPage = me.activePage; me.oldPage = me.activePage;
me.activePage = 2; me.activePage = 2;
me.updatePage(); me.updatePage();
@ -778,7 +786,7 @@ var arrivalPage = {
} }
setprop("FMGC/internal/baro", 99999); setprop("FMGC/internal/baro", 99999);
setprop("FMGC/internal/radio", 99999); setprop("FMGC/internal/radio", 99999);
setprop("FMGC/internal/radio-no", 0); fmgc.FMGCInternal.radioNo = 0;
me.updateApproaches(); me.updateApproaches();
me.updatePage(); me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer); fmgc.flightPlanController.flightPlanChanged(me.computer);

View file

@ -175,14 +175,14 @@ var MCDU_reset = func(i) {
fmgc.FMGCInternal.destMagSet = 0; fmgc.FMGCInternal.destMagSet = 0;
fmgc.FMGCInternal.destWind = 0; fmgc.FMGCInternal.destWind = 0;
fmgc.FMGCInternal.destWindSet = 0; fmgc.FMGCInternal.destWindSet = 0;
setprop("/FMGC/internal/vapp-speed-set", 0); fmgc.FMGCInternal.vappSpeedSet = 0;
setprop("/FMGC/internal/final", ""); setprop("/FMGC/internal/final", "");
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 0); fmgc.FMGCInternal.radioNo = 0;
setprop("/FMGC/internal/ldg-elev", 0); setprop("/FMGC/internal/ldg-elev", 0);
setprop("/FMGC/internal/ldg-config-3-set", 0); fmgc.FMGCInternal.ldgConfig3 = 0;
setprop("/FMGC/internal/ldg-config-f-set", 1); fmgc.FMGCInternal.ldgConfigFull = 1;
# GA PERF # GA PERF
} }

View file

@ -1,8 +1,6 @@
# Copyright (c) 2020 Matthew Maring (mattmaring) # Copyright (c) 2020 Matthew Maring (mattmaring)
# APPR PERF # APPR PERF
var ldg_config_3_set = props.globals.getNode("/FMGC/internal/ldg-config-3-set", 1);
var ldg_config_f_set = props.globals.getNode("/FMGC/internal/ldg-config-f-set", 1);
var perfAPPRInput = func(key, i) { var perfAPPRInput = func(key, i) {
var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad;
@ -77,10 +75,10 @@ var perfAPPRInput = func(key, i) {
} }
} else if (key == "L5") { } else if (key == "L5") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/vapp-speed-set", 0); fmgc.FMGCInternal.vappSpeedSet = 0;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) { } else if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/vapp-speed-set", 1); fmgc.FMGCInternal.vappSpeedSet = 1;
fmgc.FMGCInternal.vapp_appr = scratchpad; fmgc.FMGCInternal.vapp_appr = scratchpad;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
@ -93,7 +91,7 @@ var perfAPPRInput = func(key, i) {
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) { } else if (int(scratchpad) != nil and scratchpad >= getprop("/FMGC/internal/ldg-elev") and scratchpad <= 5000 + getprop("/FMGC/internal/ldg-elev")) {
if (getprop("/FMGC/internal/radio-no") == 0) { if (!fmgc.FMGCInternal.radioNo) {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
} }
setprop("/FMGC/internal/baro", scratchpad); setprop("/FMGC/internal/baro", scratchpad);
@ -104,31 +102,31 @@ var perfAPPRInput = func(key, i) {
} else if (key == "R3") { } else if (key == "R3") {
if (scratchpad == "CLR") { if (scratchpad == "CLR") {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 0); fmgc.FMGCInternal.radioNo = 0;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else if (scratchpad == "NO") { } else if (scratchpad == "NO") {
setprop("/FMGC/internal/radio", 99999); setprop("/FMGC/internal/radio", 99999);
setprop("/FMGC/internal/radio-no", 1); fmgc.FMGCInternal.radioNo = 1;
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) { } else if (int(scratchpad) != nil and scratchpad >= 0 and scratchpad <= 700) {
setprop("/FMGC/internal/baro", 99999); setprop("/FMGC/internal/baro", 99999);
setprop("/FMGC/internal/radio-no", 0); fmgc.FMGCInternal.radioNo = 0;
setprop("/FMGC/internal/radio", scratchpad); setprop("/FMGC/internal/radio", scratchpad);
mcdu_scratchpad.scratchpads[i].empty(); mcdu_scratchpad.scratchpads[i].empty();
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R4") { } else if (key == "R4") {
if (scratchpad == "" and ldg_config_f_set.getValue() == 1 and ldg_config_3_set.getValue() == 0) { if (scratchpad == "" and fmgc.FMGCInternal.ldgConfigFull == 1 and fmgc.FMGCInternal.ldgConfig3 == 0) {
setprop("/FMGC/internal/ldg-config-3-set", 1); fmgc.FMGCInternal.ldgConfig3 = 1;
setprop("/FMGC/internal/ldg-config-f-set", 0); fmgc.FMGCInternal.ldgConfigFull = 0;
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }
} else if (key == "R5") { } else if (key == "R5") {
if (scratchpad == "" and ldg_config_3_set.getValue() == 1 and ldg_config_f_set.getValue() == 0) { if (scratchpad == "" and fmgc.FMGCInternal.ldgConfig3 == 1 and fmgc.FMGCInternal.ldgConfigFull == 0) {
setprop("/FMGC/internal/ldg-config-3-set", 0); fmgc.FMGCInternal.ldgConfig3 = 0;
setprop("/FMGC/internal/ldg-config-f-set", 1); fmgc.FMGCInternal.ldgConfigFull = 1;
} else { } else {
mcdu_message(i, "NOT ALLOWED"); mcdu_message(i, "NOT ALLOWED");
} }