From fa1593f9f05e6de9b4a0c6e245909aadf4faa418 Mon Sep 17 00:00:00 2001 From: Melchior FRANZ Date: Sat, 24 Sep 2011 21:26:56 +0200 Subject: [PATCH 1/7] warthog: tailwheel/reverser/speedbrake + cleanup Unfortunately, some aircraft (seahawk) don't play nice and ignore the common speedbrake property, inventing their own. (These basic concepts must be *really* hard to understand ...) --- .../ThrustMaster/Warthog/Warthog-Stick.xml | 24 +++++++++----- .../ThrustMaster/Warthog/Warthog-Throttle.xml | 33 ++++++++++++++++--- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml b/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml index 0ab91c505..fb86b6840 100644 --- a/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml +++ b/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml @@ -11,9 +11,9 @@ Thustmaster Joystick - HOTAS Warthog + Thrustmaster Joystick - HOTAS Warthog - nasal + - + updateListener : func( n ) { + var SpeedUp = getprop("/sim/speed-up"); + if (SpeedUp<0.9) + { + SpeedUp=1/SpeedUp; + SpeedUp = "1/" ~ SpeedUp; + } + setprop("/sim/gui/dialogs/replay/time-factor","" ~ SpeedUp ~ "x"); + }, - + close : func { + #removelistener( me.maxListenerId ); + }, - - - # Populate the view combo box with a list of the available views - var combo = cmdarg().getChildren("group")[1].getNode("combo"); - combo.removeChildren("value"); + findElementByName : func(base,name) { + foreach( var child; base.getChildren() ) { + var n = child.getNode( "name" ); + if( n != nil and n.getValue() == name ) + return child; + var f = me.findElementByName(child,name); + if( f != nil ) return f; + } + return nil; + }, - var current_view = getprop("/sim/current-view/view-number"); - var i = 0; - foreach (var v; view.views) { + }; - var name = "Unnamed view " ~ v.getIndex(); + var controller = ReplayDialogController.new( cmdarg() ); + controller.open(); + ]]> - if (v.getNode("name") != nil) { - name = v.getNode("name").getValue(); - } + + - # Pre-populate the combo box selected value - if (v.getIndex() == current_view) { - setprop("/sim/replay/view-name", name); - } + + hbox + fill + 28 - combo.getNode("value[" ~ i ~ "]", 1).setValue(name); - i = i + 1; - } - - + + + SANS_12B + + + + 0.9 + 0.9 + 0.9 + 1 + + 70 + - - table + + + + 0.7 + 0.7 + 0.7 + 1 + + - - 00 - right - - + + replay-looped + left + + 0.6 + 0.6 + 0.6 + 0.8 + + /sim/replay/looped + + dialog-apply + replay-looped + + + + replay-duration + 40 + + 0.5 + 0.5 + 0.5 + 0.8 + + /sim/replay/duration + + dialog-apply + replay-duration + + - - 01 - 40 - left - /sim/replay/duration - + 40 - - 10 - right - - + + + Time: %s + + 0.7 + 0.7 + 0.7 + 1 + + true + /sim/replay/time-str + - - 11 - left - 200 - /sim/replay/view-name - - dialog-apply - - + 10 - - 21 - left - /sim/replay/looped - - - dialog-apply - - - + + + Size: %.1fMB + + 0.7 + 0.7 + 0.7 + 1 + + /sim/replay/buffer-size-mbyte + - + 40 - - left - - + + + + 0.7 + 0.7 + 0.7 + 1 + + + + + + 28 + %s + + 0.7 + 0.7 + 0.7 + 1 + + true + /sim/gui/dialogs/replay/time-factor + + - - table + 1 + + + - - 10 - center - - + + hbox + center - - 11 - left - - + - - 20 - center - - + - - 21 - left - - + + + + 0.7 + 0.7 + 0.7 + 1 + + %8s + right + true + /sim/replay/start-time-str + - - 30 - center - - + + replay-time-slider + 0 + + 0.4 + 0.4 + 0.4 + 1 + + left + 350 + 0 + 1.0 + /sim/replay/time + true + + dialog-apply + replay-time-slider + + - - 31 - left - - - + + + + 0.7 + 0.7 + 0.7 + 1 + + %s + left + true + /sim/replay/end-time-str + - + - - hbox - true - - true - - true - - true - + + + + hbox + center + false + 3 + + + + + + + diff --git a/gui/menubar.xml b/gui/menubar.xml index e75a0715d..834c0c71b 100644 --- a/gui/menubar.xml +++ b/gui/menubar.xml @@ -190,6 +190,9 @@ + + replay + dialog-show replay diff --git a/keyboard.xml b/keyboard.xml index aabb75488..ce8a214ed 100644 --- a/keyboard.xml +++ b/keyboard.xml @@ -168,6 +168,10 @@ top down before the key bindings are parsed. replay + + dialog-show + replay + @@ -268,9 +272,22 @@ top down before the key bindings are parsed. ESC Prompt and quit FlightGear + + + /sim/freeze/replay-state + + dialog-show exit + + + /sim/freeze/replay-state + + property-assign + /sim/replay/disable + true + Reset FlightGear diff --git a/preferences.xml b/preferences.xml index a714cb827..f5831610b 100644 --- a/preferences.xml +++ b/preferences.xml @@ -677,6 +677,17 @@ Started September 2000 by David Megginson, david@megginson.com 90 1 true + + + 60.0 + + + 0.5 + 600.0 + + 5.0 + 3600.0 + @@ -768,6 +779,11 @@ Started September 2000 by David Megginson, david@megginson.com svn + + + /Aircraft/Generic/flightrecorder/generic-piston-propeller-4.xml + + From 45766cf824fa8ab145bfe2f1395a82113ca13075 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 1 Oct 2011 23:23:38 +0200 Subject: [PATCH 5/7] c172p: Use generic replay configuration for single engine/prop aircraft --- Aircraft/c172p/c172p-set.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Aircraft/c172p/c172p-set.xml b/Aircraft/c172p/c172p-set.xml index 0b7e7e874..8a5eeb9b9 100644 --- a/Aircraft/c172p/c172p-set.xml +++ b/Aircraft/c172p/c172p-set.xml @@ -108,7 +108,14 @@ Started October 23 2001 by John Check, fgpanels@rockfish.net 0 - + + + 0 + + C172p Flight Recorder + + + From 7d9ea536f7d50c414f5ec161eddd9a65bd9a4bd0 Mon Sep 17 00:00:00 2001 From: Melchior FRANZ Date: Sat, 1 Oct 2011 18:34:28 +0200 Subject: [PATCH 6/7] warthog: first stab at throttle hardware config (backlight + LEDs) This works under Linux only, which is certainly suboptimal. But there's no reason why support for other OSes couldn't be added later, and there's no reason to not support Linux now, either. The code can set the throttle's backlight brightness and the five programmable LEDs. As a demonstration, the latter is currently used for a gear-down warning. Support for setting the stick's hardware deadzone is planned. (It's on by default.) The mechanism writes directly to Linux' hidraw devices, which requires some simple configuration. This is described in the README. It doesn't depend on any external utility. --- Input/Joysticks/ThrustMaster/Warthog/README | 72 +++++++++++++++++++ .../ThrustMaster/Warthog/Throttle/seahawk.xml | 10 +-- .../ThrustMaster/Warthog/Warthog-Stick.xml | 10 +-- .../ThrustMaster/Warthog/Warthog-Throttle.xml | 37 ++++++++-- .../ThrustMaster/Warthog/warthog.nas | 54 ++++++++++++++ 5 files changed, 170 insertions(+), 13 deletions(-) create mode 100644 Input/Joysticks/ThrustMaster/Warthog/warthog.nas diff --git a/Input/Joysticks/ThrustMaster/Warthog/README b/Input/Joysticks/ThrustMaster/Warthog/README index fc0e4d898..a0aa1d4e5 100644 --- a/Input/Joysticks/ThrustMaster/Warthog/README +++ b/Input/Joysticks/ThrustMaster/Warthog/README @@ -33,3 +33,75 @@ axis definition uses the same index as the master file. The n-th uses etc. Nasal blocks are properly executed in the namespace of the master file, so you can access all its functions and variables. + + + + + + +Joystick configuration from within FlightGear under Linux: +-------------------------------------------------------------------------------- +This allows to set backlight brightness and LEDs from within FlightGear +without requiring any config application, by directly writing to the devices +via raw HID support. + + + +(1) Make sure your kernel has hidraw support compiled in: check if there is at + least one file listed with + + $ ls /dev/hidraw* + + or if your kernel .config contains: + + CONFIG_HIDRAW=y + + + +(2) To get a reliable, persistent file name for your Warthog devices, create + a file /etc/udev/rules.d/00-local.rules and add these lines: + + SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}!="?*", IMPORT{program}="input_id %p" + SUBSYSTEM=="hidraw", ENV{ID_SERIAL}!="?*", IMPORT{program}="usb_id --export %p" + SUBSYSTEM=="hidraw", SYMLINK+="input/hidraw/%E{ID_SERIAL}" + SUBSYSTEM=="hidraw", ENV{ID_INPUT_JOYSTICK}!="0", GROUP:="js" + + 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/: + + $ 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 Thustmaster_Joystick_-_HOTAS_Warthog -> ../hidraw0 + + Also check if the linked-to hidraw devices have proper permissions (rw for "js"): + + $ 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 + to edit a local copy of the global IOrules. Just copy the global file + to your FG_HOME directory: + + $ mkdir -p ~/.fgfs/Nasal + $ cp $FG_ROOT/Nasal/IOrules ~/.fgfs/Nasal + + Now add these two lines there: + + WRITE ALLOW /dev/input/hidraw/Thustmaster_Joystick_-_HOTAS_Warthog + WRITE ALLOW /dev/input/hidraw/Thrustmaster_Throttle_-_HOTAS_Warthog + + CAVE: Don't fix the bad spelling of "Thrustmaster", unless your stick + really uses that! + + + + +DISCLAIMER: Of course, you take all responsibility for any possible +damages to your hardware if you make these changes. Neither the +FlightGear project nor any of its developers and contributors are in +any way liable. diff --git a/Input/Joysticks/ThrustMaster/Warthog/Throttle/seahawk.xml b/Input/Joysticks/ThrustMaster/Warthog/Throttle/seahawk.xml index 2292941f4..b41ada8f4 100644 --- a/Input/Joysticks/ThrustMaster/Warthog/Throttle/seahawk.xml +++ b/Input/Joysticks/ThrustMaster/Warthog/Throttle/seahawk.xml @@ -4,11 +4,11 @@ diff --git a/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml b/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml index fb86b6840..896b6192c 100644 --- a/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml +++ b/Input/Joysticks/ThrustMaster/Warthog/Warthog-Stick.xml @@ -17,6 +17,10 @@ +