fix messages
This commit is contained in:
parent
c05eaeacaa
commit
c6af8d90f5
4 changed files with 146 additions and 14 deletions
|
@ -30,7 +30,7 @@ var hasCleared = 0;
|
|||
var statusFlag = 0;
|
||||
|
||||
var warning = {
|
||||
new: func(msg,colour = "g",aural = 9,light = 9,hasSubmsg = 0,lastSubmsg = 0) {
|
||||
new: func(msg,colour = "g",aural = 9,light = 9,hasSubmsg = 0,lastSubmsg = 0, sdPage = "nil") {
|
||||
var t = {parents:[warning]};
|
||||
|
||||
t.msg = msg;
|
||||
|
@ -43,6 +43,8 @@ var warning = {
|
|||
t.noRepeat = 0;
|
||||
t.noRepeat2 = 0;
|
||||
t.clearFlag = 0;
|
||||
t.sdPage = sdPage;
|
||||
t.hasCalled = 0;
|
||||
|
||||
return t
|
||||
},
|
||||
|
@ -77,6 +79,11 @@ var warning = {
|
|||
aural[me.aural].setBoolValue(1);
|
||||
}, 0.15);
|
||||
},
|
||||
callPage: func() {
|
||||
if (me.sdPage == "nil" or me.hasCalled == 1) { return; }
|
||||
#libraries.LowerECAM.failCall(me.sdPage);
|
||||
me.hasCalled = 1;
|
||||
}
|
||||
};
|
||||
|
||||
var memo = {
|
||||
|
@ -179,6 +186,7 @@ var ECAM_controller = {
|
|||
if (w2.noRepeat2 == 0) {
|
||||
w2.sound();
|
||||
}
|
||||
w2.callPage();
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,6 +245,12 @@ var messages_priority_3 = func {
|
|||
ECAM_controller.warningReset(eng2FireGn);
|
||||
}
|
||||
|
||||
if (apuFireMaster.clearFlag == 0 and getprop("/systems/fire/apu/warning-active") == 1) {
|
||||
apuFire.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(apuFire);
|
||||
}
|
||||
|
||||
if (eng1FireFl.active == 1) {
|
||||
eng1FireFllever.active = 1;
|
||||
eng1FireFlmaster.active = 1;
|
||||
|
@ -263,6 +269,38 @@ var messages_priority_3 = func {
|
|||
ECAM_controller.warningReset(eng1FireFlAgent2);
|
||||
}
|
||||
|
||||
if (eng1FireGn.active == 1) {
|
||||
eng1FireGnlever.active = 1;
|
||||
eng1FireGnstopped.active = 1;
|
||||
eng1FireGnparkbrk.active = 1;
|
||||
eng1FireGnmaster.active = 1;
|
||||
eng1FireGnPB.active = 1;
|
||||
eng1FireGnAgent1.active = 1;
|
||||
eng1FireGnAgent2.active = 1;
|
||||
eng1FireGnmaster2.active = 1;
|
||||
eng1FireGnATC.active = 1;
|
||||
eng1FireGncrew.active = 1;
|
||||
eng1FireGnevac.active = 1;
|
||||
eng1FireGnevacSw.active = 1;
|
||||
eng1FireGnevacApu.active = 1;
|
||||
eng1FireGnevacBat.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(eng1FireGnlever);
|
||||
ECAM_controller.warningReset(eng1FireGnstopped);
|
||||
ECAM_controller.warningReset(eng1FireGnparkbrk);
|
||||
ECAM_controller.warningReset(eng1FireGnmaster);
|
||||
ECAM_controller.warningReset(eng1FireGnPB);
|
||||
ECAM_controller.warningReset(eng1FireGnAgent1);
|
||||
ECAM_controller.warningReset(eng1FireGnAgent2);
|
||||
ECAM_controller.warningReset(eng1FireGnmaster2);
|
||||
ECAM_controller.warningReset(eng1FireGnATC);
|
||||
ECAM_controller.warningReset(eng1FireGncrew);
|
||||
ECAM_controller.warningReset(eng1FireGnevac);
|
||||
ECAM_controller.warningReset(eng1FireGnevacSw);
|
||||
ECAM_controller.warningReset(eng1FireGnevacApu);
|
||||
ECAM_controller.warningReset(eng1FireGnevacBat);
|
||||
}
|
||||
|
||||
if (eng2FireFl.active == 1) {
|
||||
eng2FireFllever.active = 1;
|
||||
eng2FireFlmaster.active = 1;
|
||||
|
@ -281,6 +319,61 @@ var messages_priority_3 = func {
|
|||
ECAM_controller.warningReset(eng2FireFlAgent2);
|
||||
}
|
||||
|
||||
if (eng2FireGn.active == 1) {
|
||||
eng2FireGnlever.active = 1;
|
||||
eng2FireGnstopped.active = 1;
|
||||
eng2FireGnparkbrk.active = 1;
|
||||
eng2FireGnmaster.active = 1;
|
||||
eng2FireGnPB.active = 1;
|
||||
eng2FireGnAgent1.active = 1;
|
||||
eng2FireGnAgent2.active = 1;
|
||||
eng2FireGnmaster2.active = 1;
|
||||
eng2FireGnATC.active = 1;
|
||||
eng2FireGncrew.active = 1;
|
||||
eng2FireGnevac.active = 1;
|
||||
eng2FireGnevacSw.active = 1;
|
||||
eng2FireGnevacApu.active = 1;
|
||||
eng2FireGnevacBat.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(eng2FireGnlever);
|
||||
ECAM_controller.warningReset(eng2FireGnstopped);
|
||||
ECAM_controller.warningReset(eng2FireGnparkbrk);
|
||||
ECAM_controller.warningReset(eng2FireGnmaster);
|
||||
ECAM_controller.warningReset(eng2FireGnPB);
|
||||
ECAM_controller.warningReset(eng2FireGnAgent1);
|
||||
ECAM_controller.warningReset(eng2FireGnAgent2);
|
||||
ECAM_controller.warningReset(eng2FireGnmaster2);
|
||||
ECAM_controller.warningReset(eng2FireGnATC);
|
||||
ECAM_controller.warningReset(eng2FireGncrew);
|
||||
ECAM_controller.warningReset(eng2FireGnevac);
|
||||
ECAM_controller.warningReset(eng2FireGnevacSw);
|
||||
ECAM_controller.warningReset(eng2FireGnevacApu);
|
||||
ECAM_controller.warningReset(eng2FireGnevacBat);
|
||||
}
|
||||
|
||||
# APU Fire
|
||||
if (apuFire.active == 1) {
|
||||
if (apuFirePB.clearFlag == 0 and !getprop("/controls/APU/fire-btn")) {
|
||||
apuFirePB.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(apuFirePB);
|
||||
}
|
||||
if (apuFireAgent.clearFlag == 0 and !getprop("/systems/fire/apu/disch")) {
|
||||
apuFireAgent.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(apuFireAgent);
|
||||
}
|
||||
if (apuFireMaster.clearFlag == 0 and getprop("/controls/APU/master")) {
|
||||
apuFireMaster.active = 1;
|
||||
} else {
|
||||
ECAM_controller.warningReset(apuFireMaster);
|
||||
}
|
||||
} else {
|
||||
ECAM_controller.warningReset(apuFirePB);
|
||||
ECAM_controller.warningReset(apuFireAgent);
|
||||
ECAM_controller.warningReset(apuFireMaster);
|
||||
}
|
||||
|
||||
# CONFIG
|
||||
if ((slats_config.clearFlag == 0) and (getprop("/controls/flight/flap-lever") == 0 or getprop("/controls/flight/flap-lever")) == 4 and phaseVar >= 3 and phaseVar <= 4) {
|
||||
slats_config.active = 1;
|
||||
|
@ -439,7 +532,7 @@ var messages_right_memo = func {
|
|||
ldg_inhibit.active = 0;
|
||||
}
|
||||
|
||||
if ((getprop("/gear/gear[1]/wow") == 0) and (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/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 {
|
||||
|
|
|
@ -96,6 +96,12 @@ var warnings = std.Vector.new([
|
|||
var eng2FireGnevacApu = warning.new(msg: " -APU MASTER SW......OFF", colour: "c"),
|
||||
var eng2FireGnevacBat = warning.new(msg: " -BAT 1+2............OFF", colour: "c"),
|
||||
|
||||
# APU FIRE
|
||||
var apuFire = warning.new(msg: "APU FIRE ", colour: "r", aural: 0, light: 0, hasSubmsg: 1, sdPage: "apu"),
|
||||
var apuFirePB = warning.new(msg: " -APU FIRE P/B......PUSH", colour: "c"),
|
||||
var apuFireAgent = warning.new(msg: " -AGENT AFT 10 S...DISCH", colour: "c"),
|
||||
var apuFireMaster = warning.new(msg: " -MASTER SW..........OFF", colour: "c"),
|
||||
|
||||
# Config
|
||||
var slats_config = warning.new(msg: "CONFIG", colour: "r", aural: 0, light: 0),
|
||||
var slats_config_1 = warning.new(msg: "SLATS NOT IN T.O. CONFIG", colour: "r", aural: 0, light: 0),
|
||||
|
|
|
@ -216,16 +216,19 @@ var engFireDetectorUnit = {
|
|||
loopOne: 0,
|
||||
loopTwo: 0,
|
||||
condition: 100,
|
||||
wow: "",
|
||||
new: func(sys) {
|
||||
var eF = {parents:[engFireDetectorUnit]};
|
||||
eF.sys = sys;
|
||||
eF.active = 0;
|
||||
eF.loopOne = 0;
|
||||
eF.loopTwo = 0;
|
||||
|
||||
eF.wow = props.globals.getNode("/fdm/jsbsim/position/wow", 1);
|
||||
return eF;
|
||||
},
|
||||
update: func() {
|
||||
if (me.condition == 0) { return; }
|
||||
|
||||
foreach(var detector; detectorLoops.vector) {
|
||||
detector.updateTemp(detector.sys, detector.type);
|
||||
}
|
||||
|
@ -235,12 +238,15 @@ var engFireDetectorUnit = {
|
|||
}
|
||||
},
|
||||
receiveSignal: func(type) {
|
||||
if (type == 1 and me.loopOne != 9) {
|
||||
if (type == 1 and me.loopOne != 9 and me.condition != 0) {
|
||||
me.loopOne = 1;
|
||||
} elsif (type == 2 and me.loopTwo != 9) {
|
||||
} elsif (type == 2 and me.loopTwo != 9 and me.condition != 0) {
|
||||
me.loopTwo = 1;
|
||||
}
|
||||
},
|
||||
failUnit: func() {
|
||||
me.condition = 0;
|
||||
},
|
||||
fail: func(loop) {
|
||||
if (loop != 1 and loop != 2) { return; }
|
||||
|
||||
|
@ -281,8 +287,8 @@ var engFireDetectorUnit = {
|
|||
eng2FireWarn.setBoolValue(1);
|
||||
} elsif (system == 2) {
|
||||
apuFireWarn.setBoolValue(1);
|
||||
if (wow.getValue() == 1) {
|
||||
extinguisherBottles[4].discharge();
|
||||
if (me.wow.getValue() == 1) {
|
||||
extinguisherBottles.vector[4].discharge();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,12 +316,16 @@ var detectorLoop = {
|
|||
if (typeLoop == 1) { index += 1 }
|
||||
|
||||
if (propsNasFire.vector[index].getValue() > 250 and me.elecProp.getValue() >= 25) {
|
||||
me.sendSignal(system,typeLoop);
|
||||
me.sendSignal(system, typeLoop);
|
||||
} elsif (me.elecProp.getValue() < 25) {
|
||||
engFireDetectorUnits.vector[system].noElec(typeLoop);
|
||||
}
|
||||
},
|
||||
sendSignal: func(system, typeLoop) {
|
||||
if (system == 0 and !getprop("/systems/failures/engine-left-fire")) { return; }
|
||||
elsif (system == 1 and !getprop("/systems/failures/engine-right-fire")) { return; }
|
||||
elsif (system == 2 and !getprop("/systems/failures/apu-fire")) { return; }
|
||||
|
||||
engFireDetectorUnits.vector[system].receiveSignal(typeLoop);
|
||||
}
|
||||
};
|
||||
|
@ -353,7 +363,7 @@ var extinguisherBottle = {
|
|||
me.failProp.setValue(0);
|
||||
me.warningProp.setValue(0);
|
||||
}
|
||||
elsif (me.number == 1) {
|
||||
} elsif (me.number == 1) {
|
||||
if (rand() < 0.98) {
|
||||
me.failProp.setValue(0);
|
||||
me.warningProp.setValue(0);
|
||||
|
@ -418,6 +428,7 @@ var checkTimeFire2 = func() {
|
|||
loop4.setValue(0);
|
||||
}
|
||||
}
|
||||
|
||||
var checkTimeFire3 = func() {
|
||||
et = elapsedTime.getValue();
|
||||
var loop4 = propsNasFireTime.vector[3].getValue();
|
||||
|
@ -480,9 +491,23 @@ var createFireBottleListener = func(prop, fireBtnProp, index) {
|
|||
}
|
||||
|
||||
# Listeners
|
||||
setlistener("/controls/engines/engine[0]/fire-btn", func() { ecam.shutUpYou(); }, 0, 0);
|
||||
setlistener("/controls/engines/engine[1]/fire-btn", func() { ecam.shutUpYou(); }, 0, 0);
|
||||
setlistener("/controls/APU/fire-btn", func() { ecam.shutUpYou(); }, 0, 0);
|
||||
setlistener("/controls/engines/engine[0]/fire-btn", func() {
|
||||
if (getprop("/controls/engines/engine[0]/fire-btn") == 1) {
|
||||
ecam.shutUpYou();
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
setlistener("/controls/engines/engine[1]/fire-btn", func() {
|
||||
if (getprop("/controls/engines/engine[1]/fire-btn") == 1) {
|
||||
ecam.shutUpYou();
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
setlistener("/controls/APU/fire-btn", func() {
|
||||
if (getprop("/controls/APU/fire-btn") == 1) {
|
||||
ecam.shutUpYou();
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
setlistener("/controls/fire/test-btn-1", func() {
|
||||
if (getprop("/systems/failures/engine-left-fire")) { return; }
|
||||
|
@ -500,7 +525,6 @@ setlistener("/controls/fire/test-btn-1", func() {
|
|||
|
||||
setlistener("/controls/fire/test-btn-2", func() {
|
||||
if (getprop("/systems/failures/engine-right-fire")) { return; }
|
||||
|
||||
if (testBtn2.getValue() == 1) {
|
||||
if (dcbatNode.getValue() > 25 or dcessNode.getValue() > 25) {
|
||||
eng2FireWarn.setBoolValue(1);
|
||||
|
@ -536,11 +560,12 @@ var updateUnits = func() {
|
|||
units.update();
|
||||
}
|
||||
}
|
||||
|
||||
###################
|
||||
# Update Function #
|
||||
###################
|
||||
|
||||
var update_fire = func {
|
||||
var update_fire = func() {
|
||||
master_fire();
|
||||
updateUnits();
|
||||
}
|
||||
|
|
Reference in a new issue