A3XX: Fix engine autostart

This commit is contained in:
Joshua Davidson 2017-07-12 20:21:17 -04:00
parent 62fc342293
commit ec418dbef2

View file

@ -51,7 +51,6 @@ var eng_init = func {
setlistener("/controls/engines/engine[0]/cutoff-switch", func { setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) { if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
if (getprop("/controls/engines/engine[0]/man-start") == 0) { if (getprop("/controls/engines/engine[0]/man-start") == 0) {
setprop("/systems/pneumatic/eng1-starter", 1);
start_one_check(); start_one_check();
} else if (getprop("/controls/engines/engine[0]/man-start") == 1) { } else if (getprop("/controls/engines/engine[0]/man-start") == 1) {
eng_one_man_startt.start(); eng_one_man_startt.start();
@ -95,7 +94,10 @@ var start_one_mancheck = func {
} }
var start_one_check = func { var start_one_check = func {
settimer(start_one_check_b, 0.5); if (getprop("/controls/engines/engine-start-switch") == 2 and getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
setprop("/systems/pneumatic/eng1-starter", 1);
settimer(start_one_check_b, 0.5);
}
} }
var start_one_check_b = func { var start_one_check_b = func {
@ -107,7 +109,6 @@ var start_one_check_b = func {
setlistener("/controls/engines/engine[1]/cutoff-switch", func { setlistener("/controls/engines/engine[1]/cutoff-switch", func {
if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) { if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) {
if (getprop("/controls/engines/engine[1]/man-start") == 0) { if (getprop("/controls/engines/engine[1]/man-start") == 0) {
setprop("/systems/pneumatic/eng2-starter", 1);
start_two_check(); start_two_check();
} else if (getprop("/controls/engines/engine[1]/man-start") == 1) { } else if (getprop("/controls/engines/engine[1]/man-start") == 1) {
eng_two_man_startt.start(); eng_two_man_startt.start();
@ -150,7 +151,10 @@ var start_two_mancheck = func {
} }
var start_two_check = func { var start_two_check = func {
settimer(start_two_check_b, 0.5); if (getprop("/controls/engines/engine-start-switch") == 2 and getprop("/controls/engines/engine[1]/cutoff-switch") == 0) {
setprop("/systems/pneumatic/eng2-starter", 1);
settimer(start_two_check_b, 0.5);
}
} }
var start_two_check_b = func { var start_two_check_b = func {
@ -336,12 +340,14 @@ setlistener("/controls/engines/engine-start-switch", func {
if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) { if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) {
setprop("/controls/engines/engine[0]/starter", 0); setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1); setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 0); setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
} }
if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) { if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) {
setprop("/controls/engines/engine[1]/starter", 0); setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1); setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 0); setprop("/engines/engine[1]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }
@ -353,12 +359,14 @@ setlistener("/systems/pneumatic/start-psi", func {
if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) { if (getprop("/engines/engine[0]/state") == 1 or getprop("/engines/engine[0]/state") == 2) {
setprop("/controls/engines/engine[0]/starter", 0); setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1); setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 0); setprop("/engines/engine[0]/state", 0);
interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[0].getNode("egt-actual"), 0, egt_shutdown_time);
} }
if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) { if (getprop("/engines/engine[1]/state") == 1 or getprop("/engines/engine[1]/state") == 2) {
setprop("/controls/engines/engine[1]/starter", 0); setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1); setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 0); setprop("/engines/engine[1]/state", 0);
interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time); interpolate(engines[1].getNode("egt-actual"), 0, egt_shutdown_time);
} }