Jump to content
The simFlight Network Forums

Rotary encoder speed


Recommended Posts

Hi all 

I have  rotary encoders for hsi ,vor and adf but  they require quite a few turns to move. The altimeter instrument  moves a lot faster with less turns than the other 3. 

I am using FSUIPC4 with FSX se and Rotary Encoder CTS288 for Leo Bodnar.  How can I speed  them up 

 

Cheers 

 

Rhys 

Link to comment
Share on other sites

How have you assigned them? 

If your rotary has two buttons in each direction, you can assign the "slow" button to the standard controls and the "fast" button to the fast controls., If your rotaries only have one button in each direction, you can simulate fast/slow buttons by using the provided Rotaries.lua script (in the lua examples under your FSUIPC4 documents folder).

For the ADF:

Quote

1046 Adf1 use whole inc
1047 Adf1 use whole dec
1048 Adf1 use frac inc
1049 Adf1 use frac dec
1050 Adf2 use whole inc
1051 Adf2 use whole dec
1052 Adf2 use frac inc
1053 Adf2 use frac dec

and you would assign the "slow" button to the frac controls, and the "fast" button to the whole controls. Alternatively, 

For the VOR OBI, specific "fast" controls are provided:

Quote

1026 Vor1 Obi Dec Fast (–10)
1027 Vor1 Obi Inc Fast (+10)
1028 Vor2 Obi Dec Fast (–10)
1029 Vor2 Obi Inc Fast (+10)

Faster control can also be achieved by:
1. Using an offset: if there is a writeable offset that holds the value you are trying to adjust, you can assign to the appropriate offset inc/dec function with a user defined delta.
2. By overloading your assignments, i.e. you can have the control sent 2 or more times for the "fast" button by duplicating the assignment line (making sure that the index number to the assignments are unique).

Link to comment
Share on other sites

Hi John

Thanks for the reply. My encoders are single non detent and are set up right turn increase and left turn decrease. The fast increase is two fast and skips the 10s. I cant get the lua to work I cant find   Rotaries.lua script in the modules folder I have lua.Rotaries which appears in the  fsuipc drop down window 

Regards 

 

Rhys 

Link to comment
Share on other sites

8 hours ago, Reco said:

My encoders are single non detent and are set up right turn increase and left turn decrease. The fast increase is two fast and skips the 10s.

Can you show me your FSUIPC4.ini file please.

8 hours ago, Reco said:

I cant get the lua to work I cant find   Rotaries.lua script in the modules folder I have lua.Rotaries which appears in the  fsuipc drop down window 

If the lua file appears in the drop down for assignment, then it is available for use, and must be installed. You would normally have this lua file auto-started - please see the Advanced User guide on how to do this.

You also need to edit the file to specify the joystick (Vendor and Product) and rotary button numbers (Rotaries) that you wish to use it with. So open it in an editor and take a look and make the necessary changes.

John

Link to comment
Share on other sites

Hi John

Here is the ini file. I have opened the Lua file and edited putting in the vendors and product name  and in the brackets have typed in the rotary numbers

Could you take a look at the LUA file to see if I have done it right. The jpeg files shows the Lua Rotaries with the blue highlighted  which I assume is the one I use with the offsets entered

 

   

 

Cheers 

Rhys 

 

 

FSUIPC4.logRotaries.luaimage.jpeg.1d9642fff7ee9482a3eb3c05d4191f0c.jpeg

Link to comment
Share on other sites

5 hours ago, Reco said:

Could you take a look at the LUA file to see if I have done it right.

The Vendor and Product look wrong - from your log file:

Quote

      125    Vendor=1DD2, Product=22A0 (Version 2.39)

If the lua cannot connect to your device, once started, you should see this message logged:
    Could not open HID

6 hours ago, Reco said:

The jpeg files shows the Lua Rotaries with the blue highlighted  which I assume is the one I use with the offsets entered

Not sure what this means... This lua should really be auto-started, not assigned to start on a button press. See the Advanced User guide on how to do this.

Please show me/attach your FSUIPC4.log file if you want help with your assignments.

Link to comment
Share on other sites

5 hours ago, Reco said:

Here you go I hope this is what you are after

No, that is the log file that you have already posted once, The FSUIPC4.ini file is in the same folder. If you cannot see the extension names, you have windows explorer set to hide the extensions of known file types, and need to change your explorer settings to see the file.

Did you get the Rotaries.lua working?

John

Link to comment
Share on other sites

3 hours ago, Reco said:

s what you are after.

No. I do not understand what is so difficult - if you want help, show me/attach your FSUIPC4.ini file, and not your FSUIPC4.log file which you have now attached 3 times. 

Also, please do not start a new log file when posting log files for support.

3 hours ago, Reco said:

I have the Rotaries.Lau file in the modules folder and edited the vender ID and product name  

But do you have this lua script running? You would normally have this script started by the [Auto] section of your FSUIPC4.ini file (which you don't seem to be able to find...).
Please see the Advanced user guide on how to automatically start lua plugins.

John

  • Like 1
Link to comment
Share on other sites

Ok, your ini file shows the Rotaries.lua is recognised but you do not have it running. You should add the following to get this lua auto-started:

[Auto]
1=Lua Rotaries

Once this is running, this will enable "virtual buttons", converting the single button, in each direction, of the rotaries to a slow and fast button. You should remove (delete or clear) your assignments to the original buttons, and assign to the fast/slow virtual buttons. You should use the IgnoreThese ini parameter in your [Buttons] section so that the physical button press is not registered, only the virtual ones.

Also, looking at the rotaries script you attached:

Quote

Rotaries = { 21,20,29,28,25,24,27,28

This cannot be correct - you cannot have button 28 paired with both 29 and 27..... Remember, each pair of entries corresponds to the two buttons, one in each direction, of one rotary encoder.

Link to comment
Share on other sites

  • 2 weeks later...

Hi John

Thank you for that 

I corrected the rotaries script the last entry should have been 26.  In the ini file in what section should I put the  lua auto-started, and with the  IgnoreThese does that entry go directly under the [Buttons] heading 

When I reassign the rotary encoders again do I still need to put in the corresponding  parameter 

 

Cheers 

 

Rhys 

Link to comment
Share on other sites

6 hours ago, Reco said:

In the ini file in what section should I put the  lua auto-started,

It is its own section - [Auto]. It can go anywhere - but not embedded in another section (obviously I hope!).

6 hours ago, Reco said:

with the  IgnoreThese does that entry go directly under the [Buttons] heading 

Yes - please see the Advanced User guide, page 16.

6 hours ago, Reco said:

When I reassign the rotary encoders again do I still need to put in the corresponding  parameter 

Yes - assigning to a virtual flag//button is the same as assigning to a real button,  you have to specify the control and the parameter (if needed) and you can assign to both the  press and release (again, if needed).

John

Link to comment
Share on other sites

Hi John

Thanks for all your help. I have uploaded my ini file with the changes, If you could have a look to see if my entries for Ingnorthese looks correct the auto script is the last entry

Is there a parameter for the heading bug

Thanks once again for your time and help 

 

Regards 

 

Rhys 

FSUIPC4.ini

Link to comment
Share on other sites

Do you have an actual issue? If things are working as expected, then there is no point in me looking at your file. If you have an issue, then explain what that issue is and then I may take a look at your files, id needed. This support request has already gone on quite a long time already, especially as this script for rotaries has been around a long time, is included with each version of FSUIPC, and there are already numerous support requests on using this script.

4 hours ago, Reco said:

Is there a parameter for the heading bug

That depends on which control you are using, as there are several got the heading bug. For example, the heading bug inc/dec controls take no parameter, but the set control does (hopefully that is obvious).

John

Link to comment
Share on other sites

  • 2 weeks later...

John,

I am stuck in trying to implement the rotaries.lua on 2 Leo Bodnar boards with a total of 11 rotary encoders.

I renamed the rotaries.lua script to reflect each of the Bodnar boards (BU0836X-2.lua & ButtonBox.lua; see attached).

I adjusted the Vendor/Product/Rotaries parameters to reflect the specifics of each board (5 encoders with BU0836X-2; 6 encoders with ButtonBox), however, I am uncertain if I have the correct Device number for each board (I also have another BU0836X-1, but it does not have any encoders assigned to it).

The boards show up in both FSUIPC.log and FSUIPC.ini (see attached).

However, I do not see any change in speed when turning the encoders.

When I include IgnoreThese=H.10, H.11, H.12, H.13, H.14, H.15, H.16, H.17, H.18, H.19, J.20, J.21,J.22,J.23,J.24,J.25,J.26,J.27,J.28,J.29.J.30,J.31 under [Buttons], each of the rotary encoders no longer show any interaction under Button & Switch Assignments in FSUIPC and I am unable to reassign the encoders to their respective assignments.

I am at a loss and am trusting you could help me sort this out.

Respectfully,
Dan

FSUIPC7.log FSUIPC7.ini BU0836X-2.lua ButtonBox.lua

Link to comment
Share on other sites

Your lua scripts are not running. You need to have these running, normally started from an [Auto] section - add this to your FSUIPC7.ini:

Quote

[Auto]
1=Lua ButtonBox
2=Lua BU0836X-2

 

15 hours ago, Delta14Sierra said:

however, I am uncertain if I have the correct Device number for each board (I also have another BU0836X-1, but it does not have any encoders assigned to it).

You only need to change the device number if you have multiple devices with the same Vendor and Product ids. As your product ids are unique, you do not need to change these, leave them as (or put them back to) 0.

Note also that you have assignments to missing  devices:

Quote

E=<< MISSING JOYSTICK >> << MISSING JOYSTICK >>
F=<< MISSING JOYSTICK >> << MISSING JOYSTICK >>

This is usually caused by a GUID change for the device. To correct this, you should review all your assignments to these device letters (E and F) and either remove them or update the letter to the now correct device letter, id you can determine what that should be.

John

Link to comment
Share on other sites

John,

Thank you so much for your prompt reply and direction.

I have added the [Auto] section along with Lua entries and corrected the <MISSING JOYSTICK> entries/associations in FSUIPC.ini. I have also tried using both 0 and 1 for the Device number of each board in their respective Lua scripts.

However, I still do not get the intended outcome with the rotaries. Furthermore, when I add the IgnoreThese entry under [Buttons], I get no response at all from the rotaries in Buttons & Switches Assignments.

Observation: While troubleshooting, I noticed that although one of my encoders is wired on the ButtonBox board to B21 and B22, yet it shows up in FSUIPC as J.20 and J.21. The same pattern applies to the rest of my encoders. Is this because FSUIPC starts numbering with 0 rather than 1, or could this be part of my issue?

Using the Bodnar Encoder Configuration application, I have set up the connected encoders as 1:2 with a 56ms Pulse Width.

Any further insight would be most appreciated.

Link to comment
Share on other sites

1 hour ago, Delta14Sierra said:

Observation: While troubleshooting, I noticed that although one of my encoders is wired on the ButtonBox board to B21 and B22, yet it shows up in FSUIPC as J.20 and J.21. The same pattern applies to the rest of my encoders. Is this because FSUIPC starts numbering with 0 rather than 1, or could this be part of my issue?

Yes, FSUIPC numbers buttons starting from 0, not 1. As long as you are using the correct numbers in the Rotaries array, it shouldn't matter.

Are your lua scripts running? If so, are they opening your devices correctly? If not, you should see this logged: Could not open HID

Try with one lua script running first, for one card, and get this working before you correct and start the 2nd lua for the 2nd card.

First make sure the script is running and is opening your HID device. Once you have confirmed that, you can then use additional logging (Lua Plugins) if it still isn't working.

Note also that, in the 2nd script, you need to change this:
    offset = 0x3340
as you need to use unique offsets in each script. Try changing to 0x3350 in the 2nd script.

Also your Vendor/Product specification is not correct (so the device could not be opened, and the message 'Could not open HID' would have been logged)t:

Quote

Vendor = "1DD2" -- Leo Bodnar
Product = "2202" -- BU0836X Interface 2, Version 1.39

If using the hexadecimal VID/PID values, specify as:
    Vendor = 0x1DD2 -- Leo Bodnar
    Product = 0x2202 -- BU0836X Interface 2, Version 1.39
Otherwise use the strings:
    Vendor = "Leo Bodnar" -- Leo Bodnar
    Product = "BU0836X Interface 2" -- BU0836X Interface 2, Version 1.39

Can you also try checking your logs before posting - logging and the log file are your friends - use them.

John

Link to comment
Share on other sites

John,

I made the offset change to the second script and tried the various VID/PID values. I ran each script separately.

I do not find the message "Could Not Open HID" (I assume it would appear in the INI file), nor does Logging Lua Plugins or Logging Lua Separately produce any error messages for either of the rotary scripts.

Where do I find the new fast/slow virtual buttons?

Thank you for your patience and kind assistance.
Dan

FSUIPC7.ini

FSUIPC7.log

Link to comment
Share on other sites

Lua scripts are only started once you have an aircraft loaded and ready-to-fly. The log you attached ends after 65 seconds and shows that you were not even connected to MSFS. Please try with an aircraft loaded.

There is also an error in your [Auto] section:

Quote

[Auto]
1=BU0836X-2
2=Lua ButtonBox

Should be:

Quote

[Auto]
1=Lua BU0836X-2
2=Lua ButtonBox

As I said, can you please at least check your logs before posting for support - there is no point in showing me your log files until these lua scripts are running. If you are unsure if they are running or not, add the following to the end each of your ButtonBox.lua script:
    ipc.log("ButtonBox.lua running and waiting for events")
and a similar log line to your BU0836X-2.lua script.  You will then see that line logged when the script is running.
As I said, logging is your friend - please get into the habit of using this to try and solve your own issues.

13 hours ago, Delta14Sierra said:

Where do I find the new fast/slow virtual buttons?

In the button assignment window, so that you can assign to them as you would a normal button However, as these are controlled by the lua script, that needs to be running, which means that you need an aircraft loaded and ready-to-fly.

John  

Link to comment
Share on other sites

John,

Thank you so much for your kind assistance.

I have BU0836X-2.lua working and am focusing on getting it dialed in before I work on ButtonBox.lua.

In FSUIPC.ini, I have added the line: IgnoreThese=H.10, H.11, H.12, H.13, H.14, H.15, H.16, H.17, H.18, H.19

It correlates with the 5 rotary encoders on this board.

However, I am finding it a challenge in Button & Switch Assignments to differentiate between which is fast and which is slow. No matter how fast or slow I turn the rotary, it seems to be finicky as to which button number it provides me for assignment.

Here is what I currently have, but I have also tried flipping the fast and slow button assignments in each rotational direction.

132=P64,17,C1027,0     -{vor1 obi inc fast}-
133=P64,16,C65663,0     -{VOR1_OBI_INC}-
134=P64,15,C65662,0     -{VOR1_OBI_DEC}-
135=P64,14,C1026,0     -{vor1 obi dec fast}-

Either way, I get an inconsistent response between fast and slow movement of the VOR...sometimes fast adjustment when turning slow, and slow adjustment when turning fast.

My assumption is that this has to do with the FastTimeLimit = 60 and Pollrate = 20 settings. I have been trying different values (increasing the FastTimeLimit, and decreasing the Pollrate), but I am struggling to find a sweet spot.

I have been making adjustments to BU0836X-2.lua while in FS2020, but I just am not getting any feel for whether I am adjusting in the right direction.

Any insight as to make this process easier would be most appreciated.

Once again, thank you for bearing with me.

Have a great day!
Dan

Link to comment
Share on other sites

11 hours ago, Delta14Sierra said:

My assumption is that this has to do with the FastTimeLimit = 60 and Pollrate = 20 settings. I have been trying different values (increasing the FastTimeLimit, and decreasing the Pollrate), but I am struggling to find a sweet spot.

I would leave the Pollrate and just increase the FastTimeLimit
The rotary script should work reasonably well - if it isn't, try and understand what the script is doing, and try and work out what is happening.  As I said. logging is your friend - use it. You can also add additional logging statements (using ipc.log) to help you understand what is happening.

If your rotary is a two-phase type rotary switch, thus lua script may not be the best option - see the Advanced User guide om how to handle such rotary types.

Otherwise, try  to see what is happening yourself using the logging facilities provided.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.