1
0
Fork 0

Only change the throttle callback when it actually changes

This commit is contained in:
Jonathan Redpath 2022-01-10 16:34:17 +00:00
parent a4a7d0a36e
commit 450637398e
2 changed files with 36 additions and 13 deletions

View file

@ -1066,7 +1066,7 @@ setlistener("/it-autoflight/input/vert", func() {
# Mode Reversions
setlistener(pts.Systems.Navigation.ADR.Output.overspeed, func(v) {
if (v.getBoolValue() and !Output.ap1.getBoolValue() and !Output.ap2.getBoolValue() and Output.athr.getBoolValue() and Modes.PFD.FMA.pitchMode.getValue() == "OP CLB" and Modes.PFD.FMA.throttle.getValue() == "THR CLB") {
if (v.getBoolValue() and !Output.ap1.getBoolValue() and !Output.ap2.getBoolValue() and Output.athr.getBoolValue() and Modes.PFD.FMA.pitchMode == "OP CLB" and Modes.PFD.FMA.throttleMode == "THR CLB") {
Input.fd1.setValue(0);
Input.fd2.setValue(0);
ecam.aural[5].setBoolValue(0);
@ -1077,7 +1077,7 @@ setlistener(pts.Systems.Navigation.ADR.Output.overspeed, func(v) {
}, 0, 0);
setlistener(pts.Systems.Navigation.ADR.Output.underspeed, func(v) {
if (v.getBoolValue() and !Output.ap1.getBoolValue() and !Output.ap2.getBoolValue() and Output.athr.getBoolValue() and Modes.PFD.FMA.pitchMode.getValue() == "OP DES" and Modes.PFD.FMA.throttleMode.getValue() == "THR IDLE") {
if (v.getBoolValue() and !Output.ap1.getBoolValue() and !Output.ap2.getBoolValue() and Output.athr.getBoolValue() and Modes.PFD.FMA.pitchMode == "OP DES" and Modes.PFD.FMA.throttleMode == "THR IDLE") {
Input.fd1.setValue(0);
Input.fd2.setValue(0);
ecam.aural[5].setBoolValue(0);

View file

@ -75,6 +75,7 @@ var athrCallback = func(modeNode, timerNode) {
}
var setAthrArmed = func(value) {
if (Modes.PFD.FMA.athrArmed == value) { return; }
Modes.PFD.FMA.athrArmed = value;
if (Modes.PFD.FMA.athrMode != " ") {
Modes.PFD.FMA.athrModeTime = pts.Sim.Time.elapsedSec.getValue();
@ -137,36 +138,58 @@ var loopFMA = maketimer(0.05, func() {
engout = systems.FADEC.engOut.getValue();
if (state1 == "TOGA" or state2 == "TOGA") {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != " ") {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
}
} else if ((state1 == "MAN THR" and systems.FADEC.manThrAboveMct[0]) or (state2 == "MAN THR" and systems.FADEC.manThrAboveMct[1])) {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != " ") {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
}
} else if ((state1 == "MCT" or state2 == "MCT") and !engout) {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != " ") {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
}
} else if (((state1 == "MAN THR" and !systems.FADEC.manThrAboveMct[0]) or (state2 == "MAN THR" and !systems.FADEC.manThrAboveMct[1])) and !engout) {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != " ") {
setFmaText("throttleMode", " ", throttleModeCallback, "throttleModeTime");
}
} else {
vert = Output.vert.getValue();
if (vert == 4 or vert >= 6 or vert <= 8) {
if (Output.ap1.getBoolValue() or Output.ap2.getBoolValue() or Output.fd1.getBoolValue() or Output.fd2.getBoolValue()) {
thr = Output.thrMode.getValue();
if (thr == 0) {
setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != Input.ktsMach.getValue() ? "MACH" : "SPEED") {
setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime");
}
} else if (thr == 1) {
setFmaText("throttleMode", "THR IDLE", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != "THR IDLE") {
setFmaText("throttleMode", "THR IDLE", throttleModeCallback, "throttleModeTime");
}
} else if (thr == 2) {
if (state1 == "MCT" or state2 == "MCT" and engout) {
setFmaText("throttleMode", "THR MCT", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != "THR MCT") {
setFmaText("throttleMode", "THR MCT", throttleModeCallback, "throttleModeTime");
}
} else if (state1 == "CL" or state2 == "CL") {
setFmaText("throttleMode", "THR CLB", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != "THR CLB") {
setFmaText("throttleMode", "THR CLB", throttleModeCallback, "throttleModeTime");
}
} else {
setFmaText("throttleMode", "THR LVR", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != "THR LVR") {
setFmaText("throttleMode", "THR LVR", throttleModeCallback, "throttleModeTime");
}
}
}
} else {
setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != Input.ktsMach.getValue() ? "MACH" : "SPEED") {
setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime");
}
}
} else {
setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime");
if (fmgc.Modes.PFD.FMA.throttleMode != Input.ktsMach.getValue() ? "MACH" : "SPEED") {
setFmaText("throttleMode", Input.ktsMach.getValue() ? "MACH" : "SPEED", throttleModeCallback, "throttleModeTime");
}
}
}