Improve compatibility with controls.nas.

parent c75822bd
......@@ -66,6 +66,15 @@ y Скрыть/показать штурвал и подлоко
w Сброс сигналов "связь" (кроме режимов САУ) и
"опасно"
Режим "Приём/передача" СПУ первого пилота управляется клавишей
"Пробел", при этом в зависимости от клавиш регистра переключатель
"Радио" СПУ переводится в следующее положение:
Пробел УКВ1
Shift-Пробел УКВ2
Control-Пробел КВ1
Control-Shift-Пробел КВ2
ПРИМЕЧАНИЕ. Переключение внутренних видов по клавише "c" игнорирует
настройки диалога "View Options" симулятора. Это сделано для того,
чтобы без ущерба управлению самолётом освободить клавишу "v" для
......
......@@ -449,7 +449,7 @@ var _loop = func {
if(braking){
do(func {
if(!chute and _deploy_parachute){
Tu144.Chute();
Tu144.Chute(1);
}
if(!reversers and _deploy_reversers){
Tu144.ReversersAll(30.0);
......@@ -478,7 +478,7 @@ var _loop = func {
if(braking < _braking){
do(func{
if(chute){
Tu144.ParachuteDrop();
Tu144.Chute(0);
}
Tu144.ReversersAll(0.0);
});
......
......@@ -134,7 +134,6 @@ CanardPower = func (on) {
# @brief Canard command.
# @param cmd 0: Retract (default), 1: Stop, 2: Extend.
CanardCmd = func (cmd) {
CanardPower(1);
setprop("/fdm/jsbsim/fcs/panel/switch/canard", cmd);
}
......@@ -147,7 +146,6 @@ ConePower = func (on) {
# @brief Cone command.
# @param cmd 0: Retract (default), 1: Takeoff, 2: Landing.
ConeCmd = func (cmd) {
ConePower(1);
setprop("/fdm/jsbsim/fcs/panel/switch/cone", cmd);
}
......@@ -187,29 +185,19 @@ 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);
# @param cmd 0: Drop, 1: Deploy.
Chute = func (cmd) {
if(cmd){
setprop("/fdm/jsbsim/fcs/panel/button/chute-deploy", 1);
settimer(func {
setprop("/fdm/jsbsim/fcs/panel/button/chute-deploy", 0);
}, 2.0);
}else{
setprop("/fdm/jsbsim/fcs/panel/button/chute-drop", 1);
settimer(func {
setprop("/fdm/jsbsim/fcs/panel/button/chute-drop", 0);
}, 2.0);
}
}
......@@ -867,6 +855,22 @@ Cargodoors = func(cmd) {
}, 5.0);
}
# @brief Select SPU radio.
# @param seat 0: Pilot, 1: Copilot, 2: Engineer, 3: Navigator.
# XXX Seat number unused for now, as only pilot's SPU is implemented.
# @param radio 0: KW1, 1: KW2. 2: UKW1, 3: UKW2
SPU = func(seat, radio) {
setprop("/fdm/jsbsim/systems/comm/SPU/SPU[0]/panel/switch/radio", radio);
}
# @brief SPU push to talk button.
# @param seat 0: Pilot, 1: Copilot, 2: Engineer, 3: Navigator.
# XXX Seat number unused for now, as only pilot's SPU is implemented.
# @param ptt PTT pressed.
PTT = func(seat, ptt) {
setprop("/fdm/jsbsim/systems/comm/SPU/SPU[0]/panel/button/ptt", ptt);
}
# @brief Chocks
Chocks = func (on) {
......@@ -975,12 +979,41 @@ PreTaxi = func {
}
# Not supported.
# FG control bindings
controls.ptt = func(ptt){
if(ptt){
# SIC Moving UKW radios to be first, for convenience.
SPU(0, math.mod((ptt + 1), 4));
}
PTT(0, ptt > 1 ? 1 : ptt);
}
# XXX Does not support neutral position.
setlistener("/controls/gear/gear-down", func(p) {
GearCmd(-1 + 2 * p.getValue());
});
setlistener("/controls/flight/flaps", func(p) {
CanardCmd(2 * p.getValue());
});
setlistener("/controls/flight/wing-sweep", func(p) {
ConeCmd(2 * p.getValue());
});
# XXX Does not press and release keys directly, we use timers.
setlistener("/controls/flight/drag-chute", func(p) {
Chute(p.getValue());
});
# Disable unsupported or irrelevant menu items.
gui.menuEnable ("failure-submenu", 0);
gui.menuEnable ("random-failures", 0);
gui.menuEnable ("system-failures", 0);
gui.menuEnable ("instrument-failures", 0);
# Irrelevant.
gui.menuEnable ("autopilot", 0);
gui.menuEnable ("radio", 0);
gui.menuEnable ("gps", 0);
......
<?xml version="1.0" encoding="UTF-8"?>
<PropertyList>
<!-- Lookup: /devices/status/keyboard/event -->
<nasal>
<script>
var mod = { shift: 1, ctrl: 2, alt: 4, meta: 8, super: 16, hyper: 32 };
<script><![CDATA[
var mod = { shift: 1, ctrl: 2, alt: 4, meta: 8, super: 16, hyper: 32 };
var modifiers = props.globals.getNode("/devices/status/keyboard");
var shift = props.globals.getNode("/devices/status/keyboard/shift");
var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
var alt = props.globals.getNode("/devices/status/keyboard/alt");
var modifiers = props.globals.getNode("/devices/status/keyboard");
var shift = props.globals.getNode("/devices/status/keyboard/shift");
var ctrl = props.globals.getNode("/devices/status/keyboard/ctrl");
var alt = props.globals.getNode("/devices/status/keyboard/alt");
var space_release = func nil;
var space = func(state, mod) {
if (!state) {
space_release();
return space_release = func nil;
}
if (mod == 0 or mod == 1) {
setprop("/fdm/jsbsim/systems/comm/SPU/SPU[0]/panel/button/ptt", 1);
space_release = func setprop("/fdm/jsbsim/systems/comm/SPU/SPU[0]/panel/button/ptt", 0);
}
}
</script>
var space_release = func nil;
var space = func(state, mod) {
if (!state) {
space_release();
return space_release = func nil;
}
if ((mod > -1) and (mod < 5)) {
controls.ptt(mod + 1);
space_release = func controls.ptt(0);
}
}
]]></script>
</nasal>
<!-- DEBUG -->
......@@ -277,11 +275,8 @@
<name>f</name>
<desc>Raise cone</desc>
<binding>
<command>property-adjust</command>
<property>/fdm/jsbsim/fcs/panel/switch/cone</property>
<step type="int">-1</step>
<min type="int">0</min>
<max type="int">2</max>
<command>nasal</command>
<script>controls.wingSweep(-1)</script>
</binding>
</key>
......@@ -289,35 +284,8 @@
<name>F</name>
<desc>Lower cone</desc>
<binding>
<command>property-adjust</command>
<property>/fdm/jsbsim/fcs/panel/switch/cone</property>
<step type="int">1</step>
<min type="int">0</min>
<max type="int">2</max>
</binding>
</key>
<key n="91">
<name>[</name>
<desc>Retract canard</desc>
<binding>
<command>property-adjust</command>
<property>/fdm/jsbsim/fcs/panel/switch/canard</property>
<step type="int">-1</step>
<min type="int">0</min>
<max type="int">2</max>
</binding>
</key>
<key n="93">
<name>]</name>
<desc>Extend canard</desc>
<binding>
<command>property-adjust</command>
<property>/fdm/jsbsim/fcs/panel/switch/canard</property>
<step type="int">1</step>
<min type="int">0</min>
<max type="int">2</max>
<command>nasal</command>
<script>controls.wingSweep(1)</script>
</binding>
</key>
......
......@@ -32,12 +32,15 @@
<property>fcs/elevator-cmd-norm</property>
<property>fcs/aileron-cmd-norm</property>
<property>fcs/rudder-cmd-norm</property>
<!-- TODO Use these vars again instead of custom ones? -->
<!-- Canard -->
<property>fcs/flap-cmd-norm</property>
<!-- Cone -->
<property>fcs/wing-fold-cmd-norm</property>
<!-- Chute -->
<property>fcs/speedbrake-cmd-norm</property>
<!-- Brakes -->
<property>fcs/left-brake-inp-norm</property>
<property>fcs/right-brake-inp-norm</property>
......
......@@ -1300,6 +1300,18 @@
<!-- Don't have 2D panels. -->
<panel><path/></panel><panel_2><path/></panel_2>
<!-- FG bindings for canard and nose cone. -->
<flaps>
<setting>0.0</setting>
<setting>0.5</setting>
<setting>1.0</setting>
</flaps>
<wing-sweep>
<setting>0.0</setting>
<setting>0.5</setting>
<setting>1.0</setting>
</wing-sweep>
</sim>
......
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