fix hydraulic speed, fix pack behavior, fix ailerons not working (thx sp-lcx)

This commit is contained in:
Joshua Davidson 2017-05-03 11:16:20 -04:00
parent 4d7197aefd
commit d9f197b686
8 changed files with 66 additions and 53 deletions

View file

@ -111,6 +111,9 @@ var beforestart_b = func {
setprop("/controls/pneumatic/switches/bleedapu", 1);
setprop("/controls/pneumatic/switches/bleed1", 1);
setprop("/controls/pneumatic/switches/bleed2", 1);
setprop("/controls/pneumatic/switches/pack1", 1);
setprop("/controls/pneumatic/switches/pack2", 1);
setprop("/controls/pneumatic/switches/hot-air", 1);
setprop("/controls/hydraulic/eng1-pump", 1);
setprop("/controls/hydraulic/eng2-pump", 1);
setprop("/controls/hydraulic/elec-pump-blue", 1);
@ -176,6 +179,9 @@ var taxi_b = func {
setprop("/controls/pneumatic/switches/bleedapu", 1);
setprop("/controls/pneumatic/switches/bleed1", 1);
setprop("/controls/pneumatic/switches/bleed2", 1);
setprop("/controls/pneumatic/switches/pack1", 1);
setprop("/controls/pneumatic/switches/pack2", 1);
setprop("/controls/pneumatic/switches/hot-air", 1);
setprop("/controls/hydraulic/eng1-pump", 1);
setprop("/controls/hydraulic/eng2-pump", 1);
setprop("/controls/hydraulic/elec-pump-blue", 1);
@ -188,12 +194,7 @@ var taxi_b = func {
setprop("instrumentation/adirs/ir[0]/aligned",1);
setprop("instrumentation/adirs/ir[1]/aligned",1);
setprop("instrumentation/adirs/ir[2]/aligned",1);
var pneu_chk = setlistener("/systems/pneumatic/total-psi", func {
if (getprop("/systems/pneumatic/total-psi") >= 28) {
removelistener(pneu_chk);
taxi_c();
}
});
settimer(taxi_c, 0.5);
}
var taxi_c = func {
setprop("/controls/engines/engine-start-switch", 2);
@ -221,9 +222,6 @@ var taxi_e = func {
setprop("/controls/APU/master", 0);
setprop("/controls/APU/start", 0);
setprop("/controls/pneumatic/switches/bleedapu", 0);
setprop("/controls/pneumatic/switches/pack1", 1);
setprop("/controls/pneumatic/switches/pack2", 1);
setprop("/controls/pneumatic/switches/hot-air", 1);
setprop("/systems/acconfig/autoconfig-running", 0);
ps_load_dlg.close();
ps_loaded_dlg.open();

View file

@ -45,7 +45,7 @@
<type>rotate</type>
<object-name>AileronR</object-name>
<property>/sim/multiplay/generic/float[7]</property>
<factor>40</factor>
<factor>-40</factor>
<axis>
<x1-m>7.6792</x1-m>
<y1-m>13.3967144</y1-m>

View file

@ -15,8 +15,6 @@ setprop("/systems/electrical/bus/ac2", 0);
setprop("/systems/electrical/bus/ac-ess", 0);
var adirs_init = func {
var motionroll = getprop("/controls/adirs/motionroll");
var motionpitch = getprop("/controls/adirs/motionpitch");
setprop("controls/adirs/skip",0); #define this here, as we want this to be off on startup
adirs_timer.start();
}
@ -56,10 +54,8 @@ var ADIRSreset = func {
}
var ir_align_loop = func(i) {
var motionroll = getprop("/controls/adirs/motionroll");
var motionpitch = getprop("/controls/adirs/motionpitch");
var ttn = getprop("/instrumentation/adirs/ir[" ~ i ~ "]/display/ttn");
if ((ttn >= 0) and (ttn < 0.99)) { #make it less sensitive
if ((ttn >= 0) and (ttn < 0.99)) { # Make it less sensitive
ir_align_finish(i);
} else {
setprop("/instrumentation/adirs/ir[" ~ i ~ "]/display/ttn", ttn - 1);
@ -67,13 +63,10 @@ var ir_align_loop = func(i) {
var roll = getprop("/orientation/roll-deg");
var pitch = getprop("/orientation/pitch-deg");
var gs = getprop("/velocities/groundspeed-kt");
if ((abs(motionroll - roll) > 0.15) or
(abs(motionpitch - pitch) > 0.15) or (gs > 2)) {
if (gs > 2) {
setprop("/instrumentation/adirs/ir[" ~ i ~ "]/display/status", "STS-XCESS MOTION");
ir_align_abort(i);
}
setprop("/controls/adirs/motionroll", roll);
setprop("/controls/adirs/motionpitch", pitch);
}
@ -87,8 +80,6 @@ var ir_align_start = func(i) {
((i == 1) and !ir1_align_loop_timer.isRunning) or
((i == 2) and !ir2_align_loop_timer.isRunning)) {
setprop("/instrumentation/adirs/ir[" ~ i ~ "]/display/ttn", (math.sin((getprop("/position/latitude-deg") / 90) * (math.pi / 2)) * 720) + 300);
motionroll = getprop("/orientation/roll-deg");
motionpitch = getprop("/orientation/pitch-deg");
if (i == 0) {
ir0_align_loop_timer.start();
} else if (i == 1) {
@ -165,13 +156,16 @@ var onbat_light = func {
var onbat_light_b = func {
setprop("/controls/adirs/onbat", 1);
setprop("/controls/adirs/numm", 0);
interpolate("/controls/adirs/numm", 5, 4);
interpolate("/controls/adirs/numm", 5, 7);
var nummlist = setlistener("/controls/adirs/numm", func {
if (getprop("/controls/adirs/numm") == 5) {
removelistener(nummlist);
onbat_light();
}
});
if (getprop("/controls/adirs/skip") == 1) {
skip_ADIRS();
}
}
setlistener("/controls/electrical/switches/gen-apu", onbat_light);
@ -236,34 +230,35 @@ var adirs_display = func() {
}
} else if ( data_knob == 6 ) {
if ( selected_ir == 2 ) {
#var ir0dispstat = getprop("/instrumentation/adirs/ir[0]/display/status");
# var ir0dispstat = getprop("/instrumentation/adirs/ir[0]/display/status");
setprop("/controls/adirs/display/text","- - - - - - - - ");
} else if ( selected_ir == 3 ) {
#var ir1dispstat = getprop("/instrumentation/adirs/ir[1]/display/status");
# var ir1dispstat = getprop("/instrumentation/adirs/ir[1]/display/status");
setprop("/controls/adirs/display/text","- - - - - - - - ");
} else if ( selected_ir == 4 ) {
#var ir2dispstat = getprop("/instrumentation/adirs/ir[2]/display/status");
# var ir2dispstat = getprop("/instrumentation/adirs/ir[2]/display/status");
setprop("/controls/adirs/display/text","- - - - - - - - ");
}
}
}
}
var skip_ADIRS = func {
setprop("controls/adirs/display/selected","2");
setprop("controls/adirs/ir[0]/knob","2");
setprop("controls/adirs/ir[1]/knob","2");
setprop("controls/adirs/ir[2]/knob","2");
setprop("instrumentation/adirs/ir[0]/display/ttn",1); #set it to 1 so it counts down from 1 to 0
setprop("instrumentation/adirs/ir[1]/display/ttn",1);
setprop("instrumentation/adirs/ir[2]/display/ttn",1);
if (getprop("/controls/adirs/ir[0]/knob") == 2) {
setprop("/instrumentation/adirs/ir[0]/display/ttn",1); # Set it to 1 so it counts down from 1 to 0
}
if (getprop("/controls/adirs/ir[1]/knob") == 2) {
setprop("/instrumentation/adirs/ir[1]/display/ttn",1); # Set it to 1 so it counts down from 1 to 0
}
if (getprop("/controls/adirs/ir[2]/knob") == 2) {
setprop("/instrumentation/adirs/ir[2]/display/ttn",1); # Set it to 1 so it counts down from 1 to 0
}
}
var adirs_skip = setlistener("/controls/adirs/skip", func {
var skipping = getprop("/controls/adirs/skip");
if (skipping == 1) {
skip_ADIRS();
}
});
if (skipping == 1) {
skip_ADIRS();
}
});
var adirs_timer = maketimer(1, adirs_display);

View file

@ -13,7 +13,7 @@ var n1_spin = 5.1;
var n2_spin = 22.8;
var n1_start = 23.3;
var n2_start = 63.6;
var egt_start = 545;
var egt_start = 623;
var n1_max = 105.8;
var n2_max = 102.1;
var egt_max = 860;
@ -23,8 +23,8 @@ var apu_max = 99.8;
var apu_egt_max = 513;
var spinup_time = 15;
var start_time = 10;
var egt_lightup_time = 3;
var egt_lightdn_time = 11;
var egt_lightup_time = 2;
var egt_lightdn_time = 8;
var shutdown_time = 20;
var egt_shutdown_time = 20;
setprop("/systems/apu/rpm", 0);
@ -38,8 +38,10 @@ setprop("/controls/engines/engine[1]/reverser", 0);
setlistener("/controls/engines/engine[0]/cutoff-switch", func {
if (getprop("/controls/engines/engine[0]/cutoff-switch") == 0) {
setprop("/systems/pneumatic/eng1-starter", 1);
start_one_check();
} else if (getprop("/controls/engines/engine[0]/cutoff-switch") == 1) {
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/controls/engines/engine[0]/starter", 0);
setprop("/controls/engines/engine[0]/cutoff", 1);
setprop("/engines/engine[0]/state", 0);
@ -48,15 +50,21 @@ setlistener("/controls/engines/engine[0]/cutoff-switch", func {
});
var start_one_check = func {
if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/systems/pneumatic/total-psi") >= 28)) {
settimer(start_one_check_b, 0.3);
}
var start_one_check_b = func {
if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/systems/pneumatic/total-psi") >= 28) and (getprop("/controls/engines/engine[0]/cutoff-switch") == 0)) {
auto_start_one();
}
}
setlistener("/controls/engines/engine[1]/cutoff-switch", func {
if (getprop("/controls/engines/engine[1]/cutoff-switch") == 0) {
setprop("/systems/pneumatic/eng2-starter", 1);
start_two_check();
} else if (getprop("/controls/engines/engine[1]/cutoff-switch") == 1) {
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/controls/engines/engine[1]/starter", 0);
setprop("/controls/engines/engine[1]/cutoff", 1);
setprop("/engines/engine[1]/state", 0);
@ -65,7 +73,11 @@ setlistener("/controls/engines/engine[1]/cutoff-switch", func {
});
var start_two_check = func {
if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/systems/pneumatic/total-psi") >= 28)) {
settimer(start_two_check_b, 0.3);
}
var start_two_check_b = func {
if ((getprop("/controls/engines/engine-start-switch") == 2) and (getprop("/systems/pneumatic/total-psi") >= 28) and (getprop("/controls/engines/engine[1]/cutoff-switch") == 0)) {
auto_start_two();
}
}
@ -94,7 +106,8 @@ var eng_one_n2_check = func {
if (getprop("/engines/engine[0]/egt-actual") >= egt_start) {
interpolate(engines[0].getNode("egt-actual"), egt_min, egt_lightdn_time);
}
if (getprop("/engines/engine[0]/n2") >= n2_start) {
if (getprop("/engines/engine[0]/n2") >= 54.6) {
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/engines/engine[0]/state", 3);
eng_one_n2_checkt.stop();
}
@ -124,7 +137,8 @@ var eng_two_n2_check = func {
if (getprop("/engines/engine[1]/egt-actual") >= egt_start) {
interpolate(engines[1].getNode("egt-actual"), egt_min, egt_lightdn_time);
}
if (getprop("/engines/engine[1]/n2") >= n2_start) {
if (getprop("/engines/engine[1]/n2") >= 54.6) {
setprop("/systems/pneumatic/eng2-starter", 0);
setprop("/engines/engine[1]/state", 3);
eng_two_n2_checkt.stop();
}
@ -164,6 +178,8 @@ var apu_stop = func {
#######################
setlistener("/controls/engines/engine-start-switch", func {
start_one_check();
start_two_check();
if ((getprop("/controls/engines/engine-start-switch") == 0) or (getprop("/controls/engines/engine-start-switch") == 1)) {
if (getprop("/controls/engines/engine[0]/state") == 1 or getprop("/controls/engines/engine[0]/state") == 2) {
setprop("/controls/engines/engine[0]/starter", 0);

View file

@ -61,7 +61,7 @@ var master_hyd = func {
}
} else {
if (blue_psi > 1) {
setprop("/systems/hydraulic/blue-psi", blue_psi - 5);
setprop("/systems/hydraulic/blue-psi", blue_psi - 50);
} else {
setprop("/systems/hydraulic/blue-psi", 0);
}
@ -81,7 +81,7 @@ var master_hyd = func {
}
} else {
if (green_psi > 1) {
setprop("/systems/hydraulic/green-psi", green_psi - 5);
setprop("/systems/hydraulic/green-psi", green_psi - 50);
} else {
setprop("/systems/hydraulic/green-psi", 0);
}
@ -107,7 +107,7 @@ var master_hyd = func {
}
} else {
if (yellow_psi > 1) {
setprop("/systems/hydraulic/yellow-psi", yellow_psi - 5);
setprop("/systems/hydraulic/yellow-psi", yellow_psi - 50);
} else {
setprop("/systems/hydraulic/yellow-psi", 0);
}

View file

@ -33,7 +33,7 @@ var update_loop = func {
var elev = getprop("/controls/flight/elevator");
if (getprop("/it-fbw/law") == 0) {
if (getprop("/position/gear-agl-ft") <= 15) {
if (getprop("/position/gear-agl-ft") <= 2) {
setprop("/it-fbw/pitch-lim-max", "15");
setprop("/it-fbw/pitch-lim-min", "-5");
} else {

View file

@ -24,6 +24,8 @@ var pneu_init = func {
setprop("/systems/pneumatic/pack1", 0);
setprop("/systems/pneumatic/pack2", 0);
setprop("/systems/pneumatic/startpsir", 0);
setprop("/systems/pneumatic/eng1-starter", 0);
setprop("/systems/pneumatic/eng2-starter", 0);
pneu_timer.start();
}
@ -41,6 +43,8 @@ var master_pneu = func {
var ram_air_sw = getprop("/controls/pneumatic/switches/ram-air");
var pack_flo_sw = getprop("/controls/pneumatic/switches/pack-flo");
var xbleed_sw = getprop("/controls/pneumatic/switches/xbleed");
var eng1_starter = getprop("/systems/pneumatic/eng1-starter");
var eng2_starter = getprop("/systems/pneumatic/eng2-starter");
var rpmapu = getprop("/systems/apu/rpm");
var stateL = getprop("/engines/engine[0]/state");
var stateR = getprop("/engines/engine[1]/state");
@ -74,13 +78,13 @@ var master_pneu = func {
setprop("/systems/pneumatic/start-psi", 0);
}
if (pack1_sw == 1 and bleed1_sw) {
if (pack1_sw == 1 and (bleed1 >= 20 or bleedapu >= 20) and eng1_starter == 0 and eng2_starter == 0) {
setprop("/systems/pneumatic/pack1", pack_flo_sw);
} else {
setprop("/systems/pneumatic/pack1", 0);
}
if (pack2_sw == 1 and bleed2_sw) {
if (pack2_sw == 1 and (bleed2 >= 20 or bleedapu >= 20) and eng1_starter == 0 and eng2_starter == 0) {
setprop("/systems/pneumatic/pack2", pack_flo_sw);
} else {
setprop("/systems/pneumatic/pack2", 0);

View file

@ -67,7 +67,7 @@
</less-than>
</and>
</condition>
<value>0.5</value>
<value>-0.5</value>
</input>
<input>
<condition>
@ -85,9 +85,9 @@
<expression>
<table>
<property>/controls/flight/aileron-fbw</property>
<entry><ind>-1</ind><dep> 0.5</dep></entry>
<entry><ind>-1</ind><dep>-0.5</dep></entry>
<entry><ind> 0</ind><dep> 0.0</dep></entry>
<entry><ind> 1</ind><dep>-0.5</dep></entry>
<entry><ind> 1</ind><dep> 0.5</dep></entry>
</table>
</expression>
</input>