Jump to content
The simFlight Network Forums

Multi-use rotary encoders


Recommended Posts

Hello everyone. I am new the forum and a new user of FSUIPC. I am trying to build a fairly simple interface panel using a BU0836 interface board. What I want to do is use two rotary encoders to control multiple functions while using momentary button presses to select the function. The rotary encoders work fine and I was able to get this to partially work using the default FS control settings, but I think FSUIPC is the only way to get one encoder to control the whole number portion of the frequency and the other the decimal part.

I've shortened my case to using only 3 momentary buttons to save typing space.

Button 1 - Select Com1

Button 2 - Select Nav1

Button 3 - Select Autopilot Altitude

From what I have read, IF I were to use a rotary selector switch, then I would be able to simply use conditional assignments for each encoder. For example, if Encoder 1 turns clockwise AND selector switch is set to Com1, then increase whole frequency by 1. So how do I accomplish this using momentary buttons to select? Is the right approach to use flags? If I press Button 1, then its flag gets set high while the other two get set low. Then I use this flag in the conditional statements. This seems like it would work, but I thought I would ask the more experienced users if I am barking up the right or wrong tree.

Thanks, in advance for your help!!

Link to comment
Share on other sites

From what I have read, IF I were to use a rotary selector switch, then I would be able to simply use conditional assignments for each encoder. For example, if Encoder 1 turns clockwise AND selector switch is set to Com1, then increase whole frequency by 1. So how do I accomplish this using momentary buttons to select? Is the right approach to use flags? If I press Button 1, then its flag gets set high while the other two get set low. Then I use this flag in the conditional statements. This seems like it would work, but I thought I would ask the more experienced users if I am barking up the right or wrong tree.

No, not the wrong tree. It sounds like a plan. There are really only two ways with momentary buttons instead of a selector switch:

1. The way you suggest, using flags. You would need two flags:

Button A:

--- sets flag 1

--- clears flag 2

Button B

--- sets flag 2

--- clears flag 1

Button C

--- clears flag 1

--- clears flag 2

Then the rotary action would

--- condition flag1 set .... do action A

--- condition flag1 set .... do action B

--- condition neither flag1 now flag2 set .... do action C

You could of course use 3 flags, but that's probably more lines than the above.

2. You could have each momentary button write a value to a user offset, like 66C0 (66C0-66FF are freely available).

Use the offset byte set control to write 1, 2 or 3 respectively, and then for the rotary make the condition based on Byte offset 66C0=1, 2 or 3 respectively.

This is probably more efficient, and it is expandable to almost any number of functions.

Regards

Pete

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.