Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I have a basic question. I have all my DUs wired to a Pokeys 56U card and I have set up the encoders as such and the rest of the inputs as Digital Inputs in the Pokeys software interface. How do I go about setting all the offsets associated with each encoder and button?

Thanks

Alan

Posted

Never mind I found out that the latest version of WideFS supports devices on client PCs and I managed to reprogram my Pokey card (that is on a client PC) for Joystick buttons and FSUIPC can see them. Now I just have to figure out how to enter the offsets.

Posted

Okay still stuck with this. I have an offset from the software that I am using (JET45) that relates to six simple single contact spring loaded buttons (push for ON and release for OFF) on an MFD. The offset is 73F8 the number is 1 and buttons 1 through 6 have bits 0 through 5 and 1 is for ON and 0 is for OFF. So the questions are:

  1. What offset should I use from the drop down list? I have tried Offset Byte Setbit and Offset Byte Togglebit but they don't seem to work (but I may have incorrect information entered in the Offsets or Parameters box that is causing it not to work).
  2. Should the offset and the bit go in the Offset box -- if so what is the format -- for button #6 should it be x73F85 or x73F8.5?
  3. What is the format for the parameters box? Should I just put 1 for ON or does the bit value go here as well?
  4. Should the second set of fields be used for actions when the switch is turned OFF. I didn't think so as it's not a toggle switch only a momentary push button and the box for repeating the action while the switch is held doesn't seem to apply in this case.

Thanks for any help you can give me.

Alan

Posted

Since Pete is away I can try to clear things up for you, although I've never done this myself...

What offset should I use from the drop down list? I have tried Offset Byte Setbit and Offset Byte Togglebit but they don't seem to work (but I may have incorrect information entered in the Offsets or Parameters box that is causing it not to work).

It's difficult to answer this because these offsets are proprietary and so there's no telling how they work unless you have the product. I suspect that if they are meant for momentary switches as you imply then you need Togglebit. That is, you press the mechanical switch and it goes 'on' (the bit in the offset is set to 1), you press it again and it goes 'off' (the bit is reset to 0).

You have correctly identified that you need the 'byte' variant of the Offset Togglebit because the size of the offset is 1 (although you seem to refer to it as the 'number').

So you should use Offset Byte Togglebit.

Should the offset and the bit go in the Offset box -- if so what is the format -- for button #6 should it be x73F85 or x73F8.5?

Only the offset address goes in the Offset box. To use the Hexadecimal value given in the documentation you must prefix with x.

So enter x73F8

What is the format for the parameters box? Should I just put 1 for ON or does the bit value go here as well

The parameter is always a number but it's use varies depending on what function is chosen. For offset togglebit this number needs to be an integer that tells FSUIPC which bits in the offset location to toggle. The number you need is 2^n where n is the bit number starting at 0 and going to 7. For example if you want to toggle bit 0 you enter 1 because 2^0 is 1. If you want to toggle bit 4 you enter 16 (2^4).

Note that you can toggle more than one bit at a time by adding the values together. E.g. to toggle bit 0 and bit 4 at the same time you enter 17 (16+1).

Should the second set of fields be used for actions when the switch is turned OFF. I didn't think so as it's not a toggle switch only a momentary push button and the box for repeating the action while the switch is held doesn't seem to apply in this case.

I think you're correct - you don't need the release part. However, without knowing anything about the products you are using or the way these offsets work I cannot say for sure. It will be obvious if the offsets work in a different way than we expect in which case post back here and I'll see if I can work out what to do. Any documentation about offset 73F8 from the product manufacturers would be useful.

Paul

Posted

Paul

Thanks for that information. To clarify, if the bits for the buttons #1 through #6 are (per the documents for the offset) 0 through 5 what should I put in the Parameters box for each of those bits as I'm not sure what you mean by "For example if you want to toggle bit 0 you enter 1 because 2^0 is 1"? Sorry but I'm a dummy when it comes to this.

I really hope to get this resolved before Pete comes back as my experience with asking him these kind of questions has not been good as he just says "read the guide" which doesn’t help me.

Thanks

Alan

Posted

I'm not sure what you mean by "For example if you want to toggle bit 0 you enter 1 because 2^0 is 1"? Sorry but I'm a dummy when it comes to this.

Sorry, the ^ means 'raised to the power of' in most programming languages - I forget not everyone is familiar with that way of writing it. So 2 squared is 2^2, 2 cubed is 2^3,

So for your buttons, starting at button 1 (bit 0) you need these values:

(Bit -> Value)

0 -> 1

1 -> 2

2 -> 4

3 -> 8

4 -> 16

5 -> 32

6 -> 64

Pete has written a more detailed explanation of binary and hexadecimal numbers...

http://forum.simflig...nd-hexadecimal/

Paul

Posted

Thanks Paul. I did read that tutorial but it lost me. One more question. Where does the "1" (for ON) go or does the bit together with the Togglebit offset imply that?

Alan

Posted

You don't need anything else. The parameter (bit value) tells FSUIPC which bit to toggle. If the bit is currently 0 (off) it changes it to 1 (on). If it's 1 it changes it to 0. If you were using SetBits then that bit is always set to 1. For clearbits it's always reset to 0.

Paul

Posted

Paul

I messed around with it this morning and by trial and error I got all buttons to be recognized (they say a pig finds and acorn once in a while :mrgreen: ). Anyway here is what I had to put in the Parameter box and I have no idea what it means so maybe you could shed some light on them.

I used Offset Toggle bit in the Actions When Pressed as well as Actions When Released (I had to add the later one as I had to press the buttons twice to get the response).

Button 1 x01

Button 2 x06

Button 3 x04

Button 4 x08

Button 5 x10

Button 6 x20

Thanks

Alan

Posted

Anyway here is what I had to put in the Parameter box and I have no idea what it means so maybe you could shed some light on them.

Well these are just the same numbers I gave you but written in hexadecimal rather than decimal. You can use either, they are exactly the same value.

However your button 2 looks wrong. If we write the values you have in binary you can see that button 2 is toggle bits 1 and 2 at the same time.

Hex -> Decimal -> Binary

Button 1 x01 -> 1 -> 00000001

Button 2 x06 -> 6 -> 00000110

Button 3 x04 -> 4 -> 00000100

Button 4 x08 -> 8 -> 00001000

Button 5 x10 -> 16 -> 00010000

Button 6 x20 -> 32 -> 00100000

Unless pressing button 2 should also affect button 3, I think button 2 should just have 2 or x02 if you prefer that format.

Paul

Posted

I used Offset Toggle bit in the Actions When Pressed as well as Actions When Released (I had to add the later one as I had to press the buttons twice to get the response).

It may be that these bits shouldn't be toggled then. You can try using "Offset Byte SetBit" on the press and "Offset Byte ClearBit" on the release. Use the same parameter values. If this works that would be the more correct way of doing it.

Paul

Posted

Paul

Wouldn’t the Offset Clearbit cancel the action that the Setbit does? For some reason the way I have it works but would like to do it the "right" way -- I just need to try and understand what I'm doing.

Alan

Posted

Paul

Wouldn’t the Offset Clearbit cancel the action that the Setbit does?

Alan

Yes, but that is what you're doing at the moment with your toggles. You have a toggle when pressed (0 gets changed to 1) and another toggle on release (1 gets changed back to 0). Setbit and clearbit do exactly that.

It's possible that using the toggles could get you into a situation where the action is reversed - pressing would change to 0 and release to 1. I don't know how likely it is because I don't know what these buttons are for or how the software on the other end interprets the 0 or 1 in the bits.

It just seems to me that if you need two toggles to make it work the the more logical thing to do would be to set and clear.

Paul

Posted

Thanks Paul. I think in your earlier reply about the bits buttons 2 and 3 seem to be reversed. I guess it depends on how the software they are connected to interprets. if they were in logical order it would be:

Hex -> Decimal -> Binary

Button 1 x01 -> 1 -> 00000001

Button 3 x03 -> 4 -> 00000100

Button 2 x04 -> 6 -> 00000110

Button 4 x08 -> 8 -> 00001000

Button 5 x10 -> 16 -> 00010000

Button 6 x20 -> 32 -> 00100000

That would make more sense. I'll go back and change the offset to set and clear and see if that works.

Alan

Posted

I think in your earlier reply about the bits buttons 2 and 3 seem to be reversed.

No, I was just pointing out that the value you had for button 2 (x06) might be wrong because it was affecting bits 1 and 2 at the same time. I understood from one of your first posts that each button corresponds to one bit, not multiple bits.

Button 2 x06 -> 6 -> 00000110

I wrote the number 6 in binary so you could see it was affecting bits 1 and 2 (where the 1's are in the binary number). If you look at the other binary numbers they only have a single 1 in them because you only want to affect one of the bits in the offset. If you press button 2 do you really want it to be like you pressed button 2 AND 3 together? Maybe you do. I was just questioning if that was correct.

I suggested that instead of x06 it should just be 2 or x02 if you prefer that way of writing it. That way it only affects bit 1 which I suspect is what you really want.

Paul

Posted

Paul

Sorry yes you are correct -- there is only one bit for each button. I did notice as you mentioned that when I press button 2 it activates the function of button 3 momentarily before activating the function of button 2 but pushing button 3 works fine so I need to change button 2 to "2" (or 000010) so that it doesn’t affect button 3. I also need to go back and use the setbit and clrbit functions.

Thanks for your help

Alan

Posted

On a related subject -- any suggestions on how to set up encoders (I have the offsets)? I cannot see any options in FSUIPC for encoders even though I have set up the "joystick" with digital inputs related to the encoders. They are obviously not buttons or switches.

Thanks

Alan

Posted

On a related subject -- any suggestions on how to set up encoders (I have the offsets)? I cannot see any options in FSUIPC for encoders even though I have set up the "joystick" with digital inputs related to the encoders. They are obviously not buttons or switches.

From what I've read on this forum, rotary encoders usually send virtual joystick button presses when the encoder is moved. Usually it's one 'button' for left rotation and one for right. Some have two buttons in each direction, one for when the rotation was slow and one for fast rotation.

If you go into the Buttons tab and move the encoders FSUIPC should pick up the 'button' presses. You can then assign the offsets as you've been doing for your other buttons.

But maybe your encoders don't work like this.

Paul

Posted

Paul

I have been playing with the Key Presses tab in FSUIPC as I had set my two encoder inputs to a keystroke combination (e.g. ALT/SHIFT/1 and ALT/SHIFT/2 for the encoder that changes the approach minimum altitude on my PFD). There is no FSX function from the drop down list but there are quite a few offset options. The only issue is I don't know which one to pick for the encoder function so I can enter the offset that I got from my software manual.

Any ideas?

Alan

BTW I changed the parameter for button #2 to x02 and it worked. I also changed all the offsets to setbit and clrbit.

Posted

The only issue is I don't know which one to pick for the encoder function so I can enter the offset that I got from my software manual.

How you use an offset depends on the offset itself, not what kind of switch or encoder is attached to it. There's no way I can tell you without knowing more about the offset, e.g. how many bytes long it is, what kind of data is stored in there (integer, floating point number, bit mask etc). If you have documentation for the offset post it in here and I'll see if I can work it out.

Paul

Posted

Well the only information I can glean is that I need to increment and decrement (I think that was obvious) and the value is 0-255 and need to add or subtract 1 for each encoder movement.

Now I can try all of the offsets for Inc and Dec as there are only three Sword, Sbyte, and Ubyte. From Pete's user guide for Increments and Decrements I need to add the increment value followed by the maximum value. For trial and error should I start with 255,255 (where there are 255 increments of 1)?

Thanks

Alan

Posted

Well the only information I can glean is that I need to increment and decrement (I think that was obvious) and the value is 0-255 and need to add or subtract 1 for each encoder movement.

Now I can try all of the offsets for Inc and Dec as there are only three Sword, Sbyte, and Ubyte. From Pete's user guide for Increments and Decrements I need to add the increment value followed by the maximum value. For trial and error should I start with 255,255 (where there are 255 increments of 1)?

Thanks

Alan

Well that's enough info. If it's 0-255 then that's one byte unsigned so you need the Ubyte variant. For the increment value it's how much you want to add. In your case it's 1, the max is 255 so you'll need 1,255.

If you have an encoder with 'fast' and 'slow' rotations then you can increment by 1 for the slow and something like 10 for the fast.

Paul

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.