PDA

View Full Version : Pushbutton and toggle switch double action?



Drewsta
11-17-2010, 10:13 AM
Hi guys, I have just finished wiring up and interfacing some latching pushbuttons and a few toggle switches.

These are the LED pushbuttons from ebay.
4484

The toggle switch is the standard.

I interfaced them with Leo Bodnars fantastic BUO386X card and I am using leveld 767. The problem I am having is when I press say the beacon pushbutton to the on position, it latches and the beacon comes on. When I press it again to off, it unlatches and the beacon does not turn off. I have to press the pushbutton again to get it to turn off. So basically I have to double push the button everytime I want it to change from on to off. The toggle switches for the taxi lights is exactly the same? Flick it to on and the taxi light comes on , flick it back and the taxi light remains on. I have to flick it forward again to get it to turn off? I feel a little dumb considering this setup is far from ideal. I'm sure there is something silly I am missing, I'm just not sure what?

Any help on this one would be greatly appreciated.
Thanks in advance
Drewsta

tomenglish2000
11-17-2010, 11:06 AM
If this was interfaced using OpenCockpits I would check your script for the switch type you have assigned. As this is BU0386X I dont know how you have that talking to the LevelD, but if there is something similar I would guess that is it. Sorry im not much help.

kiek
11-17-2010, 11:49 AM
Hi,
Since you're building for the Level-D 767, it would be a lot easier for you to use an Opencockpits master card and my free lekseecon program.
Nico

Drewsta
11-17-2010, 05:34 PM
Hi,
Since you're building for the Level-D 767, it would be a lot easier for you to use an Opencockpits master card and my free lekseecon program.
Nico

Hey Nico, I appreciate what your saying and I'm sure it is the best way possible but I don't know much at all about programming. You have around 900 pre defined variables I believe but we still have to write the sioc code right? Its not just a matter of cutting and pasting a few scripts is it? I would love to use the leeksecon program eventually when I have time to learn more about the sioc side of things. For the interim I wanted to use the BUO386x card to see me through.

Thanks mate
Drewsta

AK Mongo
11-17-2010, 06:32 PM
I think you can program the switch to do this through fsuipc. I am waiting on my BUO card to arrive, so I hope this is the case.

wojteku
11-17-2010, 06:34 PM
Correct me if I'm wrong but I think you can asign actions to button ON and button OFF using FSUIPC.
Other solution might be to use a small circuit of relay and capacitor for each toggle so that there is one short signal sent to the board per each flip of a switch rather than having constant on or off signal. I've seen the diagram somewhere but can't recall where at the moment. I'll try to find it and will post it here if I do.

AK Mongo
11-17-2010, 06:55 PM
Here is a link to how desktop aviator was recommending people create a "pulse circuit" for toggle switches.

http://desktopaviator.tripod.com/Articles/USB_Switches/index3.htm

Drewsta
11-17-2010, 07:02 PM
Thanks guys, I was hoping that too, I'm going to check it out today, I'll let you know if I find it.

Drewsta

Drewsta
11-17-2010, 07:08 PM
Here is a link to how desktop aviator was recommending people create a "pulse circuit" for toggle switches.

http://desktopaviator.tripod.com/Articles/USB_Switches/index3.htm

I would have thought the Buo cards are more advanced and don't need all of that anymore. I'm sure there is an easy solution , I just have to find it.

Drewsta

AK Mongo
11-17-2010, 07:20 PM
I think FSUIPC is your best answer, within the buttons and switches tab.

Drewsta
11-17-2010, 10:43 PM
OMG I think im going to keel over and die! I haven't been this depressed with my project ever. Everything has just gone to pieces and nothing is working properly. All I wanted to do was interface some switches and pushbuttons with Leo bodnars buo386x which so many people have done and i just can't seem to do it. I noticed when I connected the buo card it must have automatically assigned all the buttons to something, so I went and deleted the all so I can use a fresh start. I have a fully registered fsuipc and was using that to assign the buttons. I managed to assign the left isolation "Leveld" to the correct button and It seemed to be working well. Then i tried the same with the battery master. I tried mouse trapping it but that wasnt going to help me when assigning the way i needed to. I then choose the "I" key and used that through buttons and switches setting. Well I had it working but not properly. Here's my dilemma now. I pressed shift 5 to bring up the over head to check the battery switch and now the "shift 5" is making the battery go on and off. I tried to press alt to get the menu up and now that too is making the battery go on and off??? Any time i try and use alt key just a long ding ding ding ding ding sound like a button is being pressed all the time and nothing is working anymore. I feel all ive done now is totally mess up my sim and im really scared that ill have to reinstall stuff again...i can't go back that far..not when im this close!

Sorry for the venting, im just soo damn frustrated. Maybe thats why there is open cockpits and Leeksecon right?

Drewsta

Drewsta
11-18-2010, 12:19 AM
Ok an update on my mid life crisis. Rather than continue to carry on like a pork chop, I tried to source the problem. I disconnected the Buo386x card and reconnected it and then restarted the computer. That seemed to stabalise things somewhat. I'm now back to the same problem . The momentary pushbuttons for Cancel/Recall , Engine/Status and Gear etc work just fine. I started with the taxi light next. I assigned it inside the leveld assignments and it works but poorly. Flick the switch lights on, flick the switch back and nothing. Switch it forward again, lights go out, flick it again and sometimes it come back on straight away. So the functions seem unstable. I have tried the fsuipc assignments with and without the little boxes ticked and that seems to do exactly the same thing. The landing lights are also the same.

Im at a loss now, anyone know of the fsuipc setup i should be using?

Drewsta

Nick1150
11-18-2010, 02:38 AM
Hi,

Just did the same for the PMDG 737. I had the same problem, but I found the solution at the end...

Have you tried to put the same offset to both drop down menus of FSUIPC ?

Let me explain.... Let's take as example the TAXI LIGHTS...

Go to FSUIPC, Buttons + Switches tab, then put the cursor in the joy#.
Press the button you wish to assign as TAXI LIGHTS.
On the right you will see a check box, SELECT FOR FS CONTROL, check this one.
Below on the right you have two drop down menus. Choose for both (control sent when button pressed & control sent when button released) the desired offset, which in our case is TOGGLE TAXI LIGHTS (or something like that, I am at work so I do not rememer exactly).
Press OK.
Does it works ?

Do the same for the rest of your switches.

The trick is to choose both drop down menus ;)

Please try it out, I am sure it will work :)

Regards

ian@737ng.co.uk
11-18-2010, 02:39 AM
hi drewsta..............
first, please stay away from sharp objects :o
i'll mail you later when i get back.
rgds

ian

kiek
11-18-2010, 04:02 AM
Hey Nico, I appreciate what your saying and I'm sure it is the best way possible but I don't know much at all about programming. You have around 900 pre defined variables I believe but we still have to write the sioc code right? Its not just a matter of cutting and pasting a few scripts is it? I would love to use the leeksecon program eventually when I have time to learn more about the sioc side of things. For the interim I wanted to use the BUO386x card to see me through.

Thanks mate
Drewsta

Hey Drewsta,

Writing code, yes, but the SIOC code is very very simple, just one-liners (it is more about configuring then programming).

For the beacon for instance you have to write:


Var 925 Static Link IOCARD_SW Device 0 Input ? Type I

(Var 925 is the representation of the (latched) beacon lights (on/off) switch in SIOC, provided by lekseecon)
You only have to change the question mark into the input number you are using for your switch at your Opencockpits Master Card.

Running lekseecon is a piece of cake, just start it, no configuring needed, all automatic!

All the SIOC code for a complete Level-D 767 is available, you only have to copy /paste and adjust the hardware numbers.

So again, my advice is to stay away from the BUO386X card, that's only appropriate for aircrafts that have no SDK and for which you are forced to interface via key strokes or fsuipc offsets. And if you continue using that card you better use my free FSCONV program. It provides a whole new range of FSUIPC offsets particularly for the 767. Then you can switch on the beacon via a FSUIPC offset instead of via a key stroke.

But the combination Lekseecon/Opencockpits/SIOC is clearly the winner (for the 767). Lekseecon also gives you lights tests and (continuous) automatic synchronisation between your hardware switches and the panel switches for free... What other system can do that...?!! ;-)

It's a pity seeing you struggling with 'previous century technology' while there is a wealth of new tools available (for the 767).

regards,
Nico
P.S. here another example: the nose landing switch (http://www.lekseecon.nl/howto767.html#noseland)

Drewsta
11-18-2010, 09:45 PM
Hey Drewsta,

Writing code, yes, but the SIOC code is very very simple, just one-liners (it is more about configuring then programming).

For the beacon for instance you have to write:


Var 925 Static Link IOCARD_SW Device 0 Input ? Type I

(Var 925 is the representation of the (latched) beacon lights (on/off) switch in SIOC, provided by lekseecon)
You only have to change the question mark into the input number you are using for your switch at your Opencockpits Master Card.

Running lekseecon is a piece of cake, just start it, no configuring needed, all automatic!

All the SIOC code for a complete Level-D 767 is available, you only have to copy /paste and adjust the hardware numbers.

So again, my advice is to stay away from the BUO386X card, that's only appropriate for aircrafts that have no SDK and for which you are forced to interface via key strokes or fsuipc offsets. And if you continue using that card you better use my free FSCONV program. It provides a whole new range of FSUIPC offsets particularly for the 767. Then you can switch on the beacon via a FSUIPC offset instead of via a key stroke.

But the combination Lekseecon/Opencockpits/SIOC is clearly the winner (for the 767). Lekseecon also gives you lights tests and (continuous) automatic synchronisation between your hardware switches and the panel switches for free... What other system can do that...?!! ;-)

It's a pity seeing you struggling with 'previous century technology' while there is a wealth of new tools available (for the 767).

regards,
Nico
P.S. here another example: the nose landing switch (http://www.lekseecon.nl/howto767.html#noseland)

Hey Nico, I thought I'd try your fsconv for my pit and see how that works out. The problem is I'm not sure where to go once fsuipc has started. I have loaded your Fsconv and used the configurator to set what I want to operate with 12 cycles selected. Then started fs9 loaded the Leveld767 and started Fsconv. It shows connection then the running icon, so all good there. Next I open fsuipc and go to the buttons and switches tab. I want to try the taxi light first so I flick the switch and it shows me the button number etc. I'm not sure where to go from here mate? I chose the right column and had a look down the list and saw a bunch of offset stuff about halfway down. What am I looking for and which offset numbers am I supposed to use from your pdf manual please? I'm using latching pushbuttons for the overhead (no rotaries at this stage) and Toggle switches for the lights. I'll use momentary buttons for eicas buttons and gear etc.

When looking at your manual I see for example the taxi light offset is 0x8B36, not sure why its RL, I thought it would be "T" for toggle? Where do the bit numbers come in? Not sure where to type those.

I did find this video but its for project magenta.
http://www.youtube.com/watch?v=itv5J0aON8g

Thanks for your time
Drewsta

kiek
11-19-2010, 05:14 AM
Hi Drewsta,

Working with these FSControls, Offset Set Byte, Offset Byte Set Bits and so on (whatever they are exactly called) is part of FSUIPC. FSCONV provides the extra Level-d 767 offsets. Here a link to FSUIPC for dummies (http://www.cockpitbuilders.com/community/index.php?topic=11.0).

The Taxi Light Switch in FSUIPC (provided by FSCONV), is modelled as a Rotary Switch with two positions (which is the same as an on/off switch with two positions, such as your latched button switch). You can set that switch in the ON position by setting bit 1 of offset 0x8B36 to 1 and clearing bit 0 of that same offset. To put the Taxi Light Switch in the OFF position you have to set bit 0 and to clear bit 1. Note that you have to perform these operations without affecting other bits in the same offset, because those other bits control other switches.

The problem is that you cannot do this (set a bit and clear another bit in one go) with FSControls ... You need more advanced (software based) interface systems such as FSBUS or Opencockpits IOCards for that.

With your BU03... and FSControls you can only operate on switches that are modelled as 1 bit or as a byte or word value (still a lot). For instance the beacon (red) light switch can be switched ON via FSControl Offset Byte Set Bits at offset 0x8B34 with param 0x04 and switched OFF via Offset Byte Clr Bits at offset 0x8B34 with param 0x04.

But again, IMHO you better buy an Opencockpits USB expansion card + an Opencockpits Master Card. SIOC software is free, lekseecon is free. With an investment of approx 150 Euro you have a much more powerful (and a lot easier to deal with) SIOC interface. Compared to other investments in hardware for a home cockpit (Yoke, Pedals, Throttle) this is not very much.

Nico

Drewsta
11-19-2010, 06:14 AM
Thanks Nico, i'ts appreciated, I'll order the master card and usb expansion in the near future and start a new overhead as a side project. I'm keen to see how leekseecon really works. I may have to pic your manuals, the forum and your brain alot in the early stages! Just a question, how did you work out the parameter for the beacon? I can't find that in your manual, all I can find is under BIT it has the number 2.

Thanks mate
Drewsta

kiek
11-19-2010, 07:41 AM
You have to understand a little bit of bytes and bits and masks, it is described in the FSUIPC for dummies link of my previous post. But in short, in order to "address/select" bit 2 of a byte you have to apply HEX 04 as mask...

while:
bit 0: mask 0x01
bit 1: mask 0x02
bit 2: mask 0x04
bit 3: mask 0x08
bit 4: mask 0x10
bit 5: mask 0x20
bit 6: mask 0x40
bit 7: mask 0x80

You should read it like this: The FSControl operation "masks" the addressed byte with the parameter. If the mask/parameter is 0x04, only bit 2 is affected. So in a Set control bit 2 will be set to 1 and in a Clr control, bit 2 will be set to 0.

Nico

spitfire9
11-19-2010, 04:01 PM
Sounds to me like the "enable joystick" box is checked on,, in the fs settings ??
You should make sure it is off. Sometimes when FS is started that 'enable joystick " setting turns itself on ?? For some reason. When this happens,, FS automatically assigns certain switches and axis to the joystick . That would screw up your FSUIPC assignments and double some up etc !!

The BU0 card shows up as a joystick but you should turn it off in FS and only go through FSUIPC. Double check every so often that the "enable joystick " option hasn't turned itself on.

Drewsta
11-19-2010, 05:16 PM
Sounds to me like the "enable joystick" box is checked on,, in the fs settings ??
You should make sure it is off. Sometimes when FS is started that 'enable joystick " setting turns itself on ?? For some reason. When this happens,, FS automatically assigns certain switches and axis to the joystick . That would screw up your FSUIPC assignments and double some up etc !!

The BU0 card shows up as a joystick but you should turn it off in FS and only go through FSUIPC. Double check every so often that the "enable joystick " option hasn't turned itself on.

The problem with that is , I use a joystick aswell in my setup as a tiller and use some of those buttons. I have deleted all of the other assignments in FS and saved it. I have Saitek yoke, pedals and 2x throttles, if I disable the joystick, I think i'll just run into more trouble.

Drewsta

spitfire9
11-20-2010, 12:33 PM
I wonder if you can assign your Saitek joystick and everything else through FSUIPC and disable the joystick setting in FS ???
That might work a lot better.

Maybe someone with more knowledge on FSUIPC can add some input.

Drewsta
11-21-2010, 12:59 AM
Hey everybody.....SOLUTION FOUND and it works well too! After hours of playing with fsuipc settings, I could not get the pushbuttons and switches to work with the BUO386X and the Leveld 767 like they should. I knew that most sim builders have no problems in setting thier switches with fsuipc, so I gathered it had to be the interaction with the Leveld 767 itself. So here is what was happening and what I did to fix the problem.

First up I tried setting the switches for the taxi lights. I flicked the switch and the button showed in the fsuipc box as normal. I looked down the right side colums for a command that would suit the taxi light for the LDS767, of course there isn't one! So I created a keypress (very oldstyle I know) and set the switch with the left hand colums in fsuipc etc. When I tried the switch, it did work but never stayed in sync and worked only by double flicking the switch for on and double flicking it again for off, very unrealistic! This was the same for all the led latching pushbuttons too! I played with different settings and ticking different boxes, button to be held etc but couldn't fix the problem. I started thinking that the buttons were not doing thier job properly or maybe I wired them up poorly. I had to disregard that theory because when I looked at the BUO386X in the fs calibration page, it showed all the buttons and switches lighting on and off correctly on the test page. That told me all the switches are doing their job in that respect.

SOLUTION>

I knew through these forums and other sources such as the inspiration that is Ian@737ng.co.uk that using the righthand column in the buttons and switches tab of fsuipc was going to be my best option in solving this problem, so I concentrated there. I was toying with the idea of Nico Kaans awsome fsconv software, although quite outdated its still a great way to interface for some sim pits. That my friends for me was going to be a steep learning curve and perhaps only doable over time. His latest Leekseecon program is the obvious chioce for LDS767 builders as it is a really powerful tool for builders to play with and though it is much easier to use than Fsconv, it will still be a steep learning curve for me but definatley the way to go in the near future, just not right at this point. If your like me, we tend to look for quick fixes and work on the better stuff while we still have a working solution now to play with. So, how am I going to assign a button to a Leveld 767 "fs control" that isn't there? "OMG...just create one ya silly goose I thought!" "Mousetrapping!" I had played with mousetrapping at the very beggining and got myself into all sorts of problems and it all seemed to be getting worse. What I realise now is that in my haste I failed to follow the correct procedure and left out an important step, which in turn was causing the sim to play silly buggers!! Using the mousetrapping technique i was able to create all the Leveld767 "Fscontrols" for the right hand side fsuipc column. Then I had something to assign my buttons and switches to! Now they all work properly and I and one happy camper. Creating a macro if you will is nothing new to simbuilders, just something I overlooked because I got it wrong in the beggining.

For those who don't know what "mousetrapping" is, I could explain it but I'll give you a video link which has everything you need to know.

http://www.youtube.com/watch?v=ccpIHJgoWIo

Thankyou to all who read and replied to this thread, it's always appreciated.

Drewsta

kiek
11-21-2010, 06:26 AM
Hi,
Good to hear you've found a way forward. Congrats! (although creating mouse macro's and assigning those with fsuipc is more complicated imho then writing a single SIOC line of code ;-) )

For the time being this is a solution indeed. Note that, soon the day will come that you want state information from the Level-D to drive leds/digits, ... Then you have to switch to more advanced solutions, such as lekseecon

Nico

ian@737ng.co.uk
11-21-2010, 02:25 PM
hello drewsta......
good man, glad you worked it out mate :o
enjoy what you've done and you just upped your experience level :o
have a great day tomorrow too
rgds

ian