1
0
Fork 0

Merge branch 'master' of gitorious.org:fg/fgdata

This commit is contained in:
Durk Talsma 2011-10-03 21:09:10 +02:00
commit c5f0b7f49d
9 changed files with 113 additions and 99 deletions

View file

@ -69,7 +69,7 @@ via raw HID support.
If you don't have a user group "js" (for joystick hardware access) either If you don't have a user group "js" (for joystick hardware access) either
create one or, in the fourth line, use a group instead where all joystick create one or, in the fourth line, use a group instead where all joystick
users are member, e.g. GROUP:="users". Then plug your Warthog devices out users are member, e.g. GROUP:="users". Then plug your Warthog devices out
and in again and check if this created two device files under /dev/hid/: and in again and check if this created two device links:
$ ls -l /dev/input/hidraw/* $ ls -l /dev/input/hidraw/*
lrwxrwxrwx 1 root root 10 Oct 2 14:23 Thrustmaster_Throttle_-_HOTAS_Warthog -> ../hidraw1 lrwxrwxrwx 1 root root 10 Oct 2 14:23 Thrustmaster_Throttle_-_HOTAS_Warthog -> ../hidraw1
@ -80,7 +80,7 @@ via raw HID support.
$ ls -l /dev/hidraw* $ ls -l /dev/hidraw*
crw-rw---- 1 root js 251, 0 Oct 2 09:11 /dev/hidraw0 crw-rw---- 1 root js 251, 0 Oct 2 09:11 /dev/hidraw0
crw-rw---- 1 root js 251, 1 Oct 2 14:23 /dev/hidraw1 crw-rw---- 1 root js 251, 1 Oct 2 14:23 /dev/hidraw1
^^ ^^
(3) Allow FlightGear to write to the two devices. The best way to do this is (3) Allow FlightGear to write to the two devices. The best way to do this is

View file

@ -50,7 +50,8 @@
warthog.throttle.set_leds(0, 1, 2, 3, 4, 5); warthog.throttle.set_leds(0, 1, 2, 3, 4, 5);
settimer(gearcheck, 0.5); settimer(gearcheck, 0.5);
}; };
init and gearcheck(); if (init)
gearcheck();
var mod = 0; var mod = 0;
var m = props.globals.initNode("/devices/status/joysticks/warthog/modifier", mod, "INT"); var m = props.globals.initNode("/devices/status/joysticks/warthog/modifier", mod, "INT");

View file

@ -1,4 +1,4 @@
# HIDRAW Interface (currently Linux-only; see README) # Hardware Interface (currently Linux/HIDRAW-only; see README)
var device = { var device = {
new: func(path, bufsize) { new: func(path, bufsize) {
@ -21,9 +21,19 @@ var device = {
io.write(file, buf); io.write(file, buf);
io.close(file); io.close(file);
}, },
set_leds: func(on, which...) { # on/off, list of leds (0: background, 1-5) };
var joystick = {
parents: [device.new("/dev/input/hidraw/Thustmaster_Joystick_-_HOTAS_Warthog", 12)],
};
var throttle = {
parents: [device.new("/dev/input/hidraw/Thrustmaster_Throttle_-_HOTAS_Warthog", 36)],
set_leds: func(state, which...) { # on/off, list of leds (0: background, 1-5)
foreach (var w; which) foreach (var w; which)
me.leds = bits.switch(me.leds, me._ledmap[w], on); me.leds = bits.switch(me.leds, me._ledmap[w], state);
me.send(6, me.leds, me.bright); me.send(6, me.leds, me.bright);
}, },
toggle_leds: func(which...) { toggle_leds: func(which...) {
@ -31,7 +41,7 @@ var device = {
me.leds = bits.toggle(me.leds, me._ledmap[w]); me.leds = bits.toggle(me.leds, me._ledmap[w]);
me.send(6, me.leds, me.bright); me.send(6, me.leds, me.bright);
}, },
set_brightness: func(v) { set_brightness: func(v) { # clamped to [0,5], where 0 is off and 5 is bright
me.send(6, me.leds, me.bright = v < 0 ? 0 : v > 5 ? 5 : v); me.send(6, me.leds, me.bright = v < 0 ? 0 : v > 5 ? 5 : v);
}, },
brighter: func { brighter: func {
@ -46,9 +56,6 @@ var device = {
}; };
var joystick = device.new("/dev/input/hidraw/Thustmaster_Joystick_-_HOTAS_Warthog", 12); throttle.set_brightness(1); # LEDs dark (but on)
var throttle = device.new("/dev/input/hidraw/Thrustmaster_Throttle_-_HOTAS_Warthog", 36);
throttle.set_brightness(1);
throttle.set_leds(1, 0); # backlight on throttle.set_leds(1, 0); # backlight on
throttle.set_leds(0, 1, 2, 3, 4, 5); # other LEDs off setlistener("/sim/signals/exit", func throttle.set_leds(0, 1, 2, 3, 4, 5), 1); # other LEDs off (now and at exit)

View file

@ -470,3 +470,33 @@ _setlistener("/sim/signals/fdm-initialized", func {
} }
}); });
var replaySkip = func(skip_time)
{
var t = getprop("/sim/replay/time");
if (t != "")
{
t+=skip_time;
if (t>getprop("/sim/replay/end-time"))
t = getprop("/sim/replay/end-time");
if (t<0)
t=0;
setprop("/sim/replay/time", t);
}
}
var speedup = func(speed_up)
{
var t = getprop("/sim/speed-up");
if (speed_up < 0)
{
t = (t > 1/32) ? t/2 : 1/32;
if ((t<1)and(0==getprop("/sim/freeze/replay-state")))
t=1;
}
else
{
t = (t < 32) ? t*2 : 32;
}
setprop("/sim/speed-up", t);
}

View file

@ -183,17 +183,9 @@
<blue type="float">0.3</blue> <blue type="float">0.3</blue>
<alpha type="float">0.8</alpha> <alpha type="float">0.8</alpha>
</color> </color>
<keynum>359</keynum>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script><![CDATA[ <script>controls.speedup(-1);</script>
var t = getprop("/sim/speed-up");
if (t > 1/32)
t=t/2;
else
t=1/32;
setprop("/sim/speed-up", t);
]]></script>
</binding> </binding>
</button> </button>
<text> <text>
@ -219,17 +211,9 @@
<blue type="float">0.3</blue> <blue type="float">0.3</blue>
<alpha type="float">0.8</alpha> <alpha type="float">0.8</alpha>
</color> </color>
<keynum>357</keynum>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script><![CDATA[ <script>controls.speedup(1);</script>
var t = getprop("/sim/speed-up");
if (t < 32)
t=t*2;
else
t=32;
setprop("/sim/speed-up", t);
]]></script>
</binding> </binding>
</button> </button>
@ -290,15 +274,7 @@
</color> </color>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script><![CDATA[ <script>controls.replaySkip(-30);</script>
var t = getprop("/sim/replay/time");
if (t != "")
{
t-=30;
if (t<0) t=0;
setprop("/sim/replay/time", t);
}
]]></script>
</binding> </binding>
</button> </button>
@ -312,18 +288,9 @@
<blue type="float">0.3</blue> <blue type="float">0.3</blue>
<alpha type="float">0.8</alpha> <alpha type="float">0.8</alpha>
</color> </color>
<keynum>356</keynum>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script><![CDATA[ <script>controls.replaySkip(-5);</script>
var t = getprop("/sim/replay/time");
if (t != "")
{
t-=5;
if (t<0) t=0;
setprop("/sim/replay/time", t);
}
]]></script>
</binding> </binding>
</button> </button>
@ -386,20 +353,9 @@
<blue type="float">0.3</blue> <blue type="float">0.3</blue>
<alpha type="float">0.8</alpha> <alpha type="float">0.8</alpha>
</color> </color>
<keynum>358</keynum>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script><![CDATA[ <script>controls.replaySkip(5);</script>
var t = getprop("/sim/replay/time");
if (t != "")
{
t+=5;
if (t>getprop("/sim/replay/end-time"))
t = getprop("/sim/replay/end-time")-0.1;
if (t<0) t=0;
setprop("/sim/replay/time", t);
}
]]></script>
</binding> </binding>
</button> </button>
@ -415,17 +371,7 @@
</color> </color>
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script><![CDATA[ <script>controls.replaySkip(30);</script>
var t = getprop("/sim/replay/time");
if (t != "")
{
t+=30;
if (t>getprop("/sim/replay/end-time"))
t = getprop("/sim/replay/end-time")-0.1;
if (t<0) t=0;
setprop("/sim/replay/time", t);
}
]]></script>
</binding> </binding>
</button> </button>
</group> </group>

View file

@ -33,46 +33,67 @@
<halign>center</halign> <halign>center</halign>
<text> <text>
<row>0</row><col>1</col> <row>0</row><col>1</col><colspan>3</colspan>
<label>Max. Range (m)</label> <label>Max. Ranges (m)</label>
</text> </text>
<text> <text>
<row>1</row><col>0</col> <row>1</row><col>1</col>
<halign>right</halign>
<label>Detailed</label> <label>Detailed</label>
</text> </text>
<text>
<input> <row>1</row><col>2</col>
<row>1</row><col>1</col> <label>Rough</label>
<halign>fill</halign> </text>
<property>/sim/rendering/static-lod/detailed</property> <text>
</input> <row>1</row><col>3</col>
<label>Bare</label>
</text>
<text> <text>
<row>2</row><col>0</col> <row>2</row><col>0</col>
<halign>right</halign> <halign>right</halign>
<label>Rough</label> <label>Scenery</label>
</text> </text>
<input> <input>
<row>2</row><col>1</col> <row>2</row><col>1</col>
<halign>fill</halign> <halign>fill</halign>
<property>/sim/rendering/static-lod/detailed</property>
</input>
<input>
<row>2</row><col>2</col>
<halign>fill</halign>
<property>/sim/rendering/static-lod/rough</property> <property>/sim/rendering/static-lod/rough</property>
</input> </input>
<input>
<row>2</row><col>3</col>
<halign>fill</halign>
<property>/sim/rendering/static-lod/bare</property>
</input>
<text> <text>
<row>3</row><col>0</col> <row>3</row><col>0</col>
<halign>right</halign> <halign>right</halign>
<label>Bare</label> <label>AI/MP Aircraft</label>
</text> </text>
<input> <input>
<row>3</row><col>1</col> <row>3</row><col>1</col>
<halign>fill</halign> <halign>fill</halign>
<property>/sim/rendering/static-lod/bare</property> <property>/sim/rendering/static-lod/ai-detailed</property>
</input> </input>
<!-- // meaningless for now...
<input>
<row>3</row><col>3</col>
<halign>fill</halign>
<property>/sim/rendering/static-lod/ai-bare</property>
</input>
-->
</group> </group>
<hrule/> <hrule/>

View file

@ -86,10 +86,8 @@
<button> <button>
<legend>-</legend> <legend>-</legend>
<binding> <binding>
<command>property-adjust</command> <command>nasal</command>
<property>/sim/speed-up</property> <script>controls.speedup(-1);</script>
<min>1</min>
<step type="double">-1</step>
</binding> </binding>
</button> </button>
<button> <button>
@ -104,10 +102,8 @@
<button> <button>
<legend>+</legend> <legend>+</legend>
<binding> <binding>
<command>property-adjust</command> <command>nasal</command>
<property>/sim/speed-up</property> <script>controls.speedup(1);</script>
<min>1</min>
<step type="double">1</step>
</binding> </binding>
</button> </button>
</group> </group>

View file

@ -1259,7 +1259,10 @@ top down before the key bindings are parsed.
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
controls.incAileron(-0.05, -1.0) if (getprop("/sim/freeze/replay-state"))
controls.replaySkip(-5);
else
controls.incAileron(-0.05, -1.0)
</script> </script>
</binding> </binding>
<mod-shift> <mod-shift>
@ -1279,7 +1282,10 @@ top down before the key bindings are parsed.
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
controls.incElevator(0.05, -100) if (getprop("/sim/freeze/replay-state"))
controls.speedup(1);
else
controls.incElevator(0.05, -100)
</script> </script>
</binding> </binding>
<mod-shift> <mod-shift>
@ -1299,7 +1305,10 @@ top down before the key bindings are parsed.
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
controls.incAileron(0.05, 1.0) if (getprop("/sim/freeze/replay-state"))
controls.replaySkip(5);
else
controls.incAileron(0.05, 1.0)
</script> </script>
<step type="double">0.05</step> <step type="double">0.05</step>
</binding> </binding>
@ -1320,7 +1329,10 @@ top down before the key bindings are parsed.
<binding> <binding>
<command>nasal</command> <command>nasal</command>
<script> <script>
controls.incElevator(-0.05, 100) if (getprop("/sim/freeze/replay-state"))
controls.speedup(-1);
else
controls.incElevator(-0.05, 100)
</script> </script>
</binding> </binding>
<mod-shift> <mod-shift>

View file

@ -85,13 +85,13 @@ Started September 2000 by David Megginson, david@megginson.com
DrawThreadPerContext DrawThreadPerContext
CullDrawThreadPerContext CullDrawThreadPerContext
CullThreadPerCameraDrawThreadPerContext CullThreadPerCameraDrawThreadPerContext
NOTE: Enabling this option currently breaks the screenshot function.
--> -->
<static-lod> <static-lod>
<detailed userarchive="y">1500</detailed> <detailed userarchive="y">1500</detailed>
<rough userarchive="y">9000</rough> <rough userarchive="y">9000</rough>
<bare userarchive="y">30000</bare> <bare userarchive="y">30000</bare>
<ai-detailed userarchive="y">10000</ai-detailed>
<!-- ai-bare userarchive="y">10000</ai-bare -->
</static-lod> </static-lod>
<random-objects type="bool" <random-objects type="bool"
userarchive="y">true</random-objects> userarchive="y">true</random-objects>
@ -740,6 +740,7 @@ Started September 2000 by David Megginson, david@megginson.com
userarchive="y">true</chat-display> userarchive="y">true</chat-display>
<chat-menu include="ATC/chat-menu-entries.xml"/> <chat-menu include="ATC/chat-menu-entries.xml"/>
<write-message-log type="bool">false</write-message-log> <write-message-log type="bool">false</write-message-log>
<freeze-on-replay type="bool">true</freeze-on-replay>
<default-model type="string">Models/Geometry/glider.ac</default-model> <default-model type="string">Models/Geometry/glider.ac</default-model>
</multiplay> </multiplay>