gr8guitar

rotary switches and FSUIPC

57 posts in this topic

I would like to think that this topic has come up before but as I searched, I did not find it typing 'rotary switch(es).' I have a rotary switch with a pushbutton. I would like to program the switch to be able to toggle between MHz and KHz and then use the rotary to increase or decrease the frequency as necessary. Has someone written this yet for FSUIPC? Thank you, gr8guitar@netzero.net.

0

Share this post


Link to post
Share on other sites

I would like to think that this topic has come up before but as I searched, I did not find it typing 'rotary switch(es).' I have a rotary switch with a pushbutton. I would like to program the switch to be able to toggle between MHz and KHz and then use the rotary to increase or decrease the frequency as necessary. Has someone written this yet for FSUIPC? Thank you,

I moved your support request to the Support Forum. The FAQ subforum is, like other FAQ's, actually a repository for standard answers, not questions.

Something almost exactly like what you ask was dealt with here quite recently. Have a bit of a search in this, the Support Forum, but don't go back more than a week or two. I'll have a look later for you, but I'm a bit tied up elsewhere at present.

Pete

0

Share this post


Link to post
Share on other sites

Again, thank you for your information, time and FSUIPC. I did read through the entire thread and I still didn't see how the condition between MHz and KHz could be determined (read). I did see that there is allowance for Whole Inc/Dec and Frac Inc/Dec, etc. but that would require 2 rotary switches. But I did not see anything that would indicate that FSUIPC knows that either MHz or KHz was selected from a single pushbutton (momentary on) action. Let me ask you this, is there a way that a pushbutton can be activated and the count of it be stored someway? My thought is this, if I push it once/count 1, say it acts as the keys pressed of: n 1 (selecting MHz), if I press the pushbutton again/count 2 (remembering that it was already pushed once), it acts as key presses: n n 1 (selecting KHz). And then the count gets reset to zero. My next attempt is to get the FSUIPC to work with Excel. I saw the info VB6 and it works! but so far not much luck working in Excel using VBA - will keep at that too.

0

Share this post


Link to post
Share on other sites

Again, thank you for your information, time and FSUIPC. I did read through the entire thread and I still didn't see how the condition between MHz and KHz could be determined (read).

Sorry, you need to explain more. I don't tend to think in terms of Hertz, but just nnn.nn for NAV/COM radios and nnnn.n for ADFs. What exactly are the two "modes" you want to switch between, and why do you want to be able to READ whatever mode is set?

I think you misunderstood my reference to that other thread. It was an example of using a button to swap between different things a rotary might do. Surely that is what you wanted answering? Not some technical thing regarding MHz and KHz?

I did see that there is allowance for Whole Inc/Dec and Frac Inc/Dec, etc. but that would require 2 rotary switches.

Why? I thought you had a button you wanted to use to swtch between two things. Are you confused or is it me?

But I did not see anything that would indicate that FSUIPC knows that either MHz or KHz was selected from a single pushbutton (momentary on) action.

Why should FSUIPC care? You are just toggling between two things. There's nothing to read. The flag will indicate whether the button has been pushed an even or odd number of times.

Let me ask you this, is there a way that a pushbutton can be activated and the count of it be stored someway?

You can count presses in a Lua plug-in if you wish, but what's the point? All you need, surely, is a flag which is set or unset each time you press the button. That's exactly what the referenced thread ended up doing.

My thought is this, if I push it once/count 1, say it acts as the keys pressed of: n 1 (selecting MHz), if I press the pushbutton again/count 2 (remembering that it was already pushed once), it acts as key presses: n n 1 (selecting KHz). And then the count gets reset to zero. My next attempt is to get the FSUIPC to work with Excel. I saw the info VB6 and it works! but so far not much luck working in Excel using VBA - will keep at that too.

Sorry, you've lost me. How does Excel work with FSUIPC, or anything in FS for that matter?

Pete

0

Share this post


Link to post
Share on other sites

oh boy, well here is my understanding: When I press the keyboard: n 1, in FS, it selects the MHz or Whole frequency mode for Nav 1 radio, when I press: n n 1, FS selects the KHz or Fractional frequency mode. For example the frequency of 115.50. As far as keyboard presses go, I type: n 1 and then + or - to change the 115 (which is the MHz = Whole) portion of the frequency and when I press n n 1 and then + or - to change the .50 (which is the KHz = Fractional) portion of the frequency. I have a VRInsight M-Panel and it has a rotary switch with a pushbutton and it functions exactly of what I would like my rotary/pushbutton to function using FSUIPC. As I press its pushbutton, it swaps back and forth between the MHz (Whole) and KHz (Frac) modes and then the rotary part increases or decreases the frequency. Again, not fully understanding FSUIPC's capabilities/programming options yet, I don't see how using a momentary on pushbutton can swap back and forth the Whole and Frac selection. Again, thank you for your information.

0

Share this post


Link to post
Share on other sites

oh boy, well here is my understanding: When I press the keyboard: n 1, in FS, it selects the MHz or Whole frequency mode for Nav 1 radio, when I press: n n 1, FS selects the KHz or Fractional frequency mode

Okay, that's good -- you know the FS controls for those already, then.

I don't see how using a momentary on pushbutton can swap back and forth the Whole and Frac selection.

That's why I pointe you to that other thread. Use the button to toggle a button flag and use the state of that flag as the condition to determine which of the two controls to send. Your need is EXACTLY the same as the one fulfilled there -- only the functions being switched change!

Regards

Pete

0

Share this post


Link to post
Share on other sites

I'm a happy camper - err flyer. I got it to work as needed and thanks. Here is what worked for me:

pushbutton 2,2

rotary switch 0,2/0,3

3=P2,2,K78,8 2,2 turns on the "n" actually depending on speed of presses/hold, toggles between n and nn - so okay *

4=CP(F-2,2)0,2,C65642,0,C1003,514: conditional press on and this checks flag of 2,2 is clear. 0,2 = Nav1 Frac Dec and sets flag of 2,2

5=CU(F-2,2)0,3,C65643,0,C1003,514: conditional press off and this checks flag of 2,2 is clear. 0,3 = Nav1 Frac Inc and sets flag of 2,2

6=CP(F+2,2)0,2,C65640,0,C1004,514: conditional press on and this checks flag of 2,2 is set. 0,2 = Nav1 Whole Dec and clears flag of 2,2

7=CU(F+2,2)0,3,C65641,0,C1004,514: conditional press off and this checks flag of 2,2 is set. 0,3 = Nav1 Whole Inc and clears flag of 2,2

514 = 256 * 2 +2

I noticed the highlighted frequency did not alter but the Whole / Frac freqs changes were indicated and swapped correctly. * Only concerned with Nav1 at this time because I am using 767PIC (was for FS2000) in FS2004. It has an FMC that can automatically control Nav1 & 2 but in Manual mode, only Nav 1 is showing on the Mode Control Panel (MCP).

0

Share this post


Link to post
Share on other sites

I'm a happy camper - err flyer. I got it to work as needed and thanks. Here is what worked for me

Hmmm. Well done, but i can't say I understand that solution. Still as long as it works for you!

Regards

Pete

0

Share this post


Link to post
Share on other sites

LOL, actually, now that I slept on it, I'm not sure why it's working either. I know it won't work for Nav2 at the present time because it requires a toggle of n2 and nn2 where as just typing n (or holding down n) or typing nn quickly (where the pushbutton is assigned "n"), the FS must be assuming Nav1. But I think I'm on the right track to continue. I appreciate your help and of course, FSUIPC, as it has allowed the FS to become more real, even though touch-screen in real aviation is picking up steam (pun intended) as steam gauges disappear. As far as Excel and VBA, that is another topic and will venture there as well.

0

Share this post


Link to post
Share on other sites

LOL, actually, now that I slept on it, I'm not sure why it's working either.

Well here's what I don't understand out of what you are doing:

3=P2,2,K78,8 2,2 turns on the "n" actually depending on speed of presses/hold, toggles between n and nn - so okay *

Why are you sendng 'n's in any case? The INC and DEC controls you are using determine the specific value being changed, you don't have to have focus on them. In fact the relevant gauge need not even be on screen.

All you should need to do with that button it toggle a flag, i.e.

3=P2,2,C1005,3840 ;Using Joy15, flag 0 for tthis, not associated with a real button

Then, all these make no sense ot me at all.

4=CP(F-2,2)0,2,C65642,0,C1003,514: conditional press on and this checks flag of 2,2 is clear. 0,2 = Nav1 Frac Dec and sets flag of 2,2

To start with the excess parameters at the end (C1003,514 etc) are ignored -- there's only one control or keypress assignable to each button in one line. you need multiple lines for multiple assignments. It's only Axes which can have up to 4 assignments in one line.

Then you have a coupe acting on the Press ("P") and a couple on the Release ("U"). Why? Why not all on Press or all on release or on both? What are you trying to achieve by such differences?

I think you either need:

4=CP(F-15,0)0,2,C65642,0 :Nav1 Frac Dec

5=CP(F-15,0)0,3,C65643,0 :Nav1 Frac Inc

6=CP(F+15,0)0,2,C65640,0 ;Nav1 Whole Dec

7=CP(F+15,0)0,3,C65641,0 ;Nav1 Whole Inc

or, for changes on press and release (every click?)

4=CP(F-15,0)0,2,C65642,0 :Nav1 Frac Dec

5=CP(F-15,0)0,3,C65643,0 :Nav1 Frac Inc

6=CP(F+15,0)0,2,C65640,0 ;Nav1 Whole Dec

7=CP(F+15,0)0,3,C65641,0 ;Nav1 Whole Inc

8=CU(F-15,0)0,2,C65642,0 :Nav1 Frac Dec

9=CU(F-15,0)0,3,C65643,0 :Nav1 Frac Inc

10=CU(F+15,0)0,2,C65640,0 ;Nav1 Whole Dec

11=CU(F+15,0)0,3,C65641,0 ;Nav1 Whole Inc

I know it won't work for Nav2 at the present time because it requires a toggle of n2 and nn2

Again the confusion with the keyboard and focus. In the above the FS controls you are using are the NAV1 ones. There are NAV2 ones, and COM1 and COM2 and ADF. You don't need to mess with keypresses and focus.

Regards

Pete

0

Share this post


Link to post
Share on other sites

wow, I don't know other than it made since to me yesterday and it still continues to work today. I tried:

quote:

4=CP(F-15,0)0,2,C65642,0 :Nav1 Frac Dec

5=CP(F-15,0)0,3,C65643,0 :Nav1 Frac Inc

6=CP(F+15,0)0,2,C65640,0 ;Nav1 Whole Dec

7=CP(F+15,0)0,3,C65641,0 ;Nav1 Whole Inc

and this did not work until I change the 5 to CU and the 7 to CU or whatever I wrote above. And I derived that information from page 26 of the FSUIPC manual. Also, If I don't select the "n" then I am not able to toggle back and forth between the Whole and the Frac with the pushbutton, which is the goal and again, it was achieved. As long as the goal was achieved and it seems to be consistant than I am happy. I was just showing you how I was able to get it to work and what I thought was logically happening. As far as the other radios, I'm not concerned with them as I use Saitek's radio panel. Using 767PIC version for FS2000 (in FS2004), I am only concerned with Nav1. In addition, in auto mode or manual mode, I can and do control the Nav's with the FMC. I use Saitek to control the other radios. It was only Nav 1 that is shown on the MCP and I wanted to be able to control it with the rotary switch with the pushbutton. In auto mode, again 767PIC, the FMC updates its INS position from the VOR's and it works great while cruizing but I don't like it to control the Nav1 when I feel the time to set up for an ILS approach so I then switch to manual and enter the freq as needed. So in conclusion, what I showed you, WORKS. Why? Like I said, I thought I understood it logically and made it work but looking back, I'm a bit confused now but won't change what works, and works well.

0

Share this post


Link to post
Share on other sites

wow, I don't know other than it made since to me yesterday and it still continues to work today. I tried:

quote:

4=CP(F-15,0)0,2,C65642,0 :Nav1 Frac Dec

5=CP(F-15,0)0,3,C65643,0 :Nav1 Frac Inc

6=CP(F+15,0)0,2,C65640,0 ;Nav1 Whole Dec

7=CP(F+15,0)0,3,C65641,0 ;Nav1 Whole Inc

and this did not work until I change the 5 to CU and the 7 to CU or whatever I wrote above.

Seems, then, that your rotary sends "button press" when you turn it one way, and "button up" when you turn it the other way. I've never heard of any rotary that does such a thing. All the ones i've ever heard of send alternately button down and button up, a continuous toggling.

In fact unless both directions does sent a button down and button up alternating I don't see how anything can ever recognise another button down or up -- it will look stuck down one way and stuck up the othjer. You need them alternating to detect them.

Sorry, but what you suggest simply doesn't make any sense at all.

Also, If I don't select the "n" then I am not able to toggle back and forth between the Whole and the Frac with the pushbutton

But that button doesn't need to toggle between those selections. All it needs to do is change the Flag which is being tested so that the rotary inputs affect either Whole or Fract parts -- the difference in what is changing in FS does not depend on the "n" or "nn" at all -- the determination whether it is Whole or Fract parts is entirely included in the controls you are making it send. else why do you think there are separate controls for Whole and Fract? If you needed to preselect which part to change, what on Earth do you think is the point of having different controls for the different parts is? It would make a nonsense of the whole thing.

Many implementations using the controls you are using here have been constructed and are in use successfully every day, including in my own cockpit. I feel there is something you are completely misunderstanding, and evidently something else you not telling me.

I'm a bit confused now but won't change what works, and works well.

Okay, I'll leave you to it. It's just overcomplex and illogical, but evidently there are things about your hardware I don't know about.

Bye

Pete

0

Share this post


Link to post
Share on other sites

see now you're just pissing me off. In the previous notes, all I did was say thanks and all I did was offer what worked for someone else to use, nothing more, if they read this forum. I DO need the 'n' to WORK as I stated before using the rotary switch's pushbutton. I am using a single rotary switch to control both the MHz (Integer) and then KHz (Decimal) portions of the frequency and the pushbutton is working to do just that, swap back and forth between the two. Of course it cycles from OFF to ON to OFF to ON etc. It's a digital rotary switch! I only offered of what worked, why, I'm not completey sure, I didn't write the FSUIPC. In addition, I got the idea of using CP and CU from the FSUIPC manual on page 26, and again, that is what worked! I'm going to finish on this subject, I didn't think I would be challenged of why it works, again, I'm not sure, it just does and I thought it might be useful to someone else using a rotary switch with a pushbutton (momentary on) so they don't have to do trial and error if they chose to try it. And again, I do thank you for FSUIPC.

0

Share this post


Link to post
Share on other sites

see now you're just pissing me off.

How do you work that out? All I'm saying is that I don't understand how what you've done works at all, and deduced that this must be because I don't know enough about your setup. How has this angered you so? I don't understand where you are coming from.

But if you are going to react so, I won't bother any more. Bye.

Pete

0

Share this post


Link to post
Share on other sites

Hello, since you're the master, I decided I would insert directly your code

(verbatim) into my FSUIPC.ini and it did not work. And after discovering something, I

found out why. In your code, you mention/use (F-15,0), etc. for flag monitoring but

since you're using a phantom switch, switch 15,0 is never toggled. And that is why I

need 'n' or perhaps just the activation of some pushbutton so that its flag can be

toggled. I must admit, I did not see the significance of that the first time I read

the manual and even worse, I missed it when it was mentioned in the thread. I did not

know that a switch's flag gets toggled with each activation. You were aware of this

but I don't recall it being mentioned in our conversation. So my sincere apologies to

you for missing it - twice! I now see that I don't need to set or clear flags in my

situation. In fact, when I went back over the FSUIPC.ini, FSUIPC had removed them!

And the rotary switch/pushbutton functioned as I desired but only with the 'n"

portion being there as well. So to go beyond 767PIC's unique handling of Nav1, I

decided to see about making Nav 2 work in any aircraft and this is what I came up

with:

0=CP(F-2,0)0,0,C65646,0; Nav 2 Frac Dec

1=CU(F-2,0)0,1,C65647,0; Nav 2 Frac Inc

2=CP(F+2,0)0,0,C65644,0; Nav 2 Whole Dec

3=CU(F+2,0)0,1,C65645,0; Nav 2 Whole Dec

Now that I was aware that just activating a pushbutton should toggle its flag, and

perhaps it does but the above code did not work fully. I could only get the Frac

portion to Inc/Dec but the "Whole" was inoperable even though I was activating pb

2,0. When I added the N2, shown below, then it worked. I could activate the

pushbutton and swap back and forth between the Frac and Whole.

0=H2,0,K78,8

1=H2,0,K50,8

2=CP(F-2,0)0,0,C65646,0; Nav 2 Frac Dec

3=CU(F-2,0)0,1,C65647,0; Nav 2 Frac Inc

4=CP(F+2,0)0,0,C65644,0; Nav 2 Whole Dec

5=CU(F+2,0)0,1,C65645,0; Nav 2 Whole Dec

Again, as mentioned many times before, I do NOT know why - but it works. My only

reasoning is perhaps FS requires a toggle between n and nn. And yes I'm aware I

perhaps don't need the CU but, again, it's working. So hopefully you'll accept my

apologies for missing given information and we can get back to "flying." One more

note, what are people using for hardware to display, say Altitude Select and lights

on, etc?

0

Share this post


Link to post
Share on other sites

In your code, you mention/use (F-15,0), etc. for flag monitoring but since you're using a phantom switch, switch 15,0 is never toggled.

Sounds like you omitted the first line:

3=P2,2,C1005,3840 ;Using Joy15, flag 0 for tthis, not associated with a real button[/CODE]

That toggles 15,0 (15 x 256 + 0 = 3840).when you press your button.

The whole point of using the flag for a non-existent button is precisely to avoid that flag being toggled just because you pressed its button! Things would become somewhat unpredictable if you were toggling or switching the same flag both with the FSUIPC controls for this (1003,1004,1005) and the button itself with its automatic flag toggle action.

Using the automatic toggle would work provided the button action was something innocuous. However, it is cleaner to have the button just toggle a flag independently, for testing in the other lines. The self-toggling of the button's own flag was implemented in order to allow momentary buttons to be programmed like toggle buttons -- i.e. with their own action depending on their own flag, which is toggled for the next press without another button or action being involved.

Now that I was aware that just activating a pushbutton should toggle its flag, and perhaps it does ...

It only does if the button is scanned. If it is not assigned it isn't scanned and therefore its flag won't toggle. That's why I'm using a flag for a different, unused button.

Try using my earlier solution including the line you seem to have missed. It is likely to be far tidier than having to use 'n' keypresses and is much more easily transferred to other applications.

BTW, I'm a little surpised that you didn't follow through on my original pointer to other thread here on a similar subject. If you had you'd have seen my solution to the problem there also involved using button 15,0. here it is again:

The answer, assuming each click on the rotary sends "press" and "release" alternately:

[b]1=P1,0,K119,10

2=CP(F+15,0)1,0,K119,10

3=U1,0,K119,10

4=CP(F+15,0)U1,0,K119,10[/b]

[b]5=P1,1,K114,10

6=CP(F+15,0)P1,1,K114,10

7=U1,1,K114,10

8=CP(F+15,0)U1,1,K114,10[/b]

[b]9=P1,5,C1005,3840[/b]

The answer assuming each click sends both "press" and "release":

[b]1=P1,0,K119,10

2=CP(F+15,0)1,0,K119,10[/b]

[b]3=P1,1,K114,10

4=CP(F+15,0)P1,1,K114,10[/b]

[b]5=P1,5,C1005,3840[/b]

See that line, there at the end, toggling 15,0 on the press of the relevant button in that case? It was because of the direct similarity in needs that i referred you to that thread in the first place.

Regards

Pete

0

Share this post


Link to post
Share on other sites

Okay, wilco. I had decided to make an MCP, wow, I didn't realize what an undertaking, a bit overwhelming in time and scope. I just should have purchased VRInsigbt's MCP - oh well. Again, thanks for your valueable time and information. It is greatly appreciated.

0

Share this post


Link to post
Share on other sites

Just so I got it straight: I really only need 1 rotary switch and the rest pushbuttons to do all that would be required, although not as realistic looking, fully functional, yes? In addition, using c1003, I could "add" or "count" the number of presses based on CP(), yes? And finally, I didn't see any info on output. Do you know what people are using to drive outputs as far as digit displays and lights?

0

Share this post


Link to post
Share on other sites

Just so I got it straight: I really only need 1 rotary switch and the rest pushbuttons to do all that would be required, although not as realistic looking, fully functional, yes? In addition, using c1003, I could "add" or "count" the number of presses based on CP(), yes?

Sorry, I'm a bit lost here, now. I think I've lost the context.

One point, though. Control 1003 is the control to set a button flag, so i don't see how you can "count" with that. Folks who have multiple uses for single buttons or switches tend to use one of the Offset increment controls to change the value of a user offset 9eg x66C0), then use offset conditions in the button assignment definitions.

And finally, I didn't see any info on output. Do you know what people are using to drive outputs as far as digit displays and lights?

It varies enormously. Since the methods of updating disaplys depends completely on the device -- no two are the same -- and the methods of getting information out of FS varies enrmously, often depending on the add-on aircraft in use, there's no single answer.

FSUIPC's Lua plug-in facilities offer facilities to drive Go Flight displays directly, and you can drive VRInsight displays using the COM library. Examples of these are provided. There are no other standard methods. Obviously, for displays, you first need some sort of interface to those displays, and you start from there.

The ony reason the input side of things is relatively standard is because it is specified in the Windows joystick interface. This is a subset of its HID (Human Interface Device) standard which is precisely defined. The rest, the general facilities for handling any device, more or less allow implementers to do it any way they wish.

Regards

Pete

0

Share this post


Link to post
Share on other sites

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

0

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