This commit is contained in:
merspieler 2018-09-14 20:52:01 +02:00
commit 1b89e4d6f4
5 changed files with 66 additions and 64 deletions

View file

@ -55,19 +55,31 @@ var variousReset = func {
setprop("/controls/switches/seatbelt-sign", 1);
}
setlistener("/sim/signals/fdm-initialized", func {
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var Lrain = getprop("/controls/switches/LrainRpt");
var Rrain = getprop("/controls/switches/RrainRpt");
var OnLt = getprop("/controls/switches/emerCallLtO");
var CallLt = getprop("/controls/switches/emerCallLtC");
var wow = getprop("/gear/gear[1]/wow");
rainTimer.start();
});
var BUTTONS = {
init: func() {
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var Lrain = getprop("/controls/switches/LrainRpt");
var Rrain = getprop("/controls/switches/RrainRpt");
var OnLt = getprop("/controls/switches/emerCallLtO");
var CallLt = getprop("/controls/switches/emerCallLtC");
var EmerCall = getprop("/controls/switches/emerCall");
var wow = getprop("/gear/gear[1]/wow");
var wowr = getprop("/gear/gear[2]/wow");
var gndCtl = getprop("/systems/CVR/gndctl");
var acPwr = getprop("/systems/electrical/bus/ac-ess");
},
update: func() {
rainRepel();
CVR_master();
if (getprop("/controls/switches/emerCall")) {
EmerCallOnLight();
EmerCallLight();
}
},
};
# inhibit rain rpt when engines off and on ground
var rainRepel = func {
var rainRepel = func() {
Lrain = getprop("/controls/switches/LrainRpt");
Rrain = getprop("/controls/switches/RrainRpt");
wow = getprop("/gear/gear[1]/wow");
@ -81,39 +93,53 @@ var rainRepel = func {
}
}
var EmerCall = func {
setprop("/controls/switches/emerCall", 1);
EmerCallTimer1.start();
EmerCallTimer2.start();
settimer(func() {
setprop("/controls/switches/emerCall", 0);
EmerCallTimer1.stop();
EmerCallTimer2.stop();
}, 10);
}
var EmerCallOnLight = func {
var EmerCallOnLight = func() {
OnLt = getprop("/controls/switches/emerCallLtO");
if (OnLt) {
EmerCall = getprop("/controls/switches/emerCall");
if ((OnLt and EmerCall) or !EmerCall) {
setprop("/controls/switches/emerCallLtO", 0);
} else if (!OnLt) {
} else if (!OnLt and EmerCall) {
setprop("/controls/switches/emerCallLtO", 1);
}
}
var EmerCallLightCall = func {
var EmerCallLight = func() {
CallLt = getprop("/controls/switches/emerCallLtC");
if (CallLt) {
EmerCall = getprop("/controls/switches/emerCall");
if ((CallLt and EmerCall) or !EmerCall) {
setprop("/controls/switches/emerCallLtC", 0);
} else if (!CallLt) {
} else if (!CallLt and EmerCall) {
setprop("/controls/switches/emerCallLtC", 1);
}
}
var CabinCall = func {
setprop("/controls/switches/emerCall", 0);
var CVR_master = func() {
stateL = getprop("/engines/engine[0]/state");
stateR = getprop("/engines/engine[1]/state");
wow = getprop("/gear/gear[1]/wow");
wowr = getprop("/gear/gear[2]/wow");
gndCtl = getprop("/systems/CVR/gndctl");
acPwr = getprop("/systems/electrical/bus/ac-ess");
if (acPwr > 0 and wow and wowr and (gndCtl or (stateL == 3 or stateR == 3))) {
setprop("/controls/CVR/power", 1);
} else if (!wow and !wowr and acPwr > 0) {
setprop("/controls/CVR/power", 1);
} else {
setprop("/controls/CVR/power", 0);
}
}
var EmerCall = func {
setprop("/controls/switches/emerCall", 1);
settimer(func() {
setprop("/controls/switches/emerCall", 0);
}, 10);
}
var CabinCall = func {
setprop("/controls/switches/cabinCall", 0);
settimer(func() {
setprop("/controls/switches/cabinCall", 0);
}, 15);
}
@ -134,22 +160,6 @@ var CVR_test = func {
}
}
var CVR_master = func {
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
var wowl = getprop("/gear/gear[1]/wow");
var wowr = getprop("/gear/gear[2]/wow");
var gndCtl = getprop("/systems/CVR/gndctl");
var acPwr = getprop("/systems/electrical/bus/ac-ess");
if (acPwr > 0 and wowl and wowr and (gndCtl or (stateL == 3 or stateR == 3))) {
setprop("/controls/CVR/power", 1);
} else if (!wowl and !wowr and acPwr > 0) {
setprop("/controls/CVR/power", 1);
} else {
setprop("/controls/CVR/power", 0);
}
}
var mcpSPDKnbPull = func {
setprop("/it-autoflight/input/spd-managed", 0);
fmgc.ManagedSPD.stop();
@ -238,13 +248,4 @@ var decreaseManVS = func {
if (manvs <= 1 and manvs >= 0 and !auto) {
setprop("/systems/pressurization/outflowpos-man", manvs - 0.001);
}
}
var update_CVR = func {
CVR_master();
}
var CVR = maketimer(0.1, update_CVR);
var EmerCallTimer1 = maketimer(0.5, EmerCallOnLight);
var EmerCallTimer2 = maketimer(0.5, EmerCallLightCall);
var rainTimer = maketimer(0.1, rainRepel);
}

View file

@ -60,7 +60,7 @@ var cutoff_one = func {
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1);
var engine0_state = props.globals.initNode("/engines/engine[0]/state", 0, "INT");
setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop();
}
@ -144,7 +144,7 @@ var cutoff_two = func {
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
var engine1_state = props.globals.initNode("/engines/engine[0]/state", 0, "INT");
setprop("/engines/engine[0]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
}

View file

@ -60,7 +60,7 @@ var cutoff_one = func {
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1);
var engine0_state = props.globals.initNode("/engines/engine[0]/state", 0, "INT");
setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
eng_one_n2_check.stop();
}
@ -144,7 +144,7 @@ var cutoff_two = func {
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
var engine1_state = props.globals.initNode("/engines/engine[1]/state", 0, "INT");
setprop("/engines/engine[1]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
}

View file

@ -185,13 +185,13 @@ var systemsInit = func {
mcdu.MCDU_init(0);
mcdu.MCDU_init(1);
systemsLoop.start();
libraries.CVR.start();
icing.icingInit();
lightsLoop.start();
var autopilot = gui.Dialog.new("sim/gui/dialogs/autopilot/dialog", "Aircraft/IDG-A32X/Systems/autopilot-dlg.xml");
setprop("/it-autoflight/input/fd1", 1);
setprop("/it-autoflight/input/fd2", 1);
libraries.ECAM.init();
libraries.BUTTONS.init();
libraries.variousReset();
}
@ -206,8 +206,9 @@ var systemsLoop = maketimer(0.1, func {
systems.FUEL.loop();
systems.ADIRS.loop();
libraries.ECAM.loop();
ecam.ECAM_controller.loop();
libraries.BUTTONS.update();
fadec.fadecLoop();
ecam.ECAM_controller.loop();
if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/switches/cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or getprop("/controls/gear/brake-parking") == 0)) {
setprop("/controls/switches/cart", 0);

View file

@ -1 +1 @@
4637
4638