1
0
Fork 0

FMGC: Fix buggy behavior with boxchk

This commit is contained in:
Josh Davidson 2022-01-09 10:59:14 -05:00
parent 5e0ff63f60
commit a1e8320e0c
3 changed files with 19 additions and 40 deletions

View file

@ -173,7 +173,7 @@ var Custom = {
spdManaged: props.globals.getNode("/it-autoflight/input/spd-managed", 1), spdManaged: props.globals.getNode("/it-autoflight/input/spd-managed", 1),
}, },
Output: { Output: {
fmaPower: props.globals.initNode("/it-autoflight/output/fma-pwr", 0, "BOOL"), fmaPower: 0,
vsFCU: props.globals.initNode("/it-autoflight/output/vs-fcu-display", "", "STRING"), vsFCU: props.globals.initNode("/it-autoflight/output/vs-fcu-display", "", "STRING"),
}, },
Sound: { Sound: {
@ -229,7 +229,7 @@ var ITAF = {
Text.lat.setValue(" "); Text.lat.setValue(" ");
Text.vert.setValue(" "); Text.vert.setValue(" ");
Custom.showHdg.setBoolValue(1); Custom.showHdg.setBoolValue(1);
Custom.Output.fmaPower.setBoolValue(1); Custom.Output.fmaPower = 1;
ManagedSPD.stop(); ManagedSPD.stop();
loopTimer.start(); loopTimer.start();
slowLoopTimer.start(); slowLoopTimer.start();
@ -448,8 +448,8 @@ var ITAF = {
ap1Master: func(s) { ap1Master: func(s) {
if (s == 1) { if (s == 1) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) {
me.revertBasicMode();
Output.ap1.setBoolValue(1); Output.ap1.setBoolValue(1);
me.updateFma();
Output.latTemp = Output.lat.getValue(); Output.latTemp = Output.lat.getValue();
if (Output.ap2.getBoolValue() and !Output.apprArm.getBoolValue() and Output.latTemp != 2 and Output.latTemp != 4) { if (Output.ap2.getBoolValue() and !Output.apprArm.getBoolValue() and Output.latTemp != 2 and Output.latTemp != 4) {
me.ap2Master(0); me.ap2Master(0);
@ -465,12 +465,13 @@ var ITAF = {
if (Input.ap1.getBoolValue() != Output.ap1Temp) { if (Input.ap1.getBoolValue() != Output.ap1Temp) {
Input.ap1.setBoolValue(Output.ap1Temp); Input.ap1.setBoolValue(Output.ap1Temp);
} }
fmaAp();
}, },
ap2Master: func(s) { ap2Master: func(s) {
if (s == 1) { if (s == 1) {
if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) { if (Output.vert.getValue() != 6 and !Gear.wow1.getBoolValue() and !Gear.wow2.getBoolValue() and systems.ELEC.Bus.acEss.getValue() >= 110 and fbw.FBW.apOff == 0 and Position.gearAglFt.getValue() >= 100) {
me.revertBasicMode();
Output.ap2.setBoolValue(1); Output.ap2.setBoolValue(1);
me.updateFma();
Output.latTemp = Output.lat.getValue(); Output.latTemp = Output.lat.getValue();
if (Output.ap1.getBoolValue() and !Output.apprArm.getBoolValue() and Output.latTemp != 2 and Output.latTemp != 4) { if (Output.ap1.getBoolValue() and !Output.apprArm.getBoolValue() and Output.latTemp != 2 and Output.latTemp != 4) {
me.ap1Master(0); me.ap1Master(0);
@ -486,6 +487,7 @@ var ITAF = {
if (Input.ap2.getBoolValue() != Output.ap2Temp) { if (Input.ap2.getBoolValue() != Output.ap2Temp) {
Input.ap2.setBoolValue(Output.ap2Temp); Input.ap2.setBoolValue(Output.ap2Temp);
} }
fmaAp();
}, },
apOffFunction: func() { apOffFunction: func() {
if (!Output.ap1.getBoolValue() and !Output.ap2.getBoolValue()) { # Only do if both APs are off if (!Output.ap1.getBoolValue() and !Output.ap2.getBoolValue()) { # Only do if both APs are off
@ -515,6 +517,7 @@ var ITAF = {
if (Input.athr.getBoolValue() != Output.athrTemp) { if (Input.athr.getBoolValue() != Output.athrTemp) {
Input.athr.setBoolValue(Output.athrTemp); Input.athr.setBoolValue(Output.athrTemp);
} }
fmaAthr();
}, },
fd1Master: func(s) { fd1Master: func(s) {
if (s == 1) { if (s == 1) {
@ -530,6 +533,7 @@ var ITAF = {
if (Input.fd1.getBoolValue() != Output.fd1Temp) { if (Input.fd1.getBoolValue() != Output.fd1Temp) {
Input.fd1.setBoolValue(Output.fd1Temp); Input.fd1.setBoolValue(Output.fd1Temp);
} }
fmaFd();
}, },
fd2Master: func(s) { fd2Master: func(s) {
if (s == 1) { if (s == 1) {
@ -545,6 +549,7 @@ var ITAF = {
if (Input.fd2.getBoolValue() != Output.fd2Temp) { if (Input.fd2.getBoolValue() != Output.fd2Temp) {
Input.fd2.setBoolValue(Output.fd2Temp); Input.fd2.setBoolValue(Output.fd2Temp);
} }
fmaFd();
}, },
setLatMode: func(n) { setLatMode: func(n) {
Output.vertTemp = Output.vert.getValue(); Output.vertTemp = Output.vert.getValue();
@ -596,7 +601,9 @@ var ITAF = {
Text.lat.setValue("T/O"); Text.lat.setValue("T/O");
me.armTextCheck(); me.armTextCheck();
} else if (n == 9) { # NONE } else if (n == 9) { # NONE
Output.lnavArm.setBoolValue(0);
Output.locArm.setBoolValue(0); Output.locArm.setBoolValue(0);
Output.apprArm.setBoolValue(0);
Output.lat.setValue(9); Output.lat.setValue(9);
Custom.showHdg.setBoolValue(1); Custom.showHdg.setBoolValue(1);
Text.lat.setValue(" "); Text.lat.setValue(" ");
@ -882,9 +889,10 @@ var ITAF = {
me.setLatMode(9); me.setLatMode(9);
me.setVertMode(9); me.setVertMode(9);
me.setLatArm(0); me.setLatArm(0);
Custom.Output.fmaPower.setBoolValue(0); Custom.Output.fmaPower = 0;
} else { } else {
Custom.Output.fmaPower.setBoolValue(1); if (!Custom.Output.fmaPower) showAllBoxes();
Custom.Output.fmaPower = 1;
me.revertBasicMode(); me.revertBasicMode();
} }
}, },

View file

@ -513,7 +513,7 @@ setlistener("/it-autoflight/output/appr-armed", func {
}); });
# AP # AP
var ap = func { var fmaAp = func {
ap1 = Output.ap1.getValue(); ap1 = Output.ap1.getValue();
ap2 = Output.ap2.getValue(); ap2 = Output.ap2.getValue();
newap = Modes.PFD.FMA.apMode.getValue(); newap = Modes.PFD.FMA.apMode.getValue();
@ -529,7 +529,7 @@ var ap = func {
} }
# FD # FD
var fd = func { var fmaFd = func {
fd1 = Output.fd1.getValue(); fd1 = Output.fd1.getValue();
fd2 = Output.fd2.getValue(); fd2 = Output.fd2.getValue();
newfd = Modes.PFD.FMA.fdMode.getValue(); newfd = Modes.PFD.FMA.fdMode.getValue();
@ -544,8 +544,8 @@ var fd = func {
} }
} }
# AT # A/THR
var atMode = func { var fmaAthr = func {
at = Output.athr.getValue(); at = Output.athr.getValue();
if (at and Modes.PFD.FMA.athrMode.getValue() != "A/THR") { if (at and Modes.PFD.FMA.athrMode.getValue() != "A/THR") {
Modes.PFD.FMA.athrMode.setValue("A/THR"); Modes.PFD.FMA.athrMode.setValue("A/THR");
@ -554,14 +554,7 @@ var atMode = func {
} }
} }
var boxchk = func { var showAllBoxes = func {
if ((Output.ap1.getValue() or Output.ap2.getValue() or Output.fd1.getValue() or Output.fd2.getValue()) and !Custom.Output.fmaPower.getValue()) {
Input.lat.setValue(3);
boxchk_b();
}
}
var boxchk_b = func {
if (Modes.PFD.FMA.rollMode.getValue() != " ") { if (Modes.PFD.FMA.rollMode.getValue() != " ") {
Modes.PFD.FMA.rollModeTime.setValue(pts.Sim.Time.elapsedSec.getValue()); Modes.PFD.FMA.rollModeTime.setValue(pts.Sim.Time.elapsedSec.getValue());
} }
@ -579,27 +572,6 @@ var boxchk_b = func {
} }
} }
# Update AP FD ATHR
setlistener("/it-autoflight/output/ap1", func {
ap();
boxchk();
});
setlistener("/it-autoflight/output/ap2", func {
ap();
boxchk();
});
setlistener("/it-autoflight/output/fd1", func {
fd();
boxchk();
});
setlistener("/it-autoflight/output/fd2", func {
fd();
boxchk();
});
setlistener("/it-autoflight/output/athr", func {
atMode();
});
# Boxes # Boxes
setlistener("/modes/pfd/fma/ap-mode", func { setlistener("/modes/pfd/fma/ap-mode", func {
if (Modes.PFD.FMA.apMode.getValue() != " ") { if (Modes.PFD.FMA.apMode.getValue() != " ") {

View file

@ -42,7 +42,6 @@ var tempOverspeed = nil;
setprop("/position/gear-agl-ft", 0); setprop("/position/gear-agl-ft", 0);
setprop("/it-autoflight/settings/accel-agl-ft", 1500); #eventually set to 1500 above runway 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/internal/vert-speed-fpm", 0);
setprop("/it-autoflight/output/fma-pwr", 0);
setprop("/instrumentation/nav[0]/nav-id", "XXX"); setprop("/instrumentation/nav[0]/nav-id", "XXX");
setprop("/instrumentation/nav[1]/nav-id", "XXX"); setprop("/instrumentation/nav[1]/nav-id", "XXX");