Bugfixes, new CLR function, fix FBW -> autopilot failures, etc
This commit is contained in:
parent
dc3ba09707
commit
b61b45abde
8 changed files with 75 additions and 38 deletions
|
@ -25,6 +25,9 @@ var statusIndex = 0;
|
|||
var flash = 0;
|
||||
var hasCleared = 0;
|
||||
var statusFlag = 0;
|
||||
var counter = 0;
|
||||
var noMainMsg = 0;
|
||||
var storeFirstWarning = nil;
|
||||
|
||||
var warning = {
|
||||
new: func(msg,colour = "g",aural = 9,light = 9,isMainMsg = 0,lastSubmsg = 0, sdPage = "nil", isMemo = 0) {
|
||||
|
@ -91,11 +94,13 @@ var warning = {
|
|||
|
||||
if (me.aural != 0) {
|
||||
aural[me.aural].setBoolValue(0);
|
||||
settimer(func() {
|
||||
aural[me.aural].setBoolValue(1);
|
||||
}, 0.15);
|
||||
} else {
|
||||
aural[me.aural].setBoolValue(1);
|
||||
}
|
||||
me.noRepeat2 = 1;
|
||||
settimer(func() {
|
||||
aural[me.aural].setBoolValue(1);
|
||||
}, 0.15);
|
||||
},
|
||||
callPage: func() {
|
||||
if (me.sdPage == "nil" or me.hasCalled == 1) { return; }
|
||||
|
@ -203,12 +208,13 @@ var ECAM_controller = {
|
|||
|
||||
if (!getprop("/systems/acconfig/autoconfig-running")) {
|
||||
foreach (var w; warnings.vector) {
|
||||
if (counter >= 9) { break; }
|
||||
if (w.active == 1) {
|
||||
w.write();
|
||||
if (counter < 9) {
|
||||
w.write();
|
||||
counter += 1;
|
||||
}
|
||||
w.warnlight();
|
||||
w.sound();
|
||||
counter += 1;
|
||||
} elsif (w.wasActive == 1) {
|
||||
w.warnlight();
|
||||
w.sound();
|
||||
|
@ -286,8 +292,26 @@ var ECAM_controller = {
|
|||
clear: func() {
|
||||
hasCleared = 0;
|
||||
counter = 0;
|
||||
noMainMsg = 0;
|
||||
storeFirstWarning = nil;
|
||||
|
||||
if (leftOverflow.getBoolValue()) {
|
||||
# first go through the first eight, see how many mainMsg there are
|
||||
foreach (var w; warnings.vector) {
|
||||
if (counter >= 8) { break; }
|
||||
if (w.active == 1 and w.clearFlag != 1 and w.isMemo != 1) {
|
||||
counter += 1;
|
||||
if (w.isMainMsg == 1) {
|
||||
if (noMainMsg == 0) {
|
||||
storeFirstWarning = w;
|
||||
}
|
||||
noMainMsg += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# then, if there is an overflow and noMainMsg == 1, we clear the first shown ones
|
||||
if (leftOverflow.getBoolValue() and noMainMsg == 1) {
|
||||
counter = 0;
|
||||
foreach (var w; warnings.vector) {
|
||||
if (counter >= 8) { break; }
|
||||
if (w.active == 1 and w.clearFlag != 1 and w.isMemo != 1) {
|
||||
|
@ -296,17 +320,17 @@ var ECAM_controller = {
|
|||
w.clearFlag = 1;
|
||||
hasCleared = 1;
|
||||
statusFlag = 1;
|
||||
libraries.ECAMControlPanel.lightOff("clr");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (var w; warnings.vector) {
|
||||
if (w.active == 1 and w.clearFlag != 1 and w.isMainMsg == 1 and w.isMemo != 1) {
|
||||
w.clearFlag = 1;
|
||||
}
|
||||
|
||||
# else, we clear the first mainMsg stored
|
||||
else {
|
||||
if (storeFirstWarning != nil) {
|
||||
if (storeFirstWarning.active == 1 and storeFirstWarning.clearFlag != 1 and storeFirstWarning.isMainMsg == 1 and storeFirstWarning.isMemo != 1) {
|
||||
storeFirstWarning.clearFlag = 1;
|
||||
hasCleared = 1;
|
||||
statusFlag = 1;
|
||||
libraries.ECAMControlPanel.lightOff("clr");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -742,11 +742,6 @@ var messages_priority_3 = func {
|
|||
ap_offw.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(ap_offw);
|
||||
if (getprop("/it-autoflight/output/ap-warning") == 2) {
|
||||
setprop("/it-autoflight/output/ap-warning", 0);
|
||||
setprop("/ECAM/Lower/light/clr", 0);
|
||||
setprop("/ECAM/warnings/master-warning-light", 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (!systems.cargoTestBtn.getBoolValue()) {
|
||||
|
@ -1481,7 +1476,7 @@ var messages_right_memo = func {
|
|||
ldg_inhibit.active = 0;
|
||||
}
|
||||
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/systems/fire/engine1/warning-active") == 1 or getprop("/systems/fire/engine2/warning-active") == 1 or getprop("/systems/fire/apu/warning-active") == 1 or getprop("/systems/failures/cargo-aft-fire") == 1 or getprop("/systems/failures/cargo-fwd-fire") == 1) or (((getprop("/systems/hydraulic/green-psi") < 1500 and getprop("/engines/engine[0]/state") == 3) and (getprop("/systems/hydraulic/yellow-psi") < 1500 and getprop("/engines/engine[1]/state") == 3)) or ((getprop("/systems/hydraulic/green-psi") < 1500 or getprop("/systems/hydraulic/yellow-psi") < 1500) and getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") == 3) and phaseVar >= 3 and phaseVar <= 8)) {
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (getprop("/systems/electrical/some-electric-thingie/emer-elec-config") or getprop("/systems/fire/engine1/warning-active") == 1 or getprop("/systems/fire/engine2/warning-active") == 1 or getprop("/systems/fire/apu/warning-active") == 1 or getprop("/systems/failures/cargo-aft-fire") == 1 or getprop("/systems/failures/cargo-fwd-fire") == 1) or (((getprop("/systems/hydraulic/green-psi") < 1500 and getprop("/engines/engine[0]/state") == 3) and (getprop("/systems/hydraulic/yellow-psi") < 1500 and getprop("/engines/engine[1]/state") == 3)) or ((getprop("/systems/hydraulic/green-psi") < 1500 or getprop("/systems/hydraulic/yellow-psi") < 1500) and getprop("/engines/engine[0]/state") == 3 and getprop("/engines/engine[1]/state") == 3) and phaseVar >= 3 and phaseVar <= 8)) {
|
||||
# todo: emer elec
|
||||
land_asap_r.active = 1;
|
||||
} else {
|
||||
|
|
|
@ -324,15 +324,17 @@ var ECAMControlPanel = {
|
|||
},
|
||||
clrBtn: func() {
|
||||
me.lightOff("clr");
|
||||
if (athrWarnNode.getValue() == 2) {
|
||||
athrWarnNode.setValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (apWarnNode.getValue() == 2) {
|
||||
apWarnNode.setValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (athrWarnNode.getValue() == 2) {
|
||||
athrWarnNode.setValue(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (SystemDisplay.manShownPage) {
|
||||
me.lightOff(SystemDisplay.page);
|
||||
SystemDisplay.manShownPage = 0;
|
||||
|
|
|
@ -123,7 +123,7 @@ var warnings = std.Vector.new([
|
|||
var park_brk_config = warning.new(msg: "CONFIG PARK BRK ON", colour: "r", aural: 0, light: 0),
|
||||
|
||||
# Autopilot off involuntary
|
||||
var ap_offw = warning.new(msg: "AUTO FLT AP OFF", colour: "r", light: 0),
|
||||
var ap_offw = warning.new(msg: "AUTO FLT AP OFF", colour: "r", light: 0, isMainMsg: 1),
|
||||
|
||||
# Cargo smoke
|
||||
var cargoSmokeFwd = warning.new(msg: "SMOKE FWD CARGO SMOKE", colour: "r", aural: 0, light: 0, isMainMsg: 1),
|
||||
|
|
|
@ -269,15 +269,28 @@ var update_loop = func {
|
|||
if (!elac1 and !elac2) {
|
||||
if (law == 0) {
|
||||
FBW.degradeLaw.setValue(1);
|
||||
fcu.apOff("hard", 0);
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
}
|
||||
if (getprop("/systems/electrical/some-electric-thingie/emer-elec-config") == 1) {
|
||||
if (law == 0) {
|
||||
FBW.degradeLaw.setValue(1);
|
||||
fcu.apOff("hard", 0);
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
}
|
||||
if ((blue >= 1500 and green < 1500 and yellow < 1500) or (blue < 1500 and green < 1500 and yellow >= 1500)) {
|
||||
if (law == 0 or law == 1) {
|
||||
FBW.degradeLaw.setValue(2);
|
||||
fcu.apOff("hard", 0);
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
}
|
||||
if (dc_ess < 25 and dc2 < 25) {
|
||||
FBW.degradeLaw.setValue(3);
|
||||
fcu.apOff("hard", 0);
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,6 +386,7 @@ var fbw_loop = func {
|
|||
if (FBW.activeLaw.getValue() != 0) {
|
||||
if (getprop("/it-autoflight/output/ap1") == 1 or getprop("/it-autoflight/output/ap2") == 1) {
|
||||
fcu.apOff("hard", 0);
|
||||
fcu.athrOff("hard");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ var FCUController = {
|
|||
me.FCU2.restore();
|
||||
},
|
||||
AP1: func() {
|
||||
if (me.FCUworking) {
|
||||
if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) {
|
||||
if (!ap1.getBoolValue()) {
|
||||
ap1Input.setValue(1);
|
||||
libraries.apWarnNode.setValue(0);
|
||||
|
@ -110,7 +110,7 @@ var FCUController = {
|
|||
}
|
||||
},
|
||||
AP2: func() {
|
||||
if (me.FCUworking) {
|
||||
if (me.FCUworking and fbw.FBW.activeLaw.getValue() == 0) {
|
||||
if (!ap2.getBoolValue()) {
|
||||
ap2Input.setValue(1);
|
||||
} else {
|
||||
|
@ -119,8 +119,8 @@ var FCUController = {
|
|||
}
|
||||
},
|
||||
ATHR: func() {
|
||||
if (me.FCUworking) {
|
||||
if (!athr.getBoolValue() and !pts.FMGC.CasCompare.rejectAll.getBoolValue()) {
|
||||
if (me.FCUworking and !pts.FMGC.CasCompare.rejectAll.getBoolValue() and fbw.FBW.activeLaw.getValue() == 0) {
|
||||
if (!athr.getBoolValue()) {
|
||||
athrInput.setValue(1);
|
||||
} else {
|
||||
athrOff("hard");
|
||||
|
@ -477,6 +477,10 @@ var updateActiveFMGC = func {
|
|||
|
||||
# Autopilot Disconnection
|
||||
var apOff = func(type, side) {
|
||||
if ((ap1Input.getValue() and (side == 1 or side == 0)) or (ap2Input.getValue() and (side == 2 or side == 0))) {
|
||||
libraries.doApWarn(type);
|
||||
}
|
||||
|
||||
if (side == 0) {
|
||||
ap1Input.setValue(0);
|
||||
ap2Input.setValue(0);
|
||||
|
@ -485,18 +489,17 @@ var apOff = func(type, side) {
|
|||
} elsif (side == 2) {
|
||||
ap2Input.setValue(0);
|
||||
}
|
||||
libraries.doApWarn(type);
|
||||
}
|
||||
|
||||
# Autothrust Disconnection
|
||||
var athrOff = func(type) {
|
||||
if (type == "hard") {
|
||||
fadec.lockThr();
|
||||
if (athrInput.getValue() == 1) {
|
||||
if (type == "hard") {
|
||||
fadec.lockThr();
|
||||
}
|
||||
athrInput.setValue(0);
|
||||
libraries.doAthrWarn(type);
|
||||
}
|
||||
|
||||
athrInput.setValue(0);
|
||||
|
||||
libraries.doAthrWarn(type);
|
||||
}
|
||||
|
||||
# If the heading knob is turned while in nav mode, it will display heading for a period of time
|
||||
|
|
|
@ -367,8 +367,6 @@ var ITAF = {
|
|||
# Misc
|
||||
if (Output.ap1Temp == 1 or Output.ap2Temp == 1) { # Trip AP off
|
||||
if (abs(Control.aileron.getValue()) >= 0.2 or abs(Control.elevator.getValue()) >= 0.2 or abs(Control.rudder.getValue()) >= 0.2) {
|
||||
me.ap1Master(0);
|
||||
me.ap2Master(0);
|
||||
fcu.apOff("hard", 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,6 +373,7 @@
|
|||
|
||||
<!-- Emergency Generator -->
|
||||
<switch name="/systems/electrical/some-electric-thingie/rat-deploy">
|
||||
<default value="/systems/electrical/some-electric-thingie/rat-deploy"/>
|
||||
<test logic="AND" value="1">
|
||||
/instrumentation/airspeed-indicator/indicated-speed-kt gt 100
|
||||
/systems/electrical/bus/ac-1 eq 0
|
||||
|
|
Loading…
Add table
Reference in a new issue