Jump to content

Question from an electronics idiot.


RackMonkey

Recommended Posts

Can somebody explain encoders for me? I'm going to try and build a button box. I have noticed that most on the HOTAS I have are 16 detent. I am wondering what difference the different detent models do. 

In particular, think of the heading bug on the F16. With the encoder on my Virpil throttle (16 detent) the bug moves vary slowly. Can increasing the number of detents speed up the movement of the bug? Is there another electronic device that I can use to get the results I'm looking for?

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

There's a decent explanation here:

He doesn't mention, though, that the number of pulses the encoder puts out for every detent varies by device.
How it's read will also determine how the game responds.
e.g. with the code in that video, I get 2 steps per detent with my test encoder.  BUT, with exactly the same encoder and Arduino, DCS-BIOS reads it as 4 steps per detent.

Link to comment
Share on other sites

Thanks, I've watched that several times but it still doesn't answer the base question. Will a 32 detent encoder move the course knob at almost a 1 to 1 ratio. Right now one rotation of the encoder only gives you about a 10 degree change on the HSI. 

Of course since it seems all HOTAS manufactures seem to use 16 detent encoders the Dev's could give you a more realistic ratio via the software.

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

How are you intending to connect it to DCS?

If you use DCS-BIOS you can alter the step size on things like the HSI bugs. But that would require some Arduino programming.

If you use a HID like a Leo Bodnar card, your resolution options are more limited.

Link to comment
Share on other sites

It's a Bodnar card. I know my options are limited. That's why I'm checking on the encoder. There are other things that a faster encoder would help with also. I'm also to lazy to learn DCS-BIOS and Arduino programming.

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

OK, so your options are limited.

IIRC, the Bodnar app which you use to set the inputs as encoders can be used to set the steps per detent for each one.

You could try setting that to one where you have a 4-step encoder so that the PC sees 4 pulses per click.

There may be an app that can "intercept" button inputs and add a few pulses.

Link to comment
Share on other sites

I'd forgotten about that Bodnar had an app for their boards. I'll look at that this afternoon.

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

Another option potentially available to you is with the DCS LUA files - you can adjust the values in the LUA files for the controls to tune how much the knob will move per detent. It does depend on whether the control in question is configured in the LUA to allow different values per input, but most of them do (some older modules lock in to a 1 value for some controls). Ad advantage with this approach is you can tune each control to work well with your encoders, instead of doing a blanket adjustment with your encoders or bodnar board that may not work well across all modules/controls.

Here's an example from the keybinds project, with the radar altimeter knob in the F-14:

{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = -0.005, name = _('Radar Altimeter Knob - DECREASE (Slow)'), category = {_('Instrument Panel'), _('Custom')}},
{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = 0.005, name = _('Radar Altimeter Knob - INCREASE (Slow)'), category = {_('Instrument Panel'), _('Custom')}},
{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = -0.01, name = _('Radar Altimeter Knob - DECREASE'), category = {_('Instrument Panel'), _('Custom')}},
{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = 0.01, name = _('Radar Altimeter Knob - INCREASE'), category = {_('Instrument Panel'), _('Custom')}},
{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = -0.02, name = _('Radar Altimeter Knob - DECREASE (Fast)'), category = {_('Instrument Panel'), _('Custom')}},
{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = 0.02, name = _('Radar Altimeter Knob - INCREASE (Fast)'), category = {_('Instrument Panel'), _('Custom')}},

Notice the slow/fast variations with the different values for value_pressed.. the value controls how much the knob moves per input event. So if you want a knob to move faster for each detent for your encoder, you can adjust the value in the lua to be higher.

Keybinds project has different speeds setup for lots of controls across many modules. If you don't see speed options for the module/controls you're looking to use with your encoders, let me know and I can check into adding them.

https://github.com/Munkwolf/dcs-community-keybinds

Link to comment
Share on other sites

1 hour ago, Munkwolf said:

Another option potentially available to you is with the DCS LUA files - you can adjust the values in the LUA files for the controls to tune how much the knob will move per detent. It does depend on whether the control in question is configured in the LUA to allow different values per input, but most of them do (some older modules lock in to a 1 value for some controls). Ad advantage with this approach is you can tune each control to work well with your encoders, instead of doing a blanket adjustment with your encoders or bodnar board that may not work well across all modules/controls.

The Bodnar software allows choosing 1:1, 1:2, or 1:4 for each individual encoder.  It's not 1 setting for all.
The other points are valid, though.

Link to comment
Share on other sites

34 minutes ago, No1sonuk said:

The Bodnar software allows choosing 1:1, 1:2, or 1:4 for each individual encoder.  It's not 1 setting for all.
The other points are valid, though.

Right on. I was more referring to how each encoder would work across the different DCS modules though. Like you could setup the encoder to be 1:1 for a rotary in the Huey and it be right where you want it with the speed, but then in the F-14 or another module the same rotary could be a different speed which might not work as well.


Edited by Munkwolf
  • Like 1
Link to comment
Share on other sites

Thanks guys. Looks like I have some reading to do to implement this mod. Gives me something to do until the encoders for the button box get here. 

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

Another option potentially available to you is with the DCS LUA files - you can adjust the values in the LUA files for the controls to tune how much the knob will move per detent. It does depend on whether the control in question is configured in the LUA to allow different values per input, but most of them do (some older modules lock in to a 1 value for some controls). Ad advantage with this approach is you can tune each control to work well with your encoders, instead of doing a blanket adjustment with your encoders or bodnar board that may not work well across all modules/controls.
Here's an example from the keybinds project, with the radar altimeter knob in the F-14:
{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = -0.005, name = _('Radar Altimeter Knob - DECREASE (Slow)'), category = {_('Instrument Panel'), _('Custom')}},{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = 0.005, name = _('Radar Altimeter Knob - INCREASE (Slow)'), category = {_('Instrument Panel'), _('Custom')}},{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = -0.01, name = _('Radar Altimeter Knob - DECREASE'), category = {_('Instrument Panel'), _('Custom')}},{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = 0.01, name = _('Radar Altimeter Knob - INCREASE'), category = {_('Instrument Panel'), _('Custom')}},{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = -0.02, name = _('Radar Altimeter Knob - DECREASE (Fast)'), category = {_('Instrument Panel'), _('Custom')}},{cockpit_device_id = devices.RADARALTIMETER, pressed = device_commands.RADARALT_Knob, value_pressed = 0.02, name = _('Radar Altimeter Knob - INCREASE (Fast)'), category = {_('Instrument Panel'), _('Custom')}},

Notice the slow/fast variations with the different values for value_pressed.. the value controls how much the knob moves per input event. So if you want a knob to move faster for each detent for your encoder, you can adjust the value in the lua to be higher.
Keybinds project has different speeds setup for lots of controls across many modules. If you don't see speed options for the module/controls you're looking to use with your encoders, let me know and I can check into adding them.
https://github.com/Munkwolf/dcs-community-keybinds

I do this with the Course and Heading knobs on the F-14 HSD, I have a pushbutton rotary encoder and set up the push button as a modifier to switch between coarse and fine rotation, it works perfectly


Sent from my Samsung Chromebook Plus using Tapatalk

  • Like 1

F-14B, F-16, F-18C, A-10C, F-5E, F-86, FC3, BF-109, FW-190, P-51, Spitfire, UH-1,AJS-37 Viggen, MIG-15, MIG-19, MIG-21, AV-8B Harrier, P-47D

Persian Gulf, Caucuses, NTTR, Normandy, The Channel, Syria

Combined Arms, WWII Assets,Super Carrier

TM Warthog, Virpil VFX,BuddyFox UFC, Saitek Pro Flight quadrant & Switch Panel, Odyssey+ VR, Jet Pad w/ SSA, Voice Attack w/Viacom Pro

GeForce RTX2080TI OC, Intel Core i7-7700K 4.5Ghz, 64GB DDR4, Dedicated 1TB SSD

Link to comment
Share on other sites

@LASooner

That was going to be my next question. You must be clairvoyant. After getting it installed and working I was wondering if it was possible to make the encoder depress a modifier so that in depressed that encoder would be "fast" and not depressed would be slow. This would also come in handy with other knobs that always seem the require you to twist your wrist off to get them to move.\

I just copied the example and god..what a long line of code. I'll try to mod it for the HDG and CRS but also lights, gain and brightness controls along with anything else that has a knob 

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

If your fast and slow modifier values are the same for all your controls, you could reduce the amount of code by using a common piece of code to alter the step size when the button is pressed and connect ALL the button switches in parallel to one input line.

Then pressing any of the control buttons puts them all in coarse (or fine) mode, but you'll only be turning one at a time.

Link to comment
Share on other sites

1 hour ago, RackMonkey said:

@LASooner

That was going to be my next question. You must be clairvoyant. After getting it installed and working I was wondering if it was possible to make the encoder depress a modifier so that in depressed that encoder would be "fast" and not depressed would be slow. This would also come in handy with other knobs that always seem the require you to twist your wrist off to get them to move.\

I just copied the example and god..what a long line of code. I'll try to mod it for the HDG and CRS but also lights, gain and brightness controls along with anything else that has a knob 

Looks like when my post was quoted it combined the lines into 1 - there's 6 lines of code in there. Also, it might be good to use the community keybinds at least as a starting point - it's got different speeds setup for a lot of the knob/rotary controls already. It's up to like 60,000 lines of LUA of additional controls.

https://github.com/Munkwolf/dcs-community-keybinds

Also use Quaggles mod to store your custom keybinds (and as an easy way to use the ones from the keybinds project):

https://github.com/Quaggles/dcs-input-command-injector/

 

 

 

Link to comment
Share on other sites

I'm using the community keybinds and its working great. I'm just waiting for some stuff from Digikey to build my button box. Until then I'm just learning what changing setting do to each item.

What I'm really interested in doing is using the push function of the encoder as a modifier to switch between fast and normal. I want to be able to push and turn to change large heading changes and let it up to make the final few degrees of change.

I'll download you code again. It was daunting to look at and even more so thinking about trying to use it. 


Edited by RackMonkey
  • Like 1

MSI Z490 Tomahawk, I5-11600kf, 2X512GB NvME, RTX4090, 32GB DDR4 3200, Reverb G2, T50-CM2, OpenXR

31st TFW, 14th MAS, 9th ARS

Link to comment
Share on other sites

  • Recently Browsing   0 members

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