Jump to content
The simFlight Network Forums

Rotary switch example with keyboard keys??


Recommended Posts

I have problems with the syntax using FSUIPC4 for a rotaryswitch (Nav1 radio) with the Keyboard keys C and D (67 and 68) and the comands 65640 65641. Is there somebody with a example for my

Erwhy are you messing with keyboard keys and FS control numbers? Can you not simply assign the effective button presses your switch produces in FSUIPC's "button and switches" tab to the relevant Fs controls, using their name? How are keyboard C and D keys involved in any case? You need to explain yourself a little more, I think.

Regards

Pete

Link to comment
Share on other sites

Thanks for your answere Pete. At the moment i use a keyboardemulator (hacked keyboard) for bilding a panel and not a joystickinterface so its not prossible to use "Buttons and Switches" (I think)

No, use the "Keys" tab, then. But why are you talking about FS control numbers? What is wrong with simply assigning the keypresses to the named controls in the Keys tab drop-down? I don't understand why you are playing with numbers and asking for syntax.

Regards

Pete

Link to comment
Share on other sites

Thanks again for your answere Pete. I'm very sorry when i'm not clear enough. My problem is how to use "Keys" for conditional programming. i give you an example.

For joystick buttons 1 and 2 connected to a rotary switch:

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

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

How can i do the same with keyboard keys. Is this possible and what is the syntax of such line.

Link to comment
Share on other sites

Thanks again for your answere Pete. I'm very sorry when i'm not clear enough. My problem is how to use "Keys" for conditional programming. i give you an example.

For joystick buttons 1 and 2 connected to a rotary switch:

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

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

How can i do the same with keyboard keys. Is this possible and what is the syntax of such line.

No, sorry, there are no similar facilities for keys. In fact I don't understand why you'd need them. Perhaps you could explain what you are trying to do and why? I may be able to see another way?

If you really need to use button-oriented facilities, you can program the keys to toggle or set or clear one or more of FSUIPC's "virtual buttons". 288 of these are available starting at offset 3340, with 8 in each byte from 3340 to 3363 inclusive. There are added FSUIPC controls in the Keys assignment dropdown for manipulating these:

Offset byte setbit

Offset byte clearbit

Offset byte togglebit

The offset would be, say, 3340, and the parameter 1 for joystick 64 button 0, 2 for joystick 64 button 1 and so on.

Having assigned the keys in such a way you'd need to edit the INI file according to the button programming syntax you mention. You wouldn't be able to program them in the Buttons tab of FSUIPC because it isn't scanning and interpreting keys whilst in the Options dialogue. Keys then belong to Windows.

Note that, in FSUIPC4, and upcoming for FSUIPC3 (I'm testing at present), there are new Lua programming facilities available, giving much more power for additions via programmed plug-ins to FSUIPC. Currently documentation and examples for these are provided only in the "FSX Downloads" Announcement above, but I'll release it in the "Other Downloads" too as soon as I've finished testing it on FS9.

Regards

Pete

Link to comment
Share on other sites

Here is what i'm trying to do. Using a double action rotary switch for increase and decrease the nav1 radio freg. using keyboard keys and a keyboard emulator.I understand that i'm trying to do something not normal for the program. The part in your manual about programming "Buttons and Keys" is rather clear for my so i think the best way to do is changing the hardware when working with rotary switches e.d.

Thanks,

Rene

Link to comment
Share on other sites

Here is what i'm trying to do. Using a double action rotary switch for increase and decrease the nav1 radio freg.

I'm not really clear what a "double action rotary switch" is doing, then. The ones I have operate one contact repeatedly when turned one way, and another when turned the other way, so it is easy enough to assign one Keypress to one direction and another Keypress to the other. Then you use the radio frequency INC and DEC controls, as named (not by numbers!) to do the job.

Are your rotaries of the graycode sequenced types, with three or more different contacts indicated, so you have to decode the direction based on the sequence? I've never actually seen one of those, though examples of them programmed as Button inputs are provided in my documents courtesy of users.

Regards

Pete

Link to comment
Share on other sites

Yes Pete, they are of the graycode sequenced type. (2 bits)

Hmmm. you might be able to do it by assigning keys to virtual buttons, then processing those with conditionals, but I think it would turn out less than satisfactory -- everything will be going through too many steps and Windows messaging, slowing it down. You need to be able to turn in fast enough to adjust frequencies in a reasonable time, and I think with keypresses you'll probably have to hesitate between each click. not nice.

I assume that type of rotary must be cheaper, or easier to obtain? Those I have are definitely easier to program.

Regards

Pete

Link to comment
Share on other sites

I try to find rotary switches with separated action but i can't find a supplier for those switches in the Netherlands. In the mean time i have change the hardware for joystick programming. So new changes.. Thanks for all your help and your great work for the FS community. I let you know if i succeed.

Regards,

Rene

Link to comment
Share on other sites

2=CP(F+0,11),0,0,C65640,0 << ERROR 19! Line ignored >>

3=CP(F-0,11),0,0,C65642,0 << ERROR 19! Line ignored >>

What i'm doing wrong Pete

Ah, the comma after the ) shouldn't be there. Sorry. I've just noticed that's a typo (in only two of the examples -- the rest are okay) in the manual. Odd no one has spotted that before!

What you have will be read as

2=CP(F+0,11)0,0,0,C65640,0

and the Error 19 is complaining about the lack of a C before the third 0.

I'll fix the typo in the documentation -- it's been like that for about 9 years now!

If you are referring to the FSUIPC4 version, please also refer to Appendix 1 "Do more with your joystick" which has a lot of examples and no typos that I can see! ;-)

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.