Jump to content
The simFlight Network Forums
gr8guitar

rotary switches and FSUIPC

Recommended Posts

well, here was my thought process. I thought if I could find a way to use a rotary switch to select ATC. I.E., rotate the switch to select a "number" and then use its integral pushbutton to select it. Here is what I tried (up to '3") but all but the first line of C1003 was retained after I reopened the FSUIPC.ini:

X=CP(F-15,0)(F-15,1)(F-15,2)0,17,K49,8,C1003,3840 ; CHECK ALL CLEAR / TYPE "1"/ SET 15,0

X+1=CP(F+15,0)(F-15,1)(F-15,2)0,17,K50,8,C1003,3841 ; CHECK 15,0 SET & 15,1 & 15,2 CLEAR / TYPE "2"/ SET 15,1

X+2=CP(F+15,0)(F+15+1)(F-15,2)0,17,k51,8,C1003,3842 ; CHECK 15,0 & 15,1 SET & 15,2 CLEAR / TYPE "3" / SET 15,2

X+3=CP(F+15,0)(F+15,1)(F+15,2)0,16,K50,8,C1004,3840 ; CHECK ALL SET/TYPE "2"/CLEAR 15,0

X+4=CP((F-15,0)(F+15,1)(F+15,2)0,16,K49,8,C1004,3841 ; CHECK 15,0 CLEAR & 15,1 & 15,2 SET / TYPE "1"/ CLEAR 15,1

X+5=CP((F-15,0)(F+15,1)(F+15,2)0,16,K49,8,C1004,3842 ; CHECK 15,0 CLEAR & 15,1 & 15,2 SET / TYPE "1"/ CLEAR 15,2

I assume the lines aren't really numbered X, X+1 etc?

You are still inventing your own syntax for these control lines. There is no facility to send a keypress AND a control. I don't know where you got this idea from -- I already told you it was wrong, way back.

You also have an extra ( in a couple of the lines.

Honestly, I cannot make out what you are doing, or rather trying to do. It makes no sense just like the early examples you posted. I did try to explain at length why they were wrong.

If you want multiple actions on the same buttons you must have multiple lines for each action. There's only one 'result' of each line, not as many as you like. I honestly cannot understand where you got this from, nor why you are persisting with it.

I think you are going to make it far too compicated using multiple flags. What you are trying to do is far easier, for any number of different actions, using offsets and offset conditions. There's an example of a 4-way one in the Advanced User's guide, near the end of the secion on Button programming (the last example before the section listing "ERRORS IN BUTTON PARAMETERS". It begines at the paragraph starting "Finally, ...".

Regards

Pete

Share this post


Link to post
Share on other sites

okay, I finally get i can't send a KEY and CONTROL at the same time. btw: I was able to get what I thought would work. I have 6 pushbuttons and 1 rotary switch. I select, either (for Cessna 172) TAS, Attitude bar, Heading Indicator, Barometer, VOR2 or ADF card and inc or dec as necessary. I think it's obvious I'm not as versed in FSUIPC as you are (...yet :) ) but sometimes I need to just see what's happening or not happening (several times perhaps) to get it and I do greatly appreciate your input. I'll look at that sample and since I got 6 pb and 1 rot to work as predicted <whew>, I think I might be able to go forward. I'm just grateful for the rotary switch option. For so many years, and I mean 4-color FS, and Amiga (and real flying since 1994-Cessna 182D) I hadn't taken that step to program, assemble etc. I waited for Saitek and VRInsight and the like AND STILL WASN'T 100% SATISFIED. I'm now finally at the point where I can be comfortable in what's available for controls although not to the extreme of others. Some are simply amazing but also look restricting. In my home FS though, I can fly the 172, turboprops, to 747 using most controls with little setup. Especially delving into FSUIPC, it has made me very happy to have those rotaries working, thank you, Pete, best regards.

Share this post


Link to post
Share on other sites

okay, I finally get i can't send a KEY and CONTROL at the same time.

No, I didn't say that. You can but they have to be two separate assignments, on two lines.

Regards

Pete

Share this post


Link to post
Share on other sites

No, I didn't say that. - I meant, ... on a single line. My next question, since you led me to it, what does the:

Cx5100 and x00030001, also saw on GF45 example something like x00FF0001, mean? And is there a way to see the values of 66C0, etc. somewhere within the FS (I think this is stretching it but I was interested in seeing the values being incremented/decremented to ensure I was "selecting" the right one)?

Share this post


Link to post
Share on other sites

... what does the:Cx5100 and x00030001, also saw on GF45 example something like x00FF0001, mean?

Not sure quoted out of context like that, but they are related to FSUIPC Offset controls. The encodings for all of the FSUIPC offset controls are detailed in the Advanced User's guide (in the "additional FS controls added by FSUIPC" section). The one starting x51 is listed there as "Offset Byte Cyclic Increment". The parameter of x00030001 would indicate an increment of 1 and a limit of 3.

You can assign to these controls in the normal assignments tab. They are listed by name. If you need the decoding, use the list in the document.

And is there a way to see the values of 66C0, etc. somewhere within the FS

Yes, on the Logging tab, right-hand side. Put the offset in the monitoring list (you can monitor up to 4 places at the same time), select the type of value (eg U8 for unsigned 8-bit value), the select an option below -- display for on-screen in real time, or log, for logging, or both.

These facilities are described in the documentation too.

Regards

Pete

Share this post


Link to post
Share on other sites

Wow, so cool. You sure did a lot of work to make FSUIPC so functional. I wish I had messed with it years ago. I'm way behind the curve but diligently plugging away. Much gratitude.

Share this post


Link to post
Share on other sites

Now using Cx510066C0, x00090001 (and Cx6100CC60) was very useful. With one rotary switch and 5 pushbuttons, I am able to select options for ATC, view, pushback, fuel, and panels. Very handy indeed and clean.

Share this post


Link to post
Share on other sites

Okay, hopefully the last question, is there a way to convert the rotary switches to mouse movements? I've been able to do this using autohotkey (which I had to use for a (I think.. collins, transponder that has realistic on/stby/alt switch, no mouse <rect> or offsets - minor I must admit). The "Ready for Pushback v2 for 747" has a lot of panels, and can't really afford to make THAT realistic but it would be nice to be able to use the rotary switches to move around the panels instead of a mouse.

Share this post


Link to post
Share on other sites

Okay, hopefully the last question, is there a way to convert the rotary switches to mouse movements?

The ability to move the mouse pointer and click the buttons and move the wheel was added to the Lua facilities in a new "mouse" library, just this week. Versions 3.999d and 4.804 include these facilities, and the latest Lua downloadable package includes the documentation for it. See the Download Links subforum.

Mouse operations have never previously been supported by FSUIPC because, really, it is a last resort. Mostly you cannot predict where the mouse should move to unless you always use a fixed 2D cockpit view, or have undocked and fixed gauges. With most folks these days favouring virtual cockpits in which they move around there's no way mouse clicking can be programmed to do anything useful.

Regards

Pete

Share this post


Link to post
Share on other sites

gr8! I timed that well. I have never really been a fan of the virtual cockpit, I don't know why, I know it seems popular but I do like fixed windows and undocked windows (as I use multiple monitors). Again, very happy with the Cx510066C0 etc. option.

Share this post


Link to post
Share on other sites

Okay, I've been searching the forum Internet and looking at the lua examples from the modules folder, and I installed 3.999e, and I did not see a 'mouse.lua,' do I need to do a complete install of 3.999?

Share this post


Link to post
Share on other sites

Okay, I've been searching the forum Internet and looking at the lua examples from the modules folder, and I installed 3.999e, and I did not see a 'mouse.lua,' do I need to do a complete install of 3.999?

There's no "mouse" library example at present, and I wouldn't call it "mouse.lua" but something more explanatory. What i said was that in addition to all the other libraries already supported, there's now a library called "mouse" which provides functions for moving and clicking mice. Please look up the mouse library section in the latest Lua documentation.

Pete

Share this post


Link to post
Share on other sites

Okay, I'm a bit confused: "There's no "mouse" library example at present, ... ... , there's now a library called "mouse" which ..." But in any case, I will re-read the documentation, sometimes it takes a few times before it sinks in, thanks.

Share this post


Link to post
Share on other sites

Okay, I'm a bit confused: "There's no "mouse" library example at present, ... ... , there's now a library called "mouse" which ..." But in any case, I will re-read the documentation, sometimes it takes a few times before it sinks in, thanks.

I like to have practical examples, so when you've solved your needs with appropriate mouse calls in a Lua file, I'll include that in the Lua examples collection, with your permission, of course! ;-)

Regards

Pete

Share this post


Link to post
Share on other sites

Sounds fair enough. Not sure when I'll get to it. Currently I'm using autohotkey for joystick to mouse functions. All of this has been a bit overwhelming with all the hardware work and the learning curve. I've been at it for at least 2 weeks straight but thanks to you, I finally got my MCP and my "aux" panel working perfectly the way I want it to work. Very happy to finally be "flying." Your assistance was amazing. I don't fly FSX but I went ahead and got FSUIPC for it as well.

Share this post


Link to post
Share on other sites

Hello, why didn't this work? (it works with buttons).

[buttons]

1=P2,2,Cx510066C0x00090001

2=P2,3,Cx610066C0,x00090001 = work

[Keys]

1=70,8,Cx510066C0,x00090001

2=71,8,Cx610066C0,x00090001 = didn't work <<error 24 = bad control value>>, i think I understand this one.

When I programmed within FSUIPC, it generated this: 1=70,8,M34:1,0 when I looked at fsuipc.ini so I

didn't use a P initially when I attempted the Cx......

so I tried this:

1=P70,8,Cx510066C0x00090001

2=P71,8,Cx610066C0,x00090001 = didn't work <<error 21 = virtual key not in range 1-255>> This one has me confused

since I'm using 70 (=F). And I tried removing the C since the generated program didn't use CM34:1,0 but M34:1,0 but that didn't work.

also, this didn't work:

1=P70,8,C1003,3840 <<error 21>>

Share this post


Link to post
Share on other sites

Hello, why didn't this work? (it works with buttons).

First, why are you editing the INI file directly instead of using the options dialogue? Or at least try one of them that way so you can see the correct format!

Second, if you do want to proceed by editing the INI directly, it is best to at least refer to the Advanced User's guide to find the correct format. You would then have noticed that whilst the Buttons format needs an explicit C or K to differentiate between those assigned to Keypresses and those to Controls (left and right side of the assignments tab, respectively), assignments to Keypresses need no such differentiation because there is no option to assign a Keypress to a Keypress!

There's really no need to edit these things directly in the INI unless you want multiple assignments to the same Keypress or Button, or, in the case of Buttons, some sort of conditional operation. Even then, do please start from ones programmed in the options dialogue so you get the format right.

Regards

Pete

Share this post


Link to post
Share on other sites

Sorry, Mr. Dowson, I still don't understand. I hope it's obvious that I used the manual. 1) That's how I got the info. about the error messages and 2) On page 27, it states: ... The entries in Buttons or Keys might look like this:

31=P174,10,Cx550166C0,x00030001

32=B66C0=0 P117,6,C1030,0

etc.

Reading that, I would think it would be reasonable to replace the button P174,10 with a key P70,8,......

And yes, I am trying to do multiple tasks. Since my "resources," that being rotary switches, I was trying this. Use one rotary switch to select the value (0-9) and with a button press and a rotary switch, then be able to select the Inc or Dec. I was trying to use keys to test this instead of the rotary switches/buttons as I wasn't near my home computer and had only access to my laptop which is not connect to my hardware. In addition, I did not see the options I need starting on page 27. In the B767 (becoming a real pain at times I'd admit, and this is same for RPB 747v2) there are 5 speed bugs that can be adjusted. So I was trying to select 1-5 using one rotary switch and then hit a pushbutton and be able to Inc or Dec that value with a different rotary switch. I feel confident I can get it to work with the hardware. It would have to be a mouse macro since the speed bugs are not available options that I know. And I can get the keys to work directly with the mouse macros but again, I was trying to set it up just using keypresses to be able to increment/decrement 66C0, instead of buttons since I wasn't at home with the hardware. So I guess what I'm requesting to know is: can keys be used to increment/decrement 66C0's?

Share this post


Link to post
Share on other sites

Sorry, Mr. Dowson, I still don't understand. I hope it's obvious that I used the manual. 1) That's how I got the info. about the error messages and 2) On page 27, it states: ... The entries in Buttons or Keys might look like this:

31=P174,10,Cx550166C0,x00030001

32=B66C0=0 P117,6,C1030,0

etc.

Yes, well, but the example there is from Buttons. In Keys it wouldn't look like that.

The definitions of the formats are given in their appropriate sections. Please refer to the ssection entitled "Keyboard Programming", where you will quickly see the part entitled "Format of Key Definitions". That's your reference, if you really want to do it the hard way instead of using the FSUIPC Options dialogue.

So I guess what I'm requesting to know is: can keys be used to increment/decrement 66C0's?

Yes, of course. And you can program that via the FSUIPC options dialogue. Or don't use the "C" or "K" prefix for key assignments -- this choice doesn't exist for Keys.

Pete

Share this post


Link to post
Share on other sites

Thank you for the info. In my earlier message, I mentioned that I removed the "C" and tried: 2=P71,8,x510066C0,x00090001 but that did not work. I re-read the manual and tried something like this: 4=70,8,1070,2118 and it came back as: 4=70,95,1070,2118 with no errors but then I wasn't sure how to use the 2118 (ugh - using (F+ x,y). You mentioned FSUIPC Options dialogue (page 29). I read this in the manual but I don't see it in the FSUIPC program and mainly, I didn't see it in the manual how it could apply it to the 5 airspeed bugs. These are independent of the main airspeed bug, and works fine with direct key to macro (FSUIPC generated: 4=70,8,M34:1,0).

Hmm....... I don't know how I missed it but I did not realize that offsets were part of the options, never went past my own macros (they start as 767PIC...) or even into the o's. So NOW I know what you mean about the options. Having said that. I opted for offset byte cyclic inc (as stated on page 27) and this did nothing, I then opted for SByte increment (as the logging shows 66C0 as S8) and it DID increment once but not again. In addition, when I input in the parameter 00090001 and confirm, I get 145/1. What does 145/1 mean? FSUIPC generated this:

4=70,8,x310066C0,x00015F91

5=70,8,x410066C0,x00015F91 = didn't work I then manually changed it to:

4=70,8,x510066C0,x00090001

5=70,8,x610066C0,x00090001 = and this worked! Not sure why, when manually before - it didn't.

so finally this works gr8!

8=70,8,x610066C0,x00090001 ; sets the value I want

9=71,8,x510066C0,x00090001 ;same as above

10=B66C0=1 72,8,M49:1,0 ; decrements as required

11=B66C0=1 74,8,M49:2,0 ;increments as required

12=B66C0=2 72,8,M50:1,0 ;etc.

13=B66C0=2 74,8,M50:2,0

etc.

<whew>

Share this post


Link to post
Share on other sites

Thank you for the info. In my earlier message, I mentioned that I removed the "C" and tried: 2=P71,8,x510066C0,x00090001 but that did not work.

Sorry, there's no "P" either. Pleaase do see the Manual for the format. If you'd programmed the keys in the FSUIPC options in the first place you'd not get into all this mess and on-going discussion. This is what i get, using the options:

82=71,8,x510066C0,x00090001

So much easier and more relaible, surely? By all means mess with the INI for complex things but start off with a known base.

I re-read the manual and tried something like this: 4=70,8,1070,2118 and it came back as: 4=70,95,1070,2118 with no errors but then I wasn't sure how to use the 2118 (ugh - using (F+ x,y).

Sorry, what do you mean "how to use the 2118"? What do you want to do here? Surely you approach this the other wasy around. You work out what you want to do THEN find out how to do it, not vice versa!?

If you tell me what you are trying to achieve here, i can help. What's that "F+ x,y" business? 2118 = x0846, and 1070 is it a key press -and release, so this is doing a key press and release of the F key which you are wanting as a result of pressing the F key? Why? It is a very very odd choice of programming! Why not just leave the F key be?

You mentioned FSUIPC Options dialogue (page 29). I read this in the manual but I don't see it in the FSUIPC program

I don't understand you at all. Do you REALLY mean to say you've NEVER gone to the menu and opened the FSUIPC options dialogue? You don't EVERYTHING by editing the INI? Virtually the whole of the User Manual is concerned with using FSUIPC via the options dialogue. It's got loads of pictures showing it. how could you possibly miss all of that?

Hmm....... I don't know how I missed it but I did not realize that offsets were part of the options

All of FSUIPC's add-on controls are listed in the drop downs.

I opted for offset byte cyclic inc (as stated on page 27) and this did nothing

It works fine. I used it and tested it in the first example above.

I then opted for SByte increment (as the logging shows 66C0 as S8) and it DID increment once but not again. In addition, when I input in the parameter 00090001 and confirm, I get 145/1. What does 145/1 mean? FSUIPC generated this

145 = x91. You aren't fopllowing the instructions! Why not please read up on these things before messing about? Please search for and read the boxed section entitled "Offset Increment/Decrement Controls" in the User Guide.

BTW please make sure you are using an up to date version of FSUIPC. Some odd bugs were found a while back in some of the cyclic functions.

Pete

Share this post


Link to post
Share on other sites

well, trying to use 1070, I think it's: key +256*shift code so... 70 + 256*8 = 2118. A bit lost here. It's true, I mostly used the 6xxxxx offsets (list of FS2004 controls.pdf) and started programming. I had no idea that the offsets were available and never saw past my own macros or basic autopilot stuff as that was what I was working on, or as I skimmed through, I never saw the o's. This is the task I'm trying to do, with keys for now: 1) Select a value (using 66C0) then 2) Select an option (using a key) and finally 3) be able to increment/decrement that option. Currently with just with the airspeed bugs it works great as I've indicated in my last message but only part way. I.E.:

1=70,8,x610066C0,x00090001

2=71,8,x510066C0,x00090001

3=B66C0=1 189,8,M49:1,0 ;189 = "-" to decrement airspeed bug 1

4=B66C0=1 187,8,M49:2,0 ;187 = '+=" to increment airspeed bug 1

5=B66C0=2 189,8,M50:1,0 ;airspeed bug 2

6=B66C0=2 187,8,M50:2,0 ;airspeed bug 2

etc.

But say I want to now select EADI, EHSI, EICAS upper or lower brightness but use the same 66C0 value to pick between the four and keys of 189 & 187 to Inc/Dec. I'm trying to see how I can opt for selecting which brightness function I want as well as the airspeed bugs.

Share this post


Link to post
Share on other sites

well, trying to use 1070, I think it's: key +256*shift code so... 70 + 256*8 = 2118. A bit lost here. It's true,

This reply crossed with an amendment to my previous posting, where I worked that out. I said, if you refer,

2118 = x0846, and 1070 is it a key press -and release, so this is doing a key press and release of the F key which you are wanting as a result of pressing the F key? Why? It is a very very odd choice of programming! Why not just leave the F key be?

I mostly used the 6xxxxx offsets (list of FS2004 controls.pdf) and started programming.[/CODE]

Offset addresses only go up to xFFFF, so I assume you mean x6xxx here.

But say I want to now select EADI, EHSI, EICAS upper or lower brightness but use the same 66C0 value to pick between the four and keys of 189 & 187 to Inc/Dec. I'm trying to see how I can opt for selecting which brightness function I want as well as the airspeed bugs.

What's the problem? It isn't as if the 66C0 value changing is going to affect anything else unless you press the key concerned with that other option.

Regards

Pete

Share this post


Link to post
Share on other sites

Yes, the 66C0 is changing beautifully. Right now as I've mentioned before, the airspeed bugs are working great! I can select between airspeed bugs 1-5 and increment/decrement fine with the code up above using only 12 lines of code. I would also like to be able (recall with only 2 rotary switches available- and for testing, using keys for now) use one rotary switch to be able to select values of 66C0, so far working great, and use the other rotary switch to be able to increment/decrement, also working great. But I would like to be able to select using a button (key) for the airspeed bugs1-5( using B66C0=1-5), and then be able to select 1-4 (using B66C0=1-4) for the brightness options with a different button (key for now) keeping the current increment/decrement rotary switch (keys for now). I hope I've explained it correctly. Again, currently for the airspeed bugs, it's working just fine. I'm probably trying to to do too much with too little adding the brightness options.

Share this post


Link to post
Share on other sites

I would also like to be able (recall with only 2 rotary switches available- and for testing, using keys for now) use one rotary switch to be able to select values of 66C0, so far working great, and use the other rotary switch to be able to increment/decrement, also working great. But I would like to be able to select using a button (key) for the airspeed bugs1-5( using B66C0=1-5), and then be able to select 1-4 (using B66C0=1-4) for the brightness options with a different button (key for now) keeping the current increment/decrement rotary switch (keys for now). I hope I've explained it correctly.

Provided you don't mind 66C0 changes possibly affecting the other use, I don't see what the problem is. Why not continue what you are doing? Obviously if you are using the same rotary for two different inc/dec targets you'll need some way of selecting between them. You can't really do that with a keypress in place of the rotary because you'll either need two offset conditions (not supported), or a flag (only suipported for butons, not keys).

Pete

Share this post


Link to post
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

×

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.