Jump to content

More axes and rotary switches please.


Recommended Posts

  • 2 weeks later...

You can add the following line to your joystick default.lua file to add an axis control for the PKV elevation knob:

{action = 3003, cockpit_device_id = 47, name = _('Sight Limb Knob')},

(Note that it must be within a set of join(res.axisCommands,{}) brackets, and OUTSIDE of the join(res.keyCommands,{}) block, e.g.

join(res.axisCommands,{
{action = 3003, cockpit_device_id = 47, name = _('Sight Limb Knob')},
})
join(res.keyCommands,{
       --All the normal joystick commands here
})

(There's also a join(res.axisCommands,{}) block near the end of the file, but I like to keep my custom commands at the top to keep things tidy.)

 

There are several caveats to this, though—the axis is really only meant to be manipulated as a clickable cockpit element, so binding it as an axis lets it elevate about twice as high as it's supposed to go (as well as about 25% lower than otherwise able) because the clickabledata.lua file initializes the axis as follows:

elements["PTR-PKV-ROTARY"]		= default_axis_limited(_("Sight Limb Knob"), devices.PKV, device_commands.Button_3, 855, 0.0, 0.1, false, false, {0, 0.807})

This means that the axis limits range from 0 to 0.807 as a clickable cockpit control, but unfortunately when initialized in default.lua, the limits are set as -1 to 1 (I haven't figured out how to set limits on the axis in default.lua).

You can work around this somewhat by using Axis Tune to make it an Inverted Slider with a Saturation Y of 50, but the downwards overtravel remains.

 

This line can be added to control the sight brightness knob on an axis:

{action = 3001, cockpit_device_id = 47, name = _('Sight Brightness Knob')},

If you apply the same Axis Tune settings as I suggested for the PKV elevation knob, it should work perfectly.

 

I don't use either of these myself, but I have found this to be a particularly useful command (to be added in the join(res.keyCommands,{}) block):

{down = 3003, value_down = .211434, cockpit_device_id = 47, name = _('Sight Limb Knob Index'), category = _('PKV')},

This lets you return the PKV elevation to the red index mark corresponding to the weapon boresight. Very useful when making close range follow-up shots in an attack run, or just as a default setting. You may notice that the arrows don't line up perfectly when using the command, but just trust me on the accuracy of that number ;)

 

Okay, for anyone who's curious, check page 317 of the manual where it says

[TABLE]Elevation knob red index corresponding to (mils)|52.4[/TABLE]

Divide 0.807 by 200 (adjustment limit in mils) to get 0.004035 (one mil), then multiply by 52.4 to get 0.211434, the exact value of the index mark. You can use the same method to add commands for other commonly-used elevation settings.

 

And I'm not sure exactly what you mean by 'rotary' commands. Like a button you can push repeatedly to cycle through all the switch positions?

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...