Jump to content
The simFlight Network Forums

FSUIPC and OBS, HDG BUG etc...

Recommended Posts

I have a encoder with Gray code (binary, 24 pulses per round). My encoder is conected to two buttons on joypad.

For example:

#1 - joy number

2 - button conected to encoder

3 - button conected to encoder

I have read many times: "FSUIPC for Advanced Users", section "COMPOUND BUTTON CONDITIONS" and I could not solve this problem.

Well, I'm probably not the best person to ask because Ive never had a gray-code type encoder to play with. All those I've ever seen have been the easy types, pulsing a connect on one button number one way and another the other way.

I'm try solution like this:



and many other similiar but still not working

Well I don't understand your examples, and expressed like that they are most certainly not valid (there's no such thing as "PC..."), so perhaps the "many times" you've read the relevant section aren't yet enough? The following parts of the Advanced User's guide section you refer to should surely help? Maybe you are continually mis-reading them? You need to follow the format of the parameters rather more carefully than you appear to be doing -- they aren't flexible enough to recognise parameters in any arbitrary format!

Third, you can now program those two-phase type rotary switches, the ones where turning the spindle one way gives pulses on two lines phase shifted one way, and turning the spindle the other way gives the opposite phase relationship.

Say the inputs from the rotary are on Joystick 1, Buttons 1 and 2. When B1 is ON and B2 goes from off to on, then the spindle has turned one way. When B1 in ON and B2 goes from on to off, the spindle has turned the other. That is the simplest example:

1=CP(+1,1)1,2, ... turn direction 1 action

2=CU(+1,1)1,2, ... turn direction 2 action

You can also have double speed action, operating on every off to on and on to off change of B2. Just add two more conditions:

3=CP(–1,1)1,2, ... turn direction 2 action (B2 goes off to on when B1 is off)

4=CU(–1,1)1,2, ... turn direction 1 action (B2 goes on to off when B1 is off).

Since the whole thing is completely symmetric (there is no reason why B1 should control B2, it could also be the other way around), you can actually program it to act on ALL edges of both buttons, by adding another 4 conditions:

5=CP(+1,2)1,1, ... turn direction 2 action (B1 goes off to on when B2 is on)

6=CU(+1,2)1,1, ... turn direction 1 action (B1 goes on to off when B2 is on)

7=CP(–1,2)1,1, ... turn direction 1 action (B1 goes off to on when B2 is off)

8=CU(–1,2)1,1, ... turn direction 2 action (B1 goes on to off when B2 is off)

So, you can effectively choose how many pulses you will get for a given turning rate. As you can see, you can get rates of 1x, 2x or 4x—even 3x if you do one part for only half the changes! Note that for reliability at higher speeds you may need to reduce the PollInterval.



Link to comment
Share on other sites

Per complete round encoder have 24 sequences like this one:





What about the other direction?

Please confirm if this will be correct:

Why ask, why not test instead?

Turning clockwise for ADF frq increase



How can that be right? If both 2 and 3 are pressed, as in the condition, how can the press of 2 or 3 be detected? The program can only detect a change -- a Press is a change from not pressed to pressed, a release is the opposite. You seem to not understand that the "P" in "CP" means "pressed". You also need "U" for released ("Unpressed") -- half your changes are buttons releasing, not pressing. And you can't possibly use both inputs as conditions when you have to detect one of those changing! You need three inputs for that!

Why not simply use the example directly out of the documentation, the part I quoted for you? Logically you can surely work it out from your sequence, 1 0 -> 1 1 -> 0 1 -> 0 0 -> 1 0. Obviously the one which doesn't change must be the condition and the one which does change is the Press or release, thus:

1=CP(+1,2)1,3, 1 0 -> 1 1

2=CU(+1,3)1,2, 1 1 -> 0 1

3=CU(-1,2)1,3, 0 1 -> 0 0

4=CP(-1,3)1,2, 0 0 -> 1 0

That's the whole of that one cycle for one direction. Use the same logic for the other way.

If you now follow the logic for the other way you'll end up with the same 8 entries as was given in the example in the documentation -- please do read the part I actually extracted for you! It is directly applicable!


Link to comment
Share on other sites

I tried these settings:

for ADF inc





for ADF dec





But do not work

I'm not surprised! Can't you see? The second set are identical to the first except for the Control they are sending! So one direction is not represented at all, and the other direction will send both INC and DEC, so cancelling each other out out!

Please apply some thought and logic to the problem. It is not hard. There are obvious 8 combinations altogether of Press/Release, Button 1/2, Other button on/off as the condition (= 2 x 2 x 2 = 8 combinations, all possibilities). If you only use 4 combinations you have it wrong!

You only had to copy the example in the documentation, replacing the button numbers with your own. I don't know why you are making it so difficult when it is provided "on a plate" like that?



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.