1
0
Fork 0
Commit graph

11 commits

Author SHA1 Message Date
Stuart Buchanan
221235063b Add button bindings for engine to joystick config
At the suggestion of Gilberto AGOSTINHO, add
button bindings for throttle, mixture and prop
to the joystick configuration dialog.

Specific use-case is users of game-pads, but also
useful to users with a single throttle axis on their
joystick.
2016-02-10 22:21:18 +00:00
Florent Rougon
2cf6cf4a93 joystick.PropertyScaleAxis.parse(): copy the property name too
- Since joystick.PropertyScaleAxis instances have a 'prop' attribute
  indicating the property name, it seems logical to have
  joystick.PropertyScaleAxis.parse() set this attribute based on the
  property name in its argument ('p').

- This commit also tries to improve readability by using a 'bindingNode'
  variable instead of repeatedly calling 'p.getNode("binding", 1)'.
2016-01-09 07:56:47 +01:00
Florent Rougon
769a83e64f joystick.PropertyScaleAxis.parse(): always copy 'factor' and 'inverted'
- Commit 5bcf58c7d6 forgot to set the
  'inverted' attribute when there was no 'factor' node in the argument's
  'binding' node. Fix this.

- Also copy the argument's 'factor' value to the 'factor' instance
  attribute for consistency, since joystick.PropertyScaleAxis instances
  have such an attribute initialized in the constructor.
2016-01-09 07:35:23 +01:00
Florent Rougon
703639ec68 Remove inappropriate 'deadband' attribute from joystick.PropertyScaleAxis
As far as I can tell, the dead-band setting belongs to <axis> nodes, not
to <binding> nodes using property-scale. This can be seen in
do_property_scale()'s definition (flightgear/src/Main/fg_commands.cxx)
as well as in fgdata/Docs/README.Joystick.html.

joystick.PropertyScaleAxis creates <dead-band> nodes as children of
<binding> nodes in generated joystick binding files under
$FG_HOME/Input/Joysticks which, AFAICT, are completely useless and thus
confusing. The <dead-band> nodes should be created at a different level
to be effective (cf. FGJoystickInput::postinit() in
flightgear/src/Input/FGJoystickInput.cxx).

This commit removes the 'deadband' attribute from
joystick.PropertyScaleAxis, since it has nothing to do there IMHO.
2016-01-08 15:45:58 +01:00
Florent Rougon
5bcf58c7d6 Fix nuking of property-scale's default factor by joystick-config dialog
As can be seen in do_property_scale()'s definition in
flightgear/src/Main/fg_commands.cxx, property-scale rightfully uses a
default factor of 1.0. However, if a joystick axis' property-scale
binding has no 'factor' node defined, and one opens the joystick
configuration dialog, then PropertyScaleAxis.parse() creates an empty
'factor' node that implicitely gets a value of 0. This method is called
by joystick.readConfig() when the joystick-config dialog is opened. This
has the effect of rendering the corresponding joystick axis inoperant.

How to reproduce the bug:
  - take a joystick such as the SAITEK CYBORG 3D USB, with its default
    binding file from
    fgdata/Input/Joysticks/Saitek/Cyborg-Gold-3d-USB.xml (this file uses
    property-scale for the aileron, with no explicitely defined factor);
  - start FlightGear; move the joystick left or right while looking at
    the plane wings -> the ailerons move, it works fine;
  - now, open the joystick-config dialog and do the same test -> the
    ailerons don't move anymore and the 'Aileron' value at the bottom of
    the dialog stays at 0 (0.0 or -0.0...). Just opening the dialog to
    test the joystick has "corrupted" its setup! This is very confusing
    for users.

This fix corrects the problem by avoiding the apparently unneeded
creation of an empty 'factor' node when there is none inside the
<binding>. An alternative would be to create a 'factor' node with value
1.0. In any case, if someone later expands the joystick-config dialog to
allow modification of property-scale's factor, he should make sure to
use a default value of 1.0!
2016-01-08 12:04:39 +01:00
Clément de l'Hamaide
6ca29b6fe9 Fix controls.ptt(-1) to controls.ptt(0) in Nasal/joystick.nas 2013-09-24 13:29:37 +02:00
Stuart Buchanan
fd4e61869b Add support for <nasal> blocks in the joystick nasal config library. 2013-04-12 20:24:53 +01:00
Stuart Buchanan
abcfc2073b Allow users to reset their joystick configuration from the Joystick Configuration dialog. 2012-12-07 22:42:18 +00:00
Stuart Buchanan
3656ff92c6 Fix bug where last axis of the joystick was written out with the original bindings of all buttons. 2012-09-29 21:24:12 +01:00
Stuart Buchanan
7a3d5dd0bf Updates to the Joystick Configuration dialog. 2012-08-26 21:48:53 +01:00
Stuart Buchanan
4a70a703a8 Add Joystick Configuration dialog, allowing in-sim configuration of joysticks. 2012-08-24 22:53:21 +01:00