Rewrite copilot for better callouts and code readability. Still ugly.

parent 1d60e044
This diff is collapsed.
......@@ -91,7 +91,12 @@ setlistener("/sim/signals/fdm-initialized", func(p) {
Tu144.BoostpumpAll(1);
}
Tu144.PrepareInstruments();
if((state == "parking") or (state == "gate")){
Tu144.PrepareNPK();
}else{
Tu144.PrepareInstruments();
};
if(state == "parking"){
Tu144.NPKMode(0);
......
......@@ -138,6 +138,44 @@ ThrottleDoAll = func () {
}
}
# @brief Push and hold throttle.
# @param eng Engine, 0..4.
ThrottlePush = func (eng) {
# XXX Non-JSBSim!
setprop("/controls/engines/engine[" ~ eng ~ "]/throttle", 1.0);
}
# @brief Push and hold throttle 1, 4.
ThrottlePush14 = func () {
for(var ii = 0; ii < 4; ii += 3){
ThrottlePush(ii);
}
}
# @brief Pull and hold all throttle levers.
ThrottlePullAll = func () {
for(var ii = 0; ii < 4; ii += 1){
# XXX Non-JSBSim!
setprop("/controls/engines/engine[" ~ ii ~ "]/throttle", 0.0);
}
}
# @brief Release all throttle levers.
ThrottleReleaseAll = func () {
for(var ii = 0; ii < 4; ii += 1){
# XXX Non-JSBSim!
setprop("/controls/engines/engine[" ~ ii ~ "]/throttle", 0.5);
}
}
# @brief Toggle reverse.
# Toggle reverse. Works only when reverse lever is unlocked.
ReversersAll = func (on) {
for(var ii = 0; ii < 4; ii += 3){
setprop("/fdm/jsbsim/propulsion/engine[" ~ ii ~ "]/panel/lever/reverser/cmd-norm", on);
}
}
# @brief Canard power switch.
CanardPower = func (on) {
......@@ -199,6 +237,33 @@ Parkingbrake = func (on) {
}
# @brief Deploy parachute.
Chute = func () {
setprop("/fdm/jsbsim/fcs/panel/button/chute-deploy", 1);
settimer(func {
setprop("/fdm/jsbsim/fcs/panel/button/chute-deploy", 0);
}, 2.0);
}
# @brief Deploy parachute.
Parachute = func () {
setprop("/fdm/jsbsim/fcs/panel/button/chute-deploy", 1);
settimer(func {
setprop("/fdm/jsbsim/fcs/panel/button/chute-deploy", 0);
}, 2.0);
}
# @brief Drop parachute.
ParachuteDrop = func () {
setprop("/fdm/jsbsim/fcs/panel/button/chute-drop", 1);
settimer(func {
setprop("/fdm/jsbsim/fcs/panel/button/chute-drop", 0);
}, 2.0);
}
# @brief Engine cutoff.
# @param eng Engine number 0..3.
Cutoff = func(eng, cutoff) {
......@@ -583,6 +648,12 @@ AckMaster = func () {
}, 1.0);
}
# @brief Prepare NPK settings.
PrepareNPK = func () {
SetMagvar(magvar());
NPKLandingAirport(getprop("/fdm/jsbsim/fcs/NPK/Orbita/flightplan/AP/count"));
}
# @brief Prepare all instruments.
PrepareInstruments = func () {
QNH = int(getprop("/environment/metar/pressure-sea-level-inhg") * 25.4);
......@@ -591,8 +662,7 @@ PrepareInstruments = func () {
for(var ii = 0; ii < 2; ii += 1){
ResetGmeter(ii, QNH);
}
SetMagvar(magvar());
NPKLandingAirport(getprop("/fdm/jsbsim/fcs/NPK/Orbita/flightplan/AP/count"));
PrepareNPK();
}
......@@ -688,7 +758,7 @@ PreFueling = func {
settimer(func {
ElecAPU();
NPKMode(1);
PrepareInstruments();
PrepareNPK();
APUBleed(1);
AirconGate();
LightsGate();
......@@ -749,6 +819,7 @@ PreTaxi = func {
APUBleed(0);
CanardPower(1);
ConePower(1);
PrepareInstruments();
settimer(func {
APUStartStop(0);
APUPower(0);
......
......@@ -1173,36 +1173,6 @@ done
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot threshold</name>
<path>Sounds/Copilot/threshold.wav</path>
<condition>
<property>sim/crew/copilot/sound/threshold</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot touchdown</name>
<path>Sounds/Copilot/touchdown.wav</path>
<condition>
<property>sim/crew/copilot/sound/touchdown</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot reversers</name>
<path>Sounds/Copilot/reversers.wav</path>
<condition>
<property>sim/crew/copilot/sound/reversers</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot canard_ext</name>
<path>Sounds/Copilot/canard_ext.wav</path>
......@@ -1294,100 +1264,190 @@ done
</Copilot>
<Copilot>
<name>Copilot h1</name>
<path>Sounds/Copilot/h1.wav</path>
<name>Copilot H_1</name>
<path>Sounds/Copilot/H_1.wav</path>
<condition>
<property>sim/crew/copilot/sound/H_1</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot H_10</name>
<path>Sounds/Copilot/H_10.wav</path>
<condition>
<property>sim/crew/copilot/sound/H_10</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot H_100</name>
<path>Sounds/Copilot/H_100.wav</path>
<condition>
<property>sim/crew/copilot/sound/h1</property>
<property>sim/crew/copilot/sound/H_100</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h10</name>
<path>Sounds/Copilot/h10.wav</path>
<name>Copilot H_120</name>
<path>Sounds/Copilot/H_120.wav</path>
<condition>
<property>sim/crew/copilot/sound/h10</property>
<property>sim/crew/copilot/sound/H_120</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h100</name>
<path>Sounds/Copilot/h100.wav</path>
<name>Copilot H_150</name>
<path>Sounds/Copilot/H_150.wav</path>
<condition>
<property>sim/crew/copilot/sound/h100</property>
<property>sim/crew/copilot/sound/H_150</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h120</name>
<path>Sounds/Copilot/h120.wav</path>
<name>Copilot H_20</name>
<path>Sounds/Copilot/H_20.wav</path>
<condition>
<property>sim/crew/copilot/sound/h120</property>
<property>sim/crew/copilot/sound/H_20</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h150</name>
<path>Sounds/Copilot/h150.wav</path>
<name>Copilot H_200</name>
<path>Sounds/Copilot/H_200.wav</path>
<condition>
<property>sim/crew/copilot/sound/h150</property>
<property>sim/crew/copilot/sound/H_200</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h20</name>
<path>Sounds/Copilot/h20.wav</path>
<name>Copilot H_250</name>
<path>Sounds/Copilot/H_250.wav</path>
<condition>
<property>sim/crew/copilot/sound/h20</property>
<property>sim/crew/copilot/sound/H_250</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h200</name>
<path>Sounds/Copilot/h200.wav</path>
<name>Copilot H_3</name>
<path>Sounds/Copilot/H_3.wav</path>
<condition>
<property>sim/crew/copilot/sound/h200</property>
<property>sim/crew/copilot/sound/H_3</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h250</name>
<path>Sounds/Copilot/h250.wav</path>
<name>Copilot H_30</name>
<path>Sounds/Copilot/H_30.wav</path>
<condition>
<property>sim/crew/copilot/sound/h250</property>
<property>sim/crew/copilot/sound/H_30</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h40</name>
<path>Sounds/Copilot/h40.wav</path>
<name>Copilot H_40</name>
<path>Sounds/Copilot/H_40.wav</path>
<condition>
<property>sim/crew/copilot/sound/h40</property>
<property>sim/crew/copilot/sound/H_40</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot h80</name>
<path>Sounds/Copilot/h80.wav</path>
<name>Copilot H_6</name>
<path>Sounds/Copilot/H_6.wav</path>
<condition>
<property>sim/crew/copilot/sound/h80</property>
<property>sim/crew/copilot/sound/H_6</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot H_60</name>
<path>Sounds/Copilot/H_60.wav</path>
<condition>
<property>sim/crew/copilot/sound/H_60</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot H_80</name>
<path>Sounds/Copilot/H_80.wav</path>
<condition>
<property>sim/crew/copilot/sound/H_80</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot V_240</name>
<path>Sounds/Copilot/V_240.wav</path>
<condition>
<property>sim/crew/copilot/sound/V_240</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot V_260</name>
<path>Sounds/Copilot/V_260.wav</path>
<condition>
<property>sim/crew/copilot/sound/V_260</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot V_280</name>
<path>Sounds/Copilot/V_280.wav</path>
<condition>
<property>sim/crew/copilot/sound/V_280</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot V_300</name>
<path>Sounds/Copilot/V_300.wav</path>
<condition>
<property>sim/crew/copilot/sound/V_300</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot V_320</name>
<path>Sounds/Copilot/V_320.wav</path>
<condition>
<property>sim/crew/copilot/sound/V_320</property>
</condition>
<mode>once</mode>
<type>avionics</type>
......@@ -1433,6 +1493,16 @@ done
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot reversers</name>
<path>Sounds/Copilot/reversers.wav</path>
<condition>
<property>sim/crew/copilot/sound/reversers</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot rolling</name>
<path>Sounds/Copilot/rolling.wav</path>
......@@ -1463,6 +1533,26 @@ done
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot threshold</name>
<path>Sounds/Copilot/threshold.wav</path>
<condition>
<property>sim/crew/copilot/sound/threshold</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Copilot>
<name>Copilot touchdown</name>
<path>Sounds/Copilot/touchdown.wav</path>
<condition>
<property>sim/crew/copilot/sound/touchdown</property>
</condition>
<mode>once</mode>
<type>avionics</type>
</Copilot>
<Engineer>
<name>Engineer eng1idle</name>
......
......@@ -17,16 +17,20 @@
<signal><property type="string">sim/crew/copilot/sound/gear_in</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/gear_out</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/gear_ret</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h1</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h10</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h100</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h120</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h150</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h20</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h200</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h250</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h40</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/h80</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_1</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_10</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_100</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_120</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_150</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_20</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_200</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_250</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_3</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_30</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_40</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_6</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_60</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/H_80</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/parachute</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/PPM</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/predecision</property><type>int</type><interpolation>discrete</interpolation></signal>
......@@ -37,6 +41,11 @@
<signal><property type="string">sim/crew/copilot/sound/safety</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/threshold</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/touchdown</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/V_240</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/V_260</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/V_280</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/V_300</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/copilot/sound/V_320</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/engineer/sound/apu_off</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/engineer/sound/eng1fault</property><type>int</type><interpolation>discrete</interpolation></signal>
<signal><property type="string">sim/crew/engineer/sound/eng1idle</property><type>int</type><interpolation>discrete</interpolation></signal>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment