1
0
Fork 0

APU: fix bug where it would shutdown on some power transients

This commit is contained in:
legoboyvdlp R 2020-11-08 14:40:54 +00:00
parent 9b45e4d675
commit a59364f64f

View file

@ -256,6 +256,7 @@ var APU = {
APUNodes.Controls.bleed.setValue(0); APUNodes.Controls.bleed.setValue(0);
me.bleedTime = pts.Sim.Time.elapsedSec.getValue(); me.bleedTime = pts.Sim.Time.elapsedSec.getValue();
}, },
_powerLost: 0,
update: func() { update: func() {
me._count += 1; me._count += 1;
if (me._count == 5) { if (me._count == 5) {
@ -263,14 +264,22 @@ var APU = {
if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) { if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) {
me.autoStop(); me.autoStop();
} }
if (systems.ELEC.Bus.dcBat.getValue() < 25) { if (systems.ELEC.Bus.dcBat.getValue() < 25) {
if (me.GenericControls.starter.getValue()) { if (!me._powerLost) {
me.GenericControls.starter.setValue(0); me._powerLost = 1;
} settimer(func() {
if (me.state != 0) { if (me._powerLost) {
me.autoStop(); if (me.GenericControls.starter.getValue()) {
me.GenericControls.starter.setValue(0);
}
if (me.state != 0) {
me.autoStop();
}
}
}, 0.2);
} }
} else {
me._powerLost = 0;
} }
} }
}, },