if (me.Limit.flexActiveCmd.getBoolValue() and !me.n1Mode[0].getValue() and !me.n1Mode[1].getValue() and pts.Gear.wowTemp[1] and pts.Gear.wowTemp[2] and pts.Velocities.groundspeedKt.getValue() < 40 and (pts.Engines.Engine.stateTemp[0] == 3 or pts.Engines.Engine.stateTemp[1] == 3)) {
if (!me.Limit.flexActive.getBoolValue()) {
me.Limit.flexActive.setBoolValue(1);
}
} else if (!me.Limit.flexActiveCmd.getBoolValue() or pts.Engines.Engine.stateTemp[0] != 3 or pts.Engines.Engine.stateTemp[1] != 3) {
if (!pts.Gear.wow[1].getValue() and !pts.Gear.wow[2].getValue() and (pts.Engines.Engine.state[0].getValue() != 3 or pts.Engines.Engine.state[1].getValue() != 3)) {
systems.FADEC.engOut.setValue(1)
} else {
systems.FADEC.engOut.setValue(0)
}
if (me.detentTextTemp[0] == "CL" and me.detentTextTemp[1] == "CL" and me.engOut.getValue() != 1) {
me.lvrClb.setValue(0);
} else if (me.detentTextTemp[0] == "MCT" and me.detentTextTemp[1] == "MCT" and !me.Limit.flexActive.getBoolValue() and me.engOut.getValue()) {
me.lvrClb.setValue(0);
} else {
me.lvrClbStatus = me.lvrClb.getValue();
if (me.lvrClbStatus == 0) {
if (!pts.Gear.wow[0].getValue()) {
if (systems.FADEC.detentText[0].getValue() == "MAN" or systems.FADEC.detentText[1].getValue() == "MAN") {
me.lvrClb.setValue(1);
} else {
if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= me.clbReduc.getValue() and !pts.Gear.wow[1].getValue() and !pts.Gear.wow[2].getValue()) {
me.lvrClb.setValue(1);
} else if ((me.detentTextTemp[0] == "CL" and me.detentTextTemp[1] != "CL") or (me.detentTextTemp[0] != "CL" and me.detentTextTemp[1] == "CL") and me.engOut.getValue() != 1) {
if ((state1 == "CL" and state2 == "CL" and !systems.FADEC.engOut.getValue()) or (state1 == "MCT" and state2 == "MCT" and systems.FADEC.engOut.getValue())) {
if (FADEC.Lock.thrLockTime.getValue() + 5 > pts.Sim.Time.elapsedSec.getValue()) { return; }
if (fmgc.Output.athr.getBoolValue()) {
lockTimer.stop();
FADEC.Lock.thrLockCmd.setValue(0);
FADEC.Lock.thrLockAlert.setValue(0);
FADEC.Lock.thrLockTime.setValue(0);
FADEC.Lock.thrLockFlash.setValue(0);
return;
}
if (!FADEC.Lock.thrLockCmd.getValue()) {
lockTimer.stop();
FADEC.Lock.thrLockCmd.setValue(0);
FADEC.Lock.thrLockAlert.setValue(0);
FADEC.Lock.thrLockTime.setValue(0);
FADEC.Lock.thrLockFlash.setValue(0);
return;
}
state1 = systems.FADEC.detentText[0].getValue();
state2 = systems.FADEC.detentText[1].getValue();
if ((state1 != "CL" and state2 != "CL" and !systems.FADEC.engOut.getValue()) or (state1 != "MCT" and state2 != "MCT" and systems.FADEC.engOut.getValue())) {
lockTimer.stop();
FADEC.Lock.thrLockCmd.setValue(0);
FADEC.Lock.thrLockAlert.setValue(0);
FADEC.Lock.thrLockTime.setValue(0);
FADEC.Lock.thrLockFlash.setValue(0);
} elsif ((state1 == "CL" and state2 == "CL" and !systems.FADEC.engOut.getValue()) or (state1 == "MCT" and state2 == "MCT" and systems.FADEC.engOut.getValue())) {
if ((state1 != "CL" and state2 != "CL" and !systems.FADEC.engOut.getValue()) or (state1 != "MCT" and state2 != "MCT" and systems.FADEC.engOut.getValue())) {