From fdc636b5e73ec693f3cfaa0538fbd35f036adaef Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 19 Apr 2020 20:20:52 +0100 Subject: [PATCH] Correct acconfig so it always works. Nasty. Rework acconfig? --- AircraftConfig/acconfig.nas | 12 ++++++++---- Nasal/Systems/APU.nas | 25 ++++++++++++++----------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 113e5dc5..e4753686 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -344,13 +344,15 @@ var beforestart = func { setprop("controls/flight/elevator-trim", 0); libraries.systemsInit(); failResetOld(); - setprop("controls/apu/master", 0); # Now the Startup! props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(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 { if (getprop("engines/engine[2]/n1") >= 98) { removelistener(apu_rpm_chk); @@ -434,13 +436,15 @@ var taxi = func { setprop("controls/flight/elevator-trim", 0); libraries.systemsInit(); failResetOld(); - setprop("controls/apu/master", 0); # Now the Startup! props.globals.getNode("controls/electrical/switches/bat-1").setValue(1); props.globals.getNode("controls/electrical/switches/bat-2").setValue(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 { if (getprop("engines/engine[2]/n1") >= 98) { removelistener(apu_rpm_chk); diff --git a/Nasal/Systems/APU.nas b/Nasal/Systems/APU.nas index e9075579..033e9b01 100644 --- a/Nasal/Systems/APU.nas +++ b/Nasal/Systems/APU.nas @@ -29,6 +29,7 @@ var APU = { bleedTime: 0, cooldownEndTime: 0, fastStart: 0, + _count: 0, warnings: { lowOilLevel: 0, }, @@ -101,7 +102,6 @@ var APU = { settimer(func() { me.checkOil }, 8); }, startCommand: func(fast = 0) { - if (me.listenSignals and (me.state == 1 or me.state == 2)) { me.signals.startInProgress.setValue(1); me.setState(3); @@ -254,17 +254,20 @@ var APU = { me.bleedTime = pts.Sim.Time.elapsedSec.getValue(); }, update: func() { - if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) { - me.autoStop(); - } - - if (systems.ELEC.Bus.dcBat.getValue() < 25) { - if (me.GenericControls.starter.getValue()) { - me.GenericControls.starter.setValue(0); - } - if (me.state != 0) { + me._count += 1; + if (me._count == 5) { + me._count = 0; + if (me.state == 5 and APUNodes.Oil.pressure.getValue() < 35 or APUNodes.Oil.temperature.getValue() > 135) { 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(); + } } } },