From 2a400ea928fddfb8f165213dbf7f0bf10f4ab32d Mon Sep 17 00:00:00 2001 From: Joshua Davidson Date: Thu, 5 Oct 2017 10:53:24 -0400 Subject: [PATCH] A3XX: Make engine start in panel states much much faster --- AircraftConfig/acconfig.nas | 35 +++++++++++++------------ Nasal/autobrake.nas | 22 +++++++++------- Nasal/engines.nas | 52 +++++++++++++++++++++++++++++++------ Systems/fadec-cfm.xml | 4 +-- revision.txt | 2 +- 5 files changed, 77 insertions(+), 38 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index a64d5b35..427ffc08 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -178,6 +178,8 @@ var colddark = func { spinning.start(); ps_load_dlg.open(); setprop("/systems/acconfig/autoconfig-running", 1); + setprop("/controls/gear/brake-left", 1); + setprop("/controls/gear/brake-right", 1); # Initial shutdown, and reinitialization. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/engines/engine[0]/cutoff-switch", 1); @@ -211,6 +213,8 @@ var colddark_b = func { setprop("/controls/bleed/OHP/bleedapu", 0); setprop("/controls/electrical/switches/battery1", 0); setprop("/controls/electrical/switches/battery2", 0); + setprop("/controls/gear/brake-left", 0); + setprop("/controls/gear/brake-right", 0); setprop("/systems/acconfig/autoconfig-running", 0); ps_load_dlg.close(); ps_loaded_dlg.open(); @@ -222,6 +226,8 @@ var beforestart = func { spinning.start(); ps_load_dlg.open(); setprop("/systems/acconfig/autoconfig-running", 1); + setprop("/controls/gear/brake-left", 1); + setprop("/controls/gear/brake-right", 1); # First, we set everything to cold and dark. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/engines/engine[0]/cutoff-switch", 1); @@ -284,6 +290,8 @@ var beforestart_b = func { setprop("/controls/adirs/mcducbtn", 1); setprop("/controls/lighting/beacon", 1); setprop("/controls/lighting/nav-lights-switch", 1); + setprop("/controls/gear/brake-left", 0); + setprop("/controls/gear/brake-right", 0); setprop("/systems/acconfig/autoconfig-running", 0); ps_load_dlg.close(); ps_loaded_dlg.open(); @@ -295,6 +303,8 @@ var taxi = func { spinning.start(); ps_load_dlg.open(); setprop("/systems/acconfig/autoconfig-running", 1); + setprop("/controls/gear/brake-left", 1); + setprop("/controls/gear/brake-right", 1); # First, we set everything to cold and dark. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/engines/engine[0]/cutoff-switch", 1); @@ -360,31 +370,22 @@ var taxi_b = func { } var taxi_c = func { setprop("/controls/engines/engine-start-switch", 2); - setprop("/controls/engines/engine[1]/cutoff-switch", 0); - var eng_two_chk = setlistener("/engines/engine[1]/state", func { - if (getprop("/engines/engine[1]/state") == 3) { - removelistener(eng_two_chk); - taxi_d(); - } - }); -} -var taxi_d = func { - # Start engine 1. setprop("/controls/engines/engine[0]/cutoff-switch", 0); - var eng_one_chk = setlistener("/engines/engine[0]/n2", func { - if (getprop("/engines/engine[0]/n2") >= 58.0) { - removelistener(eng_one_chk); - taxi_e(); - } - }); + setprop("/controls/engines/engine[1]/cutoff-switch", 0); + settimer(func { + taxi_d(); + }, 10); } -var taxi_e = func { + +var taxi_d = func { # After Start items. setprop("/controls/engines/engine-start-switch", 1); setprop("/controls/APU/master", 0); setprop("/controls/APU/start", 0); setprop("/controls/pneumatic/switches/bleedapu", 0); setprop("/controls/lighting/taxi-light-switch", 1); + setprop("/controls/gear/brake-left", 0); + setprop("/controls/gear/brake-right", 0); setprop("/systems/acconfig/autoconfig-running", 0); ps_load_dlg.close(); ps_loaded_dlg.open(); diff --git a/Nasal/autobrake.nas b/Nasal/autobrake.nas index 2f40fd26..372f3bde 100644 --- a/Nasal/autobrake.nas +++ b/Nasal/autobrake.nas @@ -25,16 +25,18 @@ var autobrake_init = func { # Override FG's generic brake, so we can use toe brakes to disconnect autobrake controls.applyBrakes = func(v, which = 0) { - wow1 = getprop("/gear/gear[1]/wow"); - wow2 = getprop("/gear/gear[2]/wow"); - if (getprop("/controls/autobrake/mode") != 0 and (wow1 or wow2)) { - arm_autobrake(0); - } - if (which <= 0) { - interpolate("/controls/gear/brake-left", v, 0.5); - } - if (which >= 0) { - interpolate("/controls/gear/brake-right", v, 0.5); + if (getprop("/systems/acconfig/autoconfig-running") != 1) { + wow1 = getprop("/gear/gear[1]/wow"); + wow2 = getprop("/gear/gear[2]/wow"); + if (getprop("/controls/autobrake/mode") != 0 and (wow1 or wow2)) { + arm_autobrake(0); + } + if (which <= 0) { + interpolate("/controls/gear/brake-left", v, 0.5); + } + if (which >= 0) { + interpolate("/controls/gear/brake-right", v, 0.5); + } } } diff --git a/Nasal/engines.nas b/Nasal/engines.nas index affee697..8f6d39bd 100644 --- a/Nasal/engines.nas +++ b/Nasal/engines.nas @@ -54,10 +54,14 @@ var eng_init = func { setlistener("/controls/engines/engine[0]/cutoff-switch", func { if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) { - if (getprop("/controls/engines/engine[0]/man-start") == 0) { - start_one_check(); - } else if (getprop("/controls/engines/engine[0]/man-start") == 1) { - eng_one_man_startt.start(); + if (getprop("/systems/acconfig/autoconfig-running") == 1) { + fast_start_one(); + } else { + if (getprop("/controls/engines/engine[0]/man-start") == 0) { + start_one_check(); + } else if (getprop("/controls/engines/engine[0]/man-start") == 1) { + eng_one_man_startt.start(); + } } } else if (getprop("/controls/engines/engine[0]/cutoff-switch") == 1) { eng_one_auto_startt.stop(); @@ -75,6 +79,20 @@ setlistener("/controls/engines/engine[0]/cutoff-switch", func { } }); +var fast_start_one = func { + setprop("controls/engines/engine[0]/cutoff", 0); + setprop("engines/engine[0]/out-of-fuel", 0); + setprop("engines/engine[0]/run", 1); + + setprop("/engines/engine[0]/cutoff", 0); + setprop("/engines/engine[0]/starter", 0); + + setprop("/fdm/jsbsim/propulsion/set-running", 0); + + setprop("/engines/engine[0]/state", 3); + setprop("/systems/pneumatic/eng1-starter", 0); +} + setlistener("/controls/engines/engine[0]/man-start", func { start_one_mancheck(); }); @@ -116,10 +134,14 @@ var start_one_check_b = func { setlistener("/controls/engines/engine[1]/cutoff-switch", func { if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) { - if (getprop("/controls/engines/engine[1]/man-start") == 0) { - start_two_check(); - } else if (getprop("/controls/engines/engine[1]/man-start") == 1) { - eng_two_man_startt.start(); + if (getprop("/systems/acconfig/autoconfig-running") == 1) { + fast_start_two(); + } else { + if (getprop("/controls/engines/engine[1]/man-start") == 0) { + start_two_check(); + } else if (getprop("/controls/engines/engine[1]/man-start") == 1) { + eng_two_man_startt.start(); + } } } else if (getprop("/controls/engines/engine[1]/cutoff-switch") == 1) { eng_two_auto_startt.stop(); @@ -136,6 +158,20 @@ setlistener("/controls/engines/engine[1]/cutoff-switch", func { } }); +var fast_start_two = func { + setprop("controls/engines/engine[1]/cutoff", 0); + setprop("engines/engine[1]/out-of-fuel", 0); + setprop("engines/engine[1]/run", 1); + + setprop("/engines/engine[1]/cutoff", 0); + setprop("/engines/engine[1]/starter", 0); + + setprop("/fdm/jsbsim/propulsion/set-running", 1); + + setprop("/engines/engine[1]/state", 3); + setprop("/systems/pneumatic/eng2-starter", 0); +} + setlistener("/controls/engines/engine[1]/man-start", func { start_two_mancheck(); }); diff --git a/Systems/fadec-cfm.xml b/Systems/fadec-cfm.xml index c1cd2e55..a6b45fcf 100644 --- a/Systems/fadec-cfm.xml +++ b/Systems/fadec-cfm.xml @@ -744,7 +744,7 @@ /engines/engine[0]/n1 - 22 + 19 @@ -775,7 +775,7 @@ /engines/engine[1]/n1 - 22 + 19 diff --git a/revision.txt b/revision.txt index 2c9e4a82..e2f33259 100644 --- a/revision.txt +++ b/revision.txt @@ -1 +1 @@ -2101 \ No newline at end of file +2102 \ No newline at end of file