This commit is contained in:
Jonathan Redpath 2017-06-30 18:28:02 +01:00
parent 164331cc2a
commit 92413f5a70
3 changed files with 137 additions and 5 deletions

View file

@ -11,8 +11,14 @@
<animation>
<type>rotate</type>
<object-name>lb_psi</object-name>
<property>/hydraulics/brakes/pressure-left-psi</property>
<property>/systems/hydraulic/brakes/pressure-left-psi</property>
<factor>0.03</factor>
<condition>
<equals>
<property>/systems/hydraulic/brakes/mode</property>
<value>2</value>
</equals>
</condition>
<center>
<x-m>0</x-m>
<y-m>-0.0141</y-m>
@ -28,8 +34,14 @@
<animation>
<type>rotate</type>
<object-name>rb_psi</object-name>
<property>/hydraulics/brakes/pressure-right-psi</property>
<property>/systems/hydraulic/brakes/pressure-right-psi</property>
<factor>-0.03</factor>
<condition>
<equals>
<property>/systems/hydraulic/brakes/mode</property>
<value>2</value>
</equals>
</condition>
<center>
<x-m>0</x-m>
<y-m>0.0136</y-m>
@ -45,10 +57,10 @@
<animation>
<type>rotate</type>
<object-name>accum_psi</object-name>
<property>/hydraulics/brakes/accumulator-pressure-psi</property>
<property>/systems/hydraulic/brakes/accumulator-pressure-psi</property>
<interpolation>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1000</ind><dep>66</dep></entry>
<entry><ind>700</ind><dep>66</dep></entry>
<entry><ind>2000</ind><dep>78</dep></entry>
<entry><ind>3000</ind><dep>90</dep></entry>
</interpolation>
@ -64,4 +76,4 @@
</axis>
</animation>
</PropertyList>
</PropertyList>

View file

@ -21,6 +21,16 @@ var hyd_init = func {
setprop("/systems/hydraulic/spoiler3and4-inhibit", 0);
setprop("/systems/hydraulic/spoiler-inhibit", 0);
setprop("/controls/gear/brake-parking", 0);
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", 0);
setprop("/systems/hydraulic/brakes/pressure-left-psi", 0);
setprop("/systems/hydraulic/brakes/pressure-right-psi", 0);
setprop("/systems/hydraulic/brakes/askidnwssw", 1);
setprop("/systems/hydraulic/brakes/mode", 0);
setprop("/systems/hydraulic/brakes/lbrake", 0);
setprop("/systems/hydraulic/brakes/rbrake", 0);
setprop("/systems/hydraulic/brakes/nose-rubber", 0); # this stops the nose from spinning when you raise the gear
setprop("/systems/hydraulic/brakes/counter", 0);
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", 0);
hyd_timer.start();
}
@ -155,6 +165,69 @@ var master_hyd = func {
} else {
setprop("/systems/hydraulic/spoiler-inhibit", 0);
}
var accum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
var lpsi = getprop("/systems/hydraulic/brakes/pressure-left-psi");
var rpsi = getprop("/systems/hydraulic/brakes/pressure-right-psi");
var parking = getprop("/controls/gear/brake-parking");
var askidnws_sw = getprop("/systems/hydraulic/brakes/askidnwssw");
var brake_mode = getprop("/systems/hydraulic/brakes/mode");
var brake_l = getprop("/systems/hydraulic/brakes/lbrake");
var brake_r = getprop("/systems/hydraulic/brakes/rbrake");
var brake_nose = getprop("/systems/hydraulic/brakes/nose-rubber");
var counter = getprop("/systems/hydraulic/brakes/counter");
if (!parking and askidnws_sw and green_psi > 2500) {
# set mode to on
setprop("/systems/hydraulic/brakes/mode", 1);
} else if ((!parking and askidnws_sw and yellow_psi > 2500) or (!parking and askidnws_sw and accum > 0)) {
# set mode to altn
setprop("/systems/hydraulic/brakes/mode", 2);
} else {
# set mode to off
setprop("/systems/hydraulic/brakes/mode", 0);
}
if (brake_mode == 2 and yellow_psi > 2500 and accum < 700) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", accum + 50);
}
setlistener("/controls/gear/brake-left", func {
var presentAccum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
var pastAccum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1");
var brake_mode = getprop("/systems/hydraulic/brakes/mode");
var yellow_psi = getprop("/systems/hydraulic/yellow-psi");
var brake = getprop("/controls/gear/brake-left");
if (brake > 0) {
if (brake_mode == 2 and yellow_psi < 1000) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", presentAccum);
}
}
if (brake == 0) {
if (brake_mode == 2 and yellow_psi < 1000 and presentAccum >= 0) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", pastAccum - 50);
}
}
});
setlistener("/controls/gear/brake-right", func {
var presentAccum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi");
var pastAccum = getprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1");
var brake_mode = getprop("/systems/hydraulic/brakes/mode");
var yellow_psi = getprop("/systems/hydraulic/yellow-psi");
var brake2 = getprop("/controls/gear/brake-right");
if (brake2 > 0) {
if (brake_mode == 2 and yellow_psi < 1000) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi-1", presentAccum);
}
}
if (brake2 == 0) {
if (brake_mode == 2 and yellow_psi < 1000 and presentAccum >= 0) {
setprop("/systems/hydraulic/brakes/accumulator-pressure-psi", pastAccum - 50);
}
}
});
}
#######################
@ -177,3 +250,10 @@ var update_hydraulic = func {
}
var hyd_timer = maketimer(0.2, update_hydraulic);
# FIXME:
# Josh, please disable braking when:
# /systems/hydraulic/brakes/accumulator-pressure-psi is equal to 0 and when /systems/hydraulic/brakes/mode is equal to 2
# Thanks!

View file

@ -1834,5 +1834,45 @@
<output>/controls/flight/speedbrake-norm</output>
<max-rate-of-change>0.7</max-rate-of-change>
</filter>
<!-- Braking -->
<filter>
<name>Left Press</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/controls/gear/brake-left</property>
<entry><ind> 0</ind><dep>0</dep></entry>
<entry><ind>0.3</ind><dep>1000</dep></entry>
<entry><ind>0.6</ind><dep>2000</dep></entry>
<entry><ind> 1</ind><dep>3000</dep></entry>
</table>
</expression>
</input>
<output>/systems/hydraulic/brakes/pressure-left-psi</output>
</filter>
<filter>
<name>Right Press</name>
<type>gain</type>
<gain>1</gain>
<update-interval-secs type="double">0.05</update-interval-secs>
<input>
<expression>
<table>
<property>/controls/gear/brake-right</property>
<entry><ind> 0</ind><dep>0</dep></entry>
<entry><ind>0.3</ind><dep>1000</dep></entry>
<entry><ind>0.6</ind><dep>2000</dep></entry>
<entry><ind> 1</ind><dep>3000</dep></entry>
</table>
</expression>
</input>
<output>/systems/hydraulic/brakes/pressure-right-psi</output>
</filter>
</PropertyList>