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
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
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/*
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*
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
^^ ^^
(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);
settimer(gearcheck, 0.5);
};
init and gearcheck();
if (init)
gearcheck();
var mod = 0;
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 = {
new: func(path, bufsize) {
@ -21,9 +21,19 @@ var device = {
io.write(file, buf);
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)
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);
},
toggle_leds: func(which...) {
@ -31,7 +41,7 @@ var device = {
me.leds = bits.toggle(me.leds, me._ledmap[w]);
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);
},
brighter: func {
@ -46,9 +56,6 @@ var device = {
};
var joystick = device.new("/dev/input/hidraw/Thustmaster_Joystick_-_HOTAS_Warthog", 12);
var throttle = device.new("/dev/input/hidraw/Thrustmaster_Throttle_-_HOTAS_Warthog", 36);
throttle.set_brightness(1);
throttle.set_brightness(1); # LEDs dark (but 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>
<alpha type="float">0.8</alpha>
</color>
<keynum>359</keynum>
<binding>
<command>nasal</command>
<script><![CDATA[
var t = getprop("/sim/speed-up");
if (t > 1/32)
t=t/2;
else
t=1/32;
setprop("/sim/speed-up", t);
]]></script>
<script>controls.speedup(-1);</script>
</binding>
</button>
<text>
@ -219,17 +211,9 @@
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<keynum>357</keynum>
<binding>
<command>nasal</command>
<script><![CDATA[
var t = getprop("/sim/speed-up");
if (t < 32)
t=t*2;
else
t=32;
setprop("/sim/speed-up", t);
]]></script>
<script>controls.speedup(1);</script>
</binding>
</button>
@ -290,15 +274,7 @@
</color>
<binding>
<command>nasal</command>
<script><![CDATA[
var t = getprop("/sim/replay/time");
if (t != "")
{
t-=30;
if (t<0) t=0;
setprop("/sim/replay/time", t);
}
]]></script>
<script>controls.replaySkip(-30);</script>
</binding>
</button>
@ -312,18 +288,9 @@
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<keynum>356</keynum>
<binding>
<command>nasal</command>
<script><![CDATA[
var t = getprop("/sim/replay/time");
if (t != "")
{
t-=5;
if (t<0) t=0;
setprop("/sim/replay/time", t);
}
]]></script>
<script>controls.replaySkip(-5);</script>
</binding>
</button>
@ -386,20 +353,9 @@
<blue type="float">0.3</blue>
<alpha type="float">0.8</alpha>
</color>
<keynum>358</keynum>
<binding>
<command>nasal</command>
<script><![CDATA[
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>
<script>controls.replaySkip(5);</script>
</binding>
</button>
@ -415,17 +371,7 @@
</color>
<binding>
<command>nasal</command>
<script><![CDATA[
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>
<script>controls.replaySkip(30);</script>
</binding>
</button>
</group>

View file

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

View file

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

View file

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

View file

@ -85,13 +85,13 @@ Started September 2000 by David Megginson, david@megginson.com
DrawThreadPerContext
CullDrawThreadPerContext
CullThreadPerCameraDrawThreadPerContext
NOTE: Enabling this option currently breaks the screenshot function.
-->
<static-lod>
<detailed userarchive="y">1500</detailed>
<rough userarchive="y">9000</rough>
<bare userarchive="y">30000</bare>
<ai-detailed userarchive="y">10000</ai-detailed>
<!-- ai-bare userarchive="y">10000</ai-bare -->
</static-lod>
<random-objects type="bool"
userarchive="y">true</random-objects>
@ -740,6 +740,7 @@ Started September 2000 by David Megginson, david@megginson.com
userarchive="y">true</chat-display>
<chat-menu include="ATC/chat-menu-entries.xml"/>
<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>
</multiplay>