1
0
Fork 0

Correct acconfig so it always works. Nasty. Rework acconfig?

This commit is contained in:
legoboyvdlp R 2020-04-19 20:20:52 +01:00
parent 41084eda14
commit fdc636b5e7
2 changed files with 22 additions and 15 deletions

View file

@ -344,13 +344,15 @@ var beforestart = func {
setprop("controls/flight/elevator-trim", 0); setprop("controls/flight/elevator-trim", 0);
libraries.systemsInit(); libraries.systemsInit();
failResetOld(); failResetOld();
setprop("controls/apu/master", 0);
# Now the Startup! # Now the Startup!
props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-1").setValue(1);
props.globals.getNode("controls/electrical/switches/bat-2").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(1);
setprop("controls/apu/master", 1); setprop("controls/apu/master", 1);
systems.APUController.APU.startCommand(1); settimer(func() {
systems.APUController.APU.powerOn(); # guarantee it always works
systems.APUController.APU.startCommand(1);
}, 0.1);
var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func { var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func {
if (getprop("engines/engine[2]/n1") >= 98) { if (getprop("engines/engine[2]/n1") >= 98) {
removelistener(apu_rpm_chk); removelistener(apu_rpm_chk);
@ -434,13 +436,15 @@ var taxi = func {
setprop("controls/flight/elevator-trim", 0); setprop("controls/flight/elevator-trim", 0);
libraries.systemsInit(); libraries.systemsInit();
failResetOld(); failResetOld();
setprop("controls/apu/master", 0);
# Now the Startup! # Now the Startup!
props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-1").setValue(1);
props.globals.getNode("controls/electrical/switches/bat-2").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(1);
setprop("controls/apu/master", 1); setprop("controls/apu/master", 1);
systems.APUController.APU.startCommand(1); settimer(func() {
systems.APUController.APU.powerOn(); # guarantee it always works
systems.APUController.APU.startCommand(1);
}, 0.1);
var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func { var apu_rpm_chk = setlistener("/engines/engine[2]/n1", func {
if (getprop("engines/engine[2]/n1") >= 98) { if (getprop("engines/engine[2]/n1") >= 98) {
removelistener(apu_rpm_chk); removelistener(apu_rpm_chk);

View file

@ -29,6 +29,7 @@ var APU = {
bleedTime: 0, bleedTime: 0,
cooldownEndTime: 0, cooldownEndTime: 0,
fastStart: 0, fastStart: 0,
_count: 0,
warnings: { warnings: {
lowOilLevel: 0, lowOilLevel: 0,
}, },
@ -101,7 +102,6 @@ var APU = {
settimer(func() { me.checkOil }, 8); settimer(func() { me.checkOil }, 8);
}, },
startCommand: func(fast = 0) { startCommand: func(fast = 0) {
if (me.listenSignals and (me.state == 1 or me.state == 2)) { if (me.listenSignals and (me.state == 1 or me.state == 2)) {
me.signals.startInProgress.setValue(1); me.signals.startInProgress.setValue(1);
me.setState(3); me.setState(3);
@ -254,17 +254,20 @@ var APU = {
me.bleedTime = pts.Sim.Time.elapsedSec.getValue(); me.bleedTime = pts.Sim.Time.elapsedSec.getValue();
}, },
update: func() { update: func() {
if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) { me._count += 1;
me.autoStop(); if (me._count == 5) {
} me._count = 0;
if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) {
if (systems.ELEC.Bus.dcBat.getValue() < 25) {
if (me.GenericControls.starter.getValue()) {
me.GenericControls.starter.setValue(0);
}
if (me.state != 0) {
me.autoStop(); me.autoStop();
me.resetStuff(); }
if (systems.ELEC.Bus.dcBat.getValue() < 25) {
if (me.GenericControls.starter.getValue()) {
me.GenericControls.starter.setValue(0);
}
if (me.state != 0) {
me.autoStop();
}
} }
} }
}, },