1
0
Fork 0

Switch v1 / vr / v2 to nasal thingies

This commit is contained in:
legoboyvdlp R 2020-07-09 23:59:11 +01:00
parent c8612c2c1b
commit 28c1f2e50a
8 changed files with 78 additions and 84 deletions

View file

@ -178,13 +178,6 @@ var cruiseFL_prog = props.globals.getNode("/FMGC/internal/cruise-fl-prog", 1);
var altitude = props.globals.getNode("/instrumentation/altimeter/indicated-altitude-ft", 1);
# TO PERF
var v1 = props.globals.getNode("/FMGC/internal/v1", 1);
var v1Set = props.globals.getNode("/FMGC/internal/v1-set", 1);
var vr = props.globals.getNode("/FMGC/internal/vr", 1);
var vrSet = props.globals.getNode("/FMGC/internal/vr-set", 1);
var v2 = props.globals.getNode("/FMGC/internal/v2", 1);
var v2Set = props.globals.getNode("/FMGC/internal/v2-set", 1);
var clbReducFt = props.globals.getNode("/systems/thrust/clbreduc-ft", 1);
var reducFt = props.globals.getNode("/FMGC/internal/accel-agl-ft", 1); # It's not AGL anymore
var thrAccSet = props.globals.getNode("/MCDUC/thracc-set", 1);
@ -2288,9 +2281,6 @@ var canvas_MCDU_base = {
pageSwitch[i].setBoolValue(1);
}
me["Simple_L1"].setText(sprintf("%3.0f", v1.getValue()));
me["Simple_L2"].setText(sprintf("%3.0f", vr.getValue()));
me["Simple_L3"].setText(sprintf("%3.0f", v2.getValue()));
me["Simple_L4"].setText(sprintf("%3.0f", fmgc.FMGCInternal.transAlt));
me["Simple_L5"].setText(sprintf("%3.0f", clbReducFt.getValue()) ~ sprintf("/%3.0f", reducFt.getValue()));
me["Simple_L6"].setText(" TO DATA");
@ -2338,27 +2328,33 @@ var canvas_MCDU_base = {
me["Simple_Title"].setText("TAKE OFF");
}
if (v1Set.getValue() == 1) {
if (fmgc.FMGCInternal.v1set) {
me["PERFTO_V1"].hide();
me["Simple_L1"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1));
me["Simple_L1"].show();
} else {
me["PERFTO_V1"].show();
me["Simple_L1"].hide();
}
if (vrSet.getValue() == 1) {
if (fmgc.FMGCInternal.vrset) {
me["PERFTO_VR"].hide();
me["Simple_L2"].setText(sprintf("%3.0f", fmgc.FMGCInternal.vr));
me["Simple_L2"].show();
} else {
me["PERFTO_VR"].show();
me["Simple_L2"].hide();
}
if (v2Set.getValue() == 1) {
if (fmgc.FMGCInternal.v2set) {
me["PERFTO_V2"].hide();
me["Simple_L3"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2));
me["Simple_L3"].show();
} else {
me["PERFTO_V2"].show();
me["Simple_L3"].hide();
}
if (thrAccSet.getValue() == 1) {
me["Simple_L5"].setFontSize(normal);
} else {

View file

@ -128,12 +128,6 @@ var ils1_crs_set = props.globals.getNode("/FMGC/internal/ils1crs-set/", 1);
var outer_marker = props.globals.getNode("/instrumentation/marker-beacon/outer", 1);
var middle_marker = props.globals.getNode("/instrumentation/marker-beacon/middle", 1);
var inner_marker = props.globals.getNode("/instrumentation/marker-beacon/inner", 1);
var v1 = props.globals.getNode("/FMGC/internal/v1", 1);
var v1_set = props.globals.getNode("/FMGC/internal/v1-set", 1);
var vr = props.globals.getNode("/FMGC/internal/vr", 1);
var vr_set = props.globals.getNode("/FMGC/internal/vr-set", 1);
var v2 = props.globals.getNode("/FMGC/internal/v2", 1);
var v2_set = props.globals.getNode("/FMGC/internal/v2-set", 1);
var flap_config = props.globals.getNode("/controls/flight/flaps-input", 1);
var hundredAbove = props.globals.getNode("/instrumentation/pfd/hundred-above", 1);
var minimum = props.globals.getNode("/instrumentation/pfd/minimums", 1);
@ -1331,8 +1325,8 @@ var canvas_PFD_1 = {
me["ASI_target"].hide();
}
if (v1_set.getValue() == '1') {
tgt_v1 = v1.getValue();
if (fmgc.FMGCInternal.v1set) {
tgt_v1 = fmgc.FMGCInternal.v1;
if (tgt_v1 <= 30) {
me.V1trgt = 0 - me.ASI;
} else if (tgt_v1 >= 420) {
@ -1350,7 +1344,7 @@ var canvas_PFD_1 = {
} else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) {
me["v1_group"].hide();
me["v1_text"].show();
me["v1_text"].setText(sprintf("%3.0f", v1.getValue()));
me["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1));
} else {
me["v1_group"].hide();
me["v1_text"].hide();
@ -1360,8 +1354,8 @@ var canvas_PFD_1 = {
me["v1_text"].hide();
}
if (vr_set.getValue() == '1') {
tgt_vr = vr.getValue();
if (fmgc.FMGCInternal.vrset) {
tgt_vr = fmgc.FMGCInternal.vr;
if (tgt_vr <= 30) {
me.VRtrgt = 0 - me.ASI;
} else if (tgt_vr >= 420) {
@ -1382,8 +1376,8 @@ var canvas_PFD_1 = {
me["vr_speed"].hide();
}
if (v2_set.getValue() == '1') {
tgt_v2 = v2.getValue();
if (fmgc.FMGCInternal.v2set) {
tgt_v2 = fmgc.FMGCInternal.v2;
if (tgt_v2 <= 30) {
me.V2trgt = 0 - me.ASI;
} else if (tgt_v2 >= 420) {
@ -1397,10 +1391,10 @@ var canvas_PFD_1 = {
if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) {
me["ASI_target"].show();
me["ASI_target"].setTranslation(0, me.V2trgt * -6.6);
me["ASI_digit_UP"].setText(sprintf("%3.0f", v2.getValue()));
me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2));
} else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) {
me["ASI_target"].hide();
me["ASI_digit_UP"].setText(sprintf("%3.0f", v2.getValue()));
me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2));
}
}
@ -2070,8 +2064,8 @@ var canvas_PFD_2 = {
me["ASI_target"].hide();
}
if (v1_set.getValue() == '1') {
tgt_v1 = v1.getValue();
if (fmgc.FMGCInternal.v1set) {
tgt_v1 = fmgc.FMGCInternal.v1;
if (tgt_v1 <= 30) {
me.V1trgt = 0 - me.ASI;
} else if (tgt_v1 >= 420) {
@ -2089,7 +2083,7 @@ var canvas_PFD_2 = {
} else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) {
me["v1_group"].hide();
me["v1_text"].show();
me["v1_text"].setText(sprintf("%3.0f", v1.getValue()));
me["v1_text"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v1));
} else {
me["v1_group"].hide();
me["v1_text"].hide();
@ -2099,8 +2093,8 @@ var canvas_PFD_2 = {
me["v1_text"].hide();
}
if (vr_set.getValue() == '1') {
tgt_vr = vr.getValue();
if (fmgc.FMGCInternal.vrset) {
tgt_vr = fmgc.FMGCInternal.vr;
if (tgt_vr <= 30) {
me.VRtrgt = 0 - me.ASI;
} else if (tgt_vr >= 420) {
@ -2121,8 +2115,8 @@ var canvas_PFD_2 = {
me["vr_speed"].hide();
}
if (v2_set.getValue() == '1') {
tgt_v2 = v2.getValue();
if (fmgc.FMGCInternal.v2set) {
tgt_v2 = fmgc.FMGCInternal.v2;
if (tgt_v2 <= 30) {
me.V2trgt = 0 - me.ASI;
} else if (tgt_v2 >= 420) {
@ -2136,10 +2130,10 @@ var canvas_PFD_2 = {
if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2 and me.SPDv2trgtdiff >= -42 and me.SPDv2trgtdiff <= 42) {
me["ASI_target"].show();
me["ASI_target"].setTranslation(0, me.V2trgt * -6.6);
me["ASI_digit_UP"].setText(sprintf("%3.0f", v2.getValue()));
me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2));
} else if (pts.Position.gearAglFt.getValue() < 55 and FMGCphase.getValue() <= 2) {
me["ASI_target"].hide();
me["ASI_digit_UP"].setText(sprintf("%3.0f", v2.getValue()));
me["ASI_digit_UP"].setText(sprintf("%3.0f", fmgc.FMGCInternal.v2));
}
}

View file

@ -170,9 +170,6 @@ var Custom = {
ndTrkSel: [props.globals.getNode("/instrumentation/efis[0]/trk-selected", 1), props.globals.getNode("/instrumentation/efis[1]/trk-selected", 1)],
showHdg: props.globals.initNode("/it-autoflight/custom/show-hdg", 1, "BOOL"),
trkFpa: props.globals.initNode("/it-autoflight/custom/trk-fpa", 0, "BOOL"),
FMGC: {
v2Speed: props.globals.getNode("/FMGC/internal/v2", 1),
},
Input: {
spdManaged: props.globals.getNode("/it-autoflight/input/spd-managed", 1),
},
@ -852,7 +849,7 @@ var ITAF = {
Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), 100, 350));
},
syncKtsGa: func() { # Same as syncKts, except doesn't go below V2
Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), Custom.FMGC.v2Speed.getValue(), 350));
Input.kts.setValue(math.clamp(math.round(Velocities.indicatedAirspeedKt.getValue()), FMGCInternal.v2, 350));
},
syncMach: func() {
Input.mach.setValue(math.clamp(math.round(Velocities.indicatedMach.getValue(), 0.001), 0.5, 0.82));

View file

@ -125,7 +125,7 @@ var loopFMA = maketimer(0.05, func {
var engstate2 = getprop("engines/engine[1]/state");
if (((state1 == "TOGA" or state2 == "TOGA") or (flx == 1 and (state1 == "MCT" or state2 == "MCT")) or (flx == 1 and ((state1 == "MAN THR" and thr1 >= 0.83) or (state2 == "MAN THR" and thr2 >= 0.83)))) and (engstate1 == 3 or engstate2 == 3)) {
# RWY Engagement would go here, but automatic ILS selection is not simulated yet.
if (wow and getprop("FMGC/internal/v2-set") == 1 and getprop("it-autoflight/output/vert") != 7) {
if (wow and FMGCInternal.v2set and getprop("it-autoflight/output/vert") != 7) {
ITAF.setVertMode(7);
setprop("it-autoflight/mode/vert", "T/O CLB");
}
@ -343,15 +343,11 @@ setlistener("/it-autoflight/mode/vert", func {
altvert();
});
setlistener("/FMGC/internal/v2-set", func {
updatePitchArm2();
});
var updatePitchArm2 = func {
var newvertarm = getprop("modes/pfd/fma/pitch-mode2-armed");
if (newvertarm != "CLB" and getprop("FMGC/internal/v2-set") == 1) {
if (newvertarm != "CLB" and FMGCInternal.v2set) {
setprop("modes/pfd/fma/pitch-mode2-armed", "CLB");
} else if (newvertarm != " " and getprop("FMGC/internal/v2-set") != 1) {
} else if (newvertarm != " " and FMGCInternal.v2set != 1) {
setprop("modes/pfd/fma/pitch-mode2-armed", " ");
}
}

View file

@ -102,9 +102,9 @@ setprop("/FMGC/internal/mng-spd", 157);
setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("/FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mach-switchover", 0);
setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("it-autoflight/internal/vert-speed-fpm", 0);
setprop("it-autoflight/output/fma-pwr", 0);
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("/it-autoflight/internal/vert-speed-fpm", 0);
setprop("/it-autoflight/output/fma-pwr", 0);
setprop("instrumentation/nav[0]/nav-id", "XXX");
setprop("instrumentation/nav[1]/nav-id", "XXX");
setprop("/FMGC/internal/ils1-mcdu", "XXX/999.99");
@ -123,8 +123,7 @@ var FMGCinit = func {
setprop("/FMGC/internal/mng-spd-cmd", 157);
setprop("/FMGC/internal/mng-kts-mach", 0);
setprop("/FMGC/internal/mach-switchover", 0);
setprop("it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("/FMGC/internal/decel", 0);
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway
setprop("/FMGC/internal/loc-source", "NAV0");
setprop("/FMGC/internal/optalt", 0);
setprop("/FMGC/internal/landing-time", -99);
@ -139,10 +138,21 @@ var FMGCinit = func {
}
var FMGCInternal = {
v1: 0,
v1set: 0,
vr: 0,
vrset: 0,
v2: 0,
v2set: 0,
transAlt: 18000,
transAltSet: 0,
};
var FMGCNodes = {
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
};
############
# FBW Trim #
############
@ -464,7 +474,7 @@ var masterFMGC = maketimer(0.2, func {
if ((phase == "5") and state1 == "TOGA" and state2 == "TOGA") {
setprop("/FMGC/status/phase", 6);
setprop("systems/pressurization/mode", "TO");
setprop("it-autoflight/input/toga", 1);
setprop("/it-autoflight/input/toga", 1);
}
if (phase == "6" and alt >= accel_agl_ft) { # todo when insert altn or new dest
@ -756,11 +766,11 @@ var reset_FMGC = func {
var various = maketimer(1, func {
if (getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") != 3) {
setprop("it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/eng-out-reduc"));
setprop("/it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/eng-out-reduc"));
} else if (getprop("/engines/engine[0]/state") != 3 and getprop("/engines/engine[1]/state") == 3) {
setprop("it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/eng-out-reduc"));
setprop("/it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/eng-out-reduc"));
} else {
setprop("it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/accel-agl-ft"));
setprop("/it-autoflight/settings/accel-agl-ft", getprop("/FMGC/internal/accel-agl-ft"));
}
setprop("/FMGC/internal/gw", math.round(getprop("/fdm/jsbsim/inertia/weight-lbs"), 100));
@ -965,17 +975,17 @@ var ManagedSPD = maketimer(0.25, func {
}
if (ktsmach and !mngktsmach) {
setprop("it-autoflight/input/kts-mach", 0);
setprop("/it-autoflight/input/kts-mach", 0);
} else if (!ktsmach and mngktsmach) {
setprop("it-autoflight/input/kts-mach", 1);
setprop("/it-autoflight/input/kts-mach", 1);
}
mng_spd = getprop("/FMGC/internal/mng-spd");
if (kts_sel != mng_spd and !ktsmach) {
setprop("it-autoflight/input/kts", mng_spd);
setprop("/it-autoflight/input/kts", mng_spd);
} else if (mach_sel != mng_spd and ktsmach) {
setprop("it-autoflight/input/mach", mng_spd);
setprop("/it-autoflight/input/mach", mng_spd);
}
} else {
ManagedSPD.stop();

View file

@ -94,8 +94,8 @@ var fplnItem = {
return sprintf("%03.0f", math.round(me.trk));
},
getSpd: func() {
if (me.index == 0 and getprop("FMGC/internal/v1-set")) {
return [sprintf("%3.0f", math.round(getprop("FMGC/internal/v1"))), "mag"];
if (me.index == 0 and fmgc.FMGCInternal.v1) {
return [sprintf("%3.0f", math.round(fmgc.FMGCInternal.v1)), "mag"];
} elsif (me.wp.speed_cstr != nil and me.wp.speed_cstr != 0) {
return [sprintf("%3.0f", me.wp.speed_cstr), "mag"];
} else {

View file

@ -136,12 +136,6 @@ var MCDU_reset = func(i) {
# PERF
#PERF TO
setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/v1-set", 0);
setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/vr-set", 0);
setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/v2-set", 0);
setprop("FMGC/internal/accel-agl-ft", "1500"); #eventually set to 1500 above runway
setprop("/MCDUC/thracc-set", 0);
setprop("FMGC/internal/to-flap", 0);

View file

@ -8,15 +8,21 @@ var perfTOInput = func(key, i) {
if (key == "L1") {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/v1", 0);
setprop("/FMGC/internal/v1-set", 0);
fmgc.FMGCInternal.v1 = 0;
fmgc.FMGCInternal.v1set = 0;
fmgc.FMGCNodes.v1.setValue(0);
fmgc.FMGCNodes.v1set.setValue(0);
mcdu_scratchpad.scratchpads[i].empty();
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/v1", scratchpad);
setprop("/FMGC/internal/v1-set", 1);
fmgc.FMGCInternal.v1 = scratchpad;
fmgc.FMGCInternal.v1set = 1;
# for sounds:
fmgc.FMGCNodes.v1.setValue(scratchpad);
fmgc.FMGCNodes.v1set.setValue(1);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
@ -31,15 +37,15 @@ var perfTOInput = func(key, i) {
} else if (key == "L2") {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/vr", 0);
setprop("/FMGC/internal/vr-set", 0);
fmgc.FMGCInternal.vr = 0;
fmgc.FMGCInternal.vrset = 0;
mcdu_scratchpad.scratchpads[i].empty();
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/vr", scratchpad);
setprop("/FMGC/internal/vr-set", 1);
fmgc.FMGCInternal.vr = scratchpad;
fmgc.FMGCInternal.vrset = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");
@ -54,17 +60,18 @@ var perfTOInput = func(key, i) {
} else if (key == "L3") {
if (getprop("/FMGC/status/phase") != 1) {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/v2", 0);
setprop("/FMGC/internal/v2-set", 0);
setprop("it-autoflight/settings/togaspd", 157);
fmgc.FMGCInternal.v2 = 0;
fmgc.FMGCInternal.v2set = 0;
setprop("/it-autoflight/settings/togaspd", 157);
mcdu_scratchpad.scratchpads[i].empty();
} else {
var tfs = size(scratchpad);
if (tfs == 3) {
if (int(scratchpad) != nil and scratchpad >= 100 and scratchpad <= 350) {
setprop("/FMGC/internal/v2", scratchpad);
setprop("/FMGC/internal/v2-set", 1);
setprop("it-autoflight/settings/togaspd", scratchpad);
fmgc.FMGCInternal.v2 = scratchpad;
fmgc.FMGCInternal.v2set = 1;
fmgc.updatePitchArm2();
setprop("/it-autoflight/settings/togaspd", scratchpad);
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");