Jump to content


Photo

rotary switches and FSUIPC


  • Please log in to reply
56 replies to this topic

#1 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 20 February 2012 - 08:40 PM

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

#2 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 20 February 2012 - 10:10 PM

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

#3 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 04:15 PM

Okay, thanks for your time and information.
  • 0

#4 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 21 February 2012 - 04:27 PM

Okay, thanks for your time and information.


I just had a quck look for the previous thread with a similar question, and it isn't far down. Check this thread:

Double condition facility rotary knob with push button

Regards
Pete
  • 0

#5 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 04:32 PM

wilco, thx!
  • 0

#6 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 05:12 PM

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

#7 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 05:16 PM

oops! n 1 (MHz)and nn1 (KHz).....
  • 0

#8 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 21 February 2012 - 05:40 PM

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

#9 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 06:42 PM

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

#10 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 21 February 2012 - 06:55 PM

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

#11 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 07:01 PM

okay, much appreciation, will continue....
  • 0

#12 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 21 February 2012 - 10:16 PM

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

#13 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 22 February 2012 - 12:23 AM

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

#14 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 22 February 2012 - 03:21 PM

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

#15 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 22 February 2012 - 03:44 PM

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

#16 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 22 February 2012 - 06:24 PM

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

#17 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 22 February 2012 - 07:21 PM

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

#18 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 22 February 2012 - 11:52 PM

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

#19 Pete Dowson

Pete Dowson

    Advanced Member

  • Moderators
  • 27,349 posts
  • LocationNear Stoke-on-Trent, UK

Posted 23 February 2012 - 12:29 AM

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

#20 gr8guitar

gr8guitar

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • Locationusa

Posted 23 February 2012 - 06:48 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users


About simFlight - simflight.com - simflight.de - simflight.fr - simflight.nl - simflight.pt - simflight.es - simflight.it - simflight.jp - simrussia.com - simMarket