1
0
Fork 0
This commit is contained in:
legoboyvdlp R 2020-07-10 20:54:13 +01:00
parent b1f91f1639
commit 649c29e7b8
7 changed files with 48 additions and 42 deletions

View file

@ -103,8 +103,6 @@ var vor2CRS = props.globals.getNode("/instrumentation/nav[3]/radials/selected-de
# INT-A
var depArpt = props.globals.getNode("/FMGC/internal/dep-arpt", 1);
var arrArpt = props.globals.getNode("/FMGC/internal/arr-arpt", 1);
var costIndex = props.globals.getNode("/FMGC/internal/cost-index", 1);
var costIndexSet = props.globals.getNode("/FMGC/internal/cost-index-set", 1);
var ADIRSMCDUBTN = props.globals.getNode("/controls/adirs/mcducbtn", 1);
# IRSINIT variables
@ -1086,16 +1084,16 @@ var canvas_MCDU_base = {
me["Simple_L3"].hide();
}
if (!fmgc.FMGCInternal.toFromSet and costIndexSet.getValue() != 1) {
if (!fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.costIndexSet) {
me["INITA_CostIndex"].hide();
me["Simple_L5"].setColor(1,1,1);
me["Simple_L5"].show();
me["Simple_L5"].setText("---");
} else if (costIndexSet.getValue() == 1) {
} else if (fmgc.FMGCInternal.costIndexSet) {
me["INITA_CostIndex"].hide();
me["Simple_L5"].setColor(0.0901,0.6039,0.7176);
me["Simple_L5"].show();
me["Simple_L5"].setText(sprintf("%s", costIndex.getValue()));
me["Simple_L5"].setText(sprintf("%s", fmgc.FMGCInternal.costIndex));
} else {
me["INITA_CostIndex"].show();
me["Simple_L5"].hide();
@ -2519,9 +2517,9 @@ var canvas_MCDU_base = {
}
me["Simple_L2S"].setText(" CI");
if (costIndexSet.getValue() == 1) {
if (fmgc.FMGCInternal.costIndexSet) {
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setText(sprintf(" %s", costIndex.getValue()));
me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex));
} else {
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setText(" ---");
@ -2672,9 +2670,9 @@ var canvas_MCDU_base = {
me.fontLeft(0, 0, 0, default, 0, 0);
}
if (costIndexSet.getValue() == 1) {
if (fmgc.FMGCInternal.costIndexSet) {
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setText(sprintf(" %s", costIndex.getValue()));
me["Simple_L2"].setText(sprintf(" %s", fmgc.FMGCInternal.costIndex));
} else {
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setText(" ---");
@ -2833,9 +2831,9 @@ var canvas_MCDU_base = {
me.fontLeft(0, 0, 0, default, 0, 0);
}
if (costIndexSet.getValue() == 1) {
if (fmgc.FMGCInternal.costIndexSet) {
me["Simple_L2"].setColor(0.0901,0.6039,0.7176);
me["Simple_L2"].setText(sprintf(" %2.0f", costIndex.getValue()));
me["Simple_L2"].setText(sprintf(" %2.0f", fmgc.FMGCInternal.costIndex));
} else {
me["Simple_L2"].setColor(1,1,1);
me["Simple_L2"].setText(" ---");

View file

@ -196,7 +196,7 @@ var FCUController = {
},
SPDPush: func() {
if (me.FCUworking) {
if (fmgc.FMGCInternal.crzSet and getprop("FMGC/internal/cost-index-set") == 1) {
if (fmgc.FMGCInternal.crzSet and fmgc.FMGCInternal.costIndexSet) {
spdManaged.setBoolValue(1);
fmgc.ManagedSPD.start();
}

View file

@ -148,20 +148,24 @@ var FMGCInternal = {
transAltSet: 0,
# INIT A
altAirport: "",
altAirportSet: 0,
altSelected: 0,
arrApt: "",
costIndex: 0,
costIndexSet: 0,
crzFt: 10000,
crzFl: 0,
crzSet: 0,
crzTemp: 15,
crzTempSet: 0,
tropo: 36090,
tropoSet: 0,
flightNum: "",
flightNumSet: 0,
altAirport: "",
altAirportSet: 0,
altSelected: 0,
arrApt: "",
gndTemp: 15,
gndTempSet: 0,
depApt: "",
tropo: 36090,
tropoSet: 0,
toFromSet: 0,
};
@ -173,9 +177,10 @@ var postInit = func() {
}
var FMGCNodes = {
costIndex: props.globals.initNode("/FMGC/internal/cost-index", 0, "DOUBLE"),
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
v1: props.globals.initNode("/FMGC/internal/v1", 0, "DOUBLE"),
v1set: props.globals.initNode("/FMGC/internal/v1-set", 0, "BOOL"),
toFromSet: props.globals.initNode("/FMGC/internal/tofrom-set", 0, "BOOL"),
};
############
@ -889,7 +894,7 @@ var adf1 = func {
#################
var ManagedSPD = maketimer(0.25, func {
if (FMGCInternal.crzSet and getprop("/FMGC/internal/cost-index-set") == 1) {
if (FMGCInternal.crzSet and FMGCInternal.costIndex) {
if (getprop("/it-autoflight/input/spd-managed") == 1) {
altitude = getprop("/instrumentation/altimeter/indicated-altitude-ft");
mode = getprop("/modes/pfd/fma/pitch-mode");
@ -1109,8 +1114,8 @@ setlistener("/FMGC/internal/fuel-calculating", func() {
var timer30secLanding = maketimer(1, func() {
if (pts.Sim.Time.elapsedSec.getValue() > getprop("/FMGC/internal/landing-time") + 30) {
setprop("/FMGC/status/phase", 7);
if (getprop("/FMGC/internal/cost-index-set")) {
setprop("/FMGC/internal/last-cost-index", getprop("/FMGC/internal/cost-index"));
if (FMGCInternal.costIndexSet) {
setprop("/FMGC/internal/last-cost-index", FMGCInternal.costIndex);
} else {
setprop("/FMGC/internal/last-cost-index", 0);
}

View file

@ -218,10 +218,11 @@ var fuelPredInput = func(key, i) {
mcdu_message(i, "NOT ALLOWED");
}
if (!getprop("/FMGC/internal/cost-index-set") and fmgc.FMGCInternal.toFromSet) {
if (!fmgc.FMGCInternal.costIndexSet and fmgc.FMGCInternal.toFromSet) {
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0);
fmgc.FMGCInternal.costIndexSet = 1;
fmgc.FMGCInternal.costIndex = getprop("/FMGC/internal/last-cost-index") or 0;
fmgc.FMGCNodes.setValue(fmgc.FMGCInternal.costIndex);
}
}
} else if (key == "R4") {

View file

@ -60,16 +60,17 @@ var initInputA = func(key, i) {
}
} else if (key == "L5") {
if (scratchpad == "CLR") {
setprop("/FMGC/internal/cost-index", 0);
setprop("/FMGC/internal/cost-index-set", 0);
fmgc.FMGCInternal.costIndex = 0;
fmgc.FMGCInternal.costIndexSet = 0;
fmgc.FMGCNodes.costIndex.setValue(0);
mcdu_scratchpad.scratchpads[i].empty();
} else {
var ci = int(scratchpad);
var cis = size(scratchpad);
if (cis >= 1 and cis <= 3) {
if (ci != nil and ci >= 0 and ci <= 999) {
setprop("/FMGC/internal/cost-index", ci);
setprop("/FMGC/internal/cost-index-set", 1);
fmgc.FMGCInternal.costIndex = ci;
fmgc.FMGCInternal.costIndexSet = 1;
mcdu_scratchpad.scratchpads[i].empty();
} else {
mcdu_message(i, "NOT ALLOWED");

View file

@ -233,10 +233,11 @@ var initInputB = func(key, i) {
mcdu_message(i, "NOT ALLOWED");
}
if (!getprop("/FMGC/internal/cost-index-set") and fmgc.FMGCInternal.toFromSet) {
if (!fmgc.FMGCInternal.costIndexSet and fmgc.FMGCInternal.toFromSet) {
mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0);
setprop("/FMGC/internal/cost-index-set", 1);
setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0);
fmgc.FMGCInternal.costIndexSet = 1;
fmgc.FMGCInternal.costIndex = getprop("/FMGC/internal/last-cost-index") or 0;
fmgc.FMGCNodes.setValue(fmgc.FMGCInternal.costIndex);
}
}
} else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) {

View file

@ -50,28 +50,28 @@ var MCDU_reset = func(i) {
setprop("/FMGC/internal/adf2freq-set", 0);
# INT-A
fmgc.FMGCInternal.flightNum = "";
fmgc.FMGCInternal.flightNumSet = 0;
fmgc.FMGCInternal.arrApt = "";
fmgc.FMGCInternal.depApt = "";
fmgc.FMGCInternal.toFromSet = 0;
fmgc.FMGCNodes.toFromSet.setValue(0);
fmgc.FMGCInternal.altAirport = "";
fmgc.FMGCInternal.altAirportSet = 0;
setprop("/FMGC/internal/cost-index", "0");
setprop("/FMGC/internal/cost-index-set", 0);
fmgc.FMGCInternal.arrApt = "";
fmgc.FMGCInternal.costIndex = 0;
fmgc.FMGCInternal.costIndexSet = 0;
fmgc.FMGCInternal.crzFt = 10000;
fmgc.altvert();
fmgc.updateRouteManagerAlt();
fmgc.FMGCInternal.crzFl = 100;
fmgc.FMGCInternal.crzSet = 0;
updateCrzLvlCallback();
fmgc.FMGCInternal.tropo = 36090;
fmgc.FMGCInternal.tropoSet = 0;
fmgc.FMGCInternal.crzTemp = 15;
fmgc.FMGCInternal.crzTempSet = 0;
fmgc.FMGCInternal.depApt = "";
fmgc.FMGCInternal.flightNum = "";
fmgc.FMGCInternal.flightNumSet = 0;
fmgc.FMGCInternal.gndTemp = -99;
fmgc.FMGCInternal.gndTempSet = 0;
fmgc.FMGCInternal.toFromSet = 0;
fmgc.FMGCNodes.toFromSet.setValue(0);
fmgc.FMGCInternal.tropo = 36090;
fmgc.FMGCInternal.tropoSet = 0;
# IRSINIT
setprop("/FMGC/internal/align-set", 0);