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
var dest_qnh = props.globals.getNode("/FMGC/internal/dest-qnh", 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 radio = props.globals.getNode("/FMGC/internal/radio", 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
@ -3730,7 +3726,7 @@ var canvas_MCDU_base = {
me["Simple_R3"].setText(sprintf("%.0f", getprop("/FMGC/internal/radio")));
me.fontRight(0, 0, default, 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.fontRight(0, 0, default, 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_R4"].setText("CONF3 ");
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_F"].show();
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_L5"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vapp_appr));
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);
} else {
me.fontSizeLeft(0, 0, 0, 0, small, 0);
@ -3777,7 +3773,7 @@ var canvas_MCDU_base = {
me["Simple_C2"].setText(" ---");
me["Simple_C3"].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.fontLeft(0, 0, 0, 0, default, 0);
me.fontSizeLeft(0, 0, 0, 0, normal, 0);

View file

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

View file

@ -39,6 +39,9 @@ var alt200 = nil;
var alt750 = nil;
var bigThree = nil;
var altAlertSteady = 0;
var altAlertFlash = 0;
var messages_priority_3 = func {
phaseVar3 = phaseNode.getValue();
@ -780,21 +783,21 @@ var messages_priority_3 = func {
}
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 {
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)) {
setprop("ECAM/flipflop/alt-alert-2-rs-reset", 1);
setprop("/ECAM/flipflop/alt-alert-2-rs-reset", 1);
} 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")) {
setprop("ECAM/flipflop/alt-alert-3-rs-set", 1);
setprop("/ECAM/flipflop/alt-alert-3-rs-set", 1);
} 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")) {
@ -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) {
setprop("ECAM/alt-alert-steady", 1);
altAlertSteady = 1;
} else {
setprop("ECAM/alt-alert-steady", 0);
altAlertSteady = 0;
}
if (FWC.Timer.gnd.getValue() != 1 and bigThree) {
setprop("ECAM/alt-alert-flash", 1);
altAlertFlash = 1;
} else {
setprop("ECAM/alt-alert-flash", 0);
altAlertFlash = 0;
}
if (!systems.cargoTestBtn.getBoolValue()) {
@ -2025,21 +2028,21 @@ var messages_priority_0 = func {
var messages_config_memo = func {
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) {
setprop("ECAM/to-config-normal", 0);
setprop("/ECAM/to-config-normal", 0);
} 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)) {
setprop("ECAM/to-config-set", 1);
setprop("/ECAM/to-config-set", 1);
} else {
setprop("ECAM/to-config-set", 0);
setprop("/ECAM/to-config-set", 0);
}
if (!getprop("/ECAM/to-config-normal") or phaseVarMemo == 6) {
setprop("ECAM/to-config-reset", 1);
setprop("/ECAM/to-config-reset", 1);
} else {
setprop("ECAM/to-config-reset", 0);
setprop("/ECAM/to-config-reset", 0);
}
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)) {
setprop("ECAM/to-memo-set", 1);
setprop("/ECAM/to-memo-set", 1);
} 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) {
setprop("ECAM/to-memo-reset", 1);
setprop("/ECAM/to-memo-reset", 1);
} 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")) {
@ -2152,27 +2155,27 @@ var messages_config_memo = func {
gear_agl_cur = pts.Position.gearAglFt.getValue();
if (gear_agl_cur < 2000) {
setprop("ECAM/ldg-memo-set", 1);
setprop("/ECAM/ldg-memo-set", 1);
} else {
setprop("ECAM/ldg-memo-set", 0);
setprop("/ECAM/ldg-memo-set", 0);
}
if (gear_agl_cur > 2200) {
setprop("ECAM/ldg-memo-reset", 1);
setprop("/ECAM/ldg-memo-reset", 1);
} else {
setprop("ECAM/ldg-memo-reset", 0);
setprop("/ECAM/ldg-memo-reset", 0);
}
if (gear_agl_cur > 2200) {
setprop("ECAM/ldg-memo-2200-set", 1);
setprop("/ECAM/ldg-memo-2200-set", 1);
} else {
setprop("ECAM/ldg-memo-2200-set", 0);
setprop("/ECAM/ldg-memo-2200-set", 0);
}
if (phaseVarMemo != 6 and phaseVarMemo != 7 and phaseVarMemo != 8) {
setprop("ECAM/ldg-memo-2200-reset", 1);
setprop("/ECAM/ldg-memo-2200-reset", 1);
} 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) {

View file

@ -170,6 +170,7 @@ var FMGCInternal = {
flap2_appr: 0,
vls_appr: 0,
vapp_appr: 0,
vappSpeedSet: 0,
# PERF
transAlt: 18000,
@ -188,6 +189,9 @@ var FMGCInternal = {
destMagSet: 0,
destWind: 0,
destWindSet: 0,
radioNo: 0,
ldgConfig3: 0,
ldgConfigFull: 0,
# INIT A
altAirport: "",
@ -774,7 +778,7 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.slat = FMGCInternal.vs1g_clean * 1.23;
FMGCInternal.flap2 = FMGCInternal.vs1g_conf_2 * 1.47;
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;
} else {
FMGCInternal.vls = FMGCInternal.vs1g_conf_full * 1.23
@ -782,7 +786,7 @@ var masterFMGC = maketimer(0.2, func {
if (FMGCInternal.vls < 113) {
FMGCInternal.vls = 113;
}
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (!fmgc.FMGCInternal.vappSpeedSet) {
if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp = FMGCInternal.vls + 5;
} else if (FMGCInternal.destWind > 15) {
@ -824,7 +828,7 @@ var masterFMGC = maketimer(0.2, func {
FMGCInternal.slat_appr = FMGCInternal.slat;
FMGCInternal.flap2_appr = FMGCInternal.flap2;
FMGCInternal.vls_appr = FMGCInternal.vls;
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (!fmgc.FMGCInternal.vappSpeedSet) {
FMGCInternal.vapp_appr = FMGCInternal.vapp;
}
} 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.slat_appr = FMGCInternal.vs1g_clean_appr * 1.23;
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;
} else {
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) {
FMGCInternal.vls_appr = 113;
}
if (!getprop("/FMGC/internal/vapp-speed-set")) {
if (!fmgc.FMGCInternal.vappSpeedSet) {
if (FMGCInternal.destWind < 5) {
FMGCInternal.vapp_appr = FMGCInternal.vls_appr + 5;
} else if (FMGCInternal.destWind > 15) {

View file

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

View file

@ -2,6 +2,8 @@ var isNoStar = [0, 0, 0];
var isNoTransArr = [0, 0, 0];
var isNoVia = [0, 0, 0];
var version = nil;
var arrivalPage = {
title: [nil, nil, nil],
subtitle: [nil, nil],
@ -74,7 +76,8 @@ var arrivalPage = {
if (fmgc.flightPlanController.flightplans[2].approach != nil) {
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) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
} elsif (isNoVia[2] == 1) {
@ -98,7 +101,8 @@ var arrivalPage = {
} else {
if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) {
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) {
me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans;
} elsif (isNoVia[me.computer] == 1) {
@ -107,7 +111,8 @@ var arrivalPage = {
}
} elsif (fmgc.flightPlanController.flightplans[2].approach != nil) {
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) {
me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans;
}
@ -232,7 +237,8 @@ var arrivalPage = {
},
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 (!fmgc.flightPlanController.temporaryFlag[me.computer]) {
@ -503,7 +509,8 @@ var arrivalPage = {
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
},
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) {
me.clearVias();
return;
@ -746,7 +753,8 @@ var arrivalPage = {
},
arrPushbuttonLeft: func(index) {
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.activePage = 2;
me.updatePage();
@ -778,7 +786,7 @@ var arrivalPage = {
}
setprop("FMGC/internal/baro", 99999);
setprop("FMGC/internal/radio", 99999);
setprop("FMGC/internal/radio-no", 0);
fmgc.FMGCInternal.radioNo = 0;
me.updateApproaches();
me.updatePage();
fmgc.flightPlanController.flightPlanChanged(me.computer);

View file

@ -175,14 +175,14 @@ var MCDU_reset = func(i) {
fmgc.FMGCInternal.destMagSet = 0;
fmgc.FMGCInternal.destWind = 0;
fmgc.FMGCInternal.destWindSet = 0;
setprop("/FMGC/internal/vapp-speed-set", 0);
fmgc.FMGCInternal.vappSpeedSet = 0;
setprop("/FMGC/internal/final", "");
setprop("/FMGC/internal/baro", 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-config-3-set", 0);
setprop("/FMGC/internal/ldg-config-f-set", 1);
fmgc.FMGCInternal.ldgConfig3 = 0;
fmgc.FMGCInternal.ldgConfigFull = 1;
# GA PERF
}

View file

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