Cockpitbuilders.com

Smart Sim Tech => Support => Topic started by: iwik on April 05, 2011, 12:37:00 AM

Title: Reading switch inputs and assigning functions
Post by: iwik on April 05, 2011, 12:37:00 AM
Hi Tyler,
Module arrived today, 5 days delivery to New Zealand is great.
Module looks well constructed, nice compact wee unit. Soldering quality is very good.
What is easiest way to configure the inputs to activate something in Fsim. I played with the software commands and had successfully activated stuff in Fsim.
i suppose ones needs to get out Visual basic to do some serious stuff. Really just experimenting at the moment.
Keep up the good work, product looks good.
Regards
Les.
P.S The led nearly blinded me, sure lets you know things are alive.

Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 06, 2011, 03:08:50 AM
hey, thanks for the input on the card.

I just got to work, so I will give some thoughts on writing up something for getting started and get something posted.

Thanks,
Tyler
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 06, 2011, 10:00:34 AM
Thanks,
No hurry, know what its like getting things of the ground.
les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 06, 2011, 03:03:07 PM
ok, just to try to get you going...

You will want to use the wizard on the start page to add a new card with the type of R1 and serial number of 1 if you have not done so already.

If you plug the card into your usb, you should notice the icon for the card's tab will have a green flag on it, and the log should say something about the card being connected.  The beta software has a bug where sometimes it thinks it is another card and ignores it, so if the little flag is still red, try another usb port or shutdown and restart the software.  I will have that bug fixed in the next release of the software.

On the input tab you should see inputs 1 - 30, if you want to name them so you know where they are going, you can right click on the name and hit edit.

On the input scripts tab there is a drop down of all 30 of the inputs.  Each input has 2 states, Up and Down.  For most scripts you will probably want to stick with down.  Down gets fired once the button is pushed, or the toggle switch is activated, and Up get fired once the button is released or the toggle switch is switched off.

For an example, lets call our Input #1 "Parking Brakes", now under Input scripts we will see "Input 1 Button Down (Parking Brakes)" and "Input 1 Button Up (Parking Brakes)".  Lets select Button Down.  So when the button is pushed, or the toggle switch is on, i will want to have the parking brakes on, and when the button is up or toggle is off i want the parking brakes off.  So according to page 15 of the offsets manual, 0BC8 is the offset for parking brakes, with a value of 0 for off and 32767 for on.

Sample Code for Parking Brakes, Button Down
Host.SendValue("0BC8", 32767)

Sample Code for Parking Brakes, Button Up
Host.SendValue("0BC8", 0)

So this switch will need to be "on" when the software starts, but that can be reversed just as easily so if the button is pushed the brakes are off, and so on.  Now to test this with an actual switch, take a toggle or push button switch and wire one of the wires to the "Gnd" screw on the board and the other to input #1 on the board.  With flight sim running and FSUIPC open and everything working as it should, that button will now work the parking brakes.

Also, if you leave the software on the Input Configuration mode, the red dot will go green when an input is activated.  good for debugging stuff.  I should also mention that the blue flag icon called "Debug Mode" will make it so the card will not run any of the scripts that send commands to fsuipc, so if you are labeling your inputs, debug mode will prevent your plane from acting weird as you are pushing a bunch of buttons.

Hopefully this will help you get going.  With the example above, just swap out the offset address and value for any of the other offsets.  I will also hopefully add more to the manual tonight and im looking to do some videos with some screen capture software.

Thanks,
Tyler
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 07, 2011, 09:40:54 AM
Thanks Tyler,
I was missing how you tied the inputs to a function. I missed the point that each input has
a little script added.
I like the that idea. Off to work now, will give it a go tonight.
Les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 07, 2011, 01:00:56 PM
Cool, Well let me know how it goes and if you have any other questions.

I'm still working on the manual between my job and Fire Department stuff.  I need more hours in the day :D

Thanks,
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 12:09:43 AM
Hi Tyler,
Making some progress, unable to get a switch to operate on a Fsx panel.
Here is what is happening.
I written the script for Pitot heat and when i operate the nominated switch ther is no response in Fsim.
I can go to input script screen and select input 1 Button Up and press the left green button
and the switch will go up.If i select Button 1 down and press the same button the switch in Fsim will go down. This proves the Script is working and it can be transferred to Fsim.
If i look at the input 1-30 button screen, button 1 will turn green when pressed and if i look at the debug log it shows Input one Going between True for on and False for off.
Can you suggest anything else, or have i got to do anything else to get buttons recognised.
Thanks
Les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 03:25:49 AM
Just a quick thought, did u hit the save button after putting the code in the box.  Im still working on it, but the save button has to be hit before changing to another input from the drop-down list of the code will be lost.
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 11:15:39 AM
Tyler,
Yes have saved it, tried again this morning and still the same. Ive had a look at the debug mode and when i press the green button the debug log says ive sent a command to FSUIPC.
When i opeartea switch from the hardware it justsays true when closed and False when opened.
Hope this helps. By the way i operate Win 7 64 Bit.
No hurry, im still experimenting so have a life outside of Fsim, its not life or death for me.
Regards
Les
P.S i notice when pressing the green button it takes about 2 seconds before the switch operates
in Fsim. Is this normal
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 12:49:33 PM
ok, thank you for the debug info.  There might be a bug in the software.  I am going to setup a card here and check everything over and will let you know what I find.
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 12:56:39 PM
Thanks,
Its Sat morning here,so if you want me try anything for u just let me know.
Les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 01:00:59 PM
Hey, got some good news

I figured out that there is a bug in the software I was able to reproduce the problem that you are experiencing, so I am working on a quick bug fix and will send you a link to download it when I fix the error.  Later tonight i will rebuild the setup file and update it on the website with a news post to go over this bug that was found.  Thank you for helping me in finding this bug.
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 01:12:40 PM
Hi Tyler,
Great news, as soon as you have the fix let us know.
Thanks again.
Les
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 01:46:48 PM
Hi Tyler,
Well done programmed two switches, 1 and 30 all ok.
Just one comment, no criticism, ther is a delay of two seconds between opearting the switch and Fsim reponding. Can this be reduced?.
Thanks again for a simple way of programming switches, and im sure the flexability will be there further down the track.
Les
Title: Re: Reading switch inputs and assigning functions
Post by: Bob Reed on April 08, 2011, 03:04:07 PM
Hi Les. Is the card on the FS computer or in the network? I just tried it on a 32bit Win7  with the card and FS on the same system and there is virtually no delay what so ever.
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 03:06:39 PM
hey,
Thanks for letting me know that you got it working.  I will be releasing the same thing i sent you when i get home later when i can build it into the installer.  Well that is one bug down, many more to go :)

As for the delay.  I am working on a way to shave a little bit off, however I think that some of that delay might be caused in part by FSUIPC if you are using Wide FS over the network.  Bob and I will be doing some tests to try to pin point it all down.

Thank you once again for all your input and help in getting our software going.
Title: Re: Reading switch inputs and assigning functions
Post by: Bob Reed on April 08, 2011, 03:27:49 PM
Quote from: iwik on April 08, 2011, 01:46:48 PM
Hi Tyler,
Well done programmed two switches, 1 and 30 all ok.
Just one comment, no criticism, ther is a delay of two seconds between opearting the switch and Fsim reponding. Can this be reduced?.
Thanks again for a simple way of programming switches, and im sure the flexability will be there further down the track.
Les

Ok Less. I just ran a test. 64 bit win7 FS9 the client Win7 64 bit running wideclient and the SmartSimtech control panel. We are seeing no delay. Please give us your setup.
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 03:47:32 PM
Hi Bob,
Running Win 7 64 bit  fsx fsuipc 4 and SmartSim Tech Control panel all on same pc.
Les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 03:49:13 PM
Hey, what are the specs of your computer? Processor and Ram?
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 03:51:17 PM
Also,
We are setting up FSX with WideFS to test it with FSX.  All our testing has been done with FS9
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 03:59:45 PM
i created a youtube video of our setup if you wanted to see that...
http://www.youtube.com/watch?v=Ag494UV7Nhs

Thanks,
Tyler
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 04:03:20 PM
specs
Intel® P9700 45nm "Montevina" Core™2 Duo 2.8GHz w/6MB L2 On-die cache - 1066MHz FSB 25 watt with 4gb Ram
les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 04:06:14 PM
Hey Les,
Sounds like your computer is fine, just wanted to make sure you had enough ram and stuff to rule that out.
I found my FSUIPC4 key, so we are getting FSX all setup to try it with that.  We will let you know our results here shortly.

Thanks,
Tyler
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 04:20:06 PM
thanks
les
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 04:46:01 PM
Hi Tyler,
Problem fixed by updating FSUIPC dll to 4.669. i had only 4.60a installed.
A point i have noticed is that if the card is not recognised and fsx is running i am not able to establish contact with the card again even if i reload Simtech Control panel. To regain access to the card i have to exit fsx and reload Simtech Control panel followed by Fsim.
Just a small point i thought you may like to know.
Regads
Les
Title: Re: Reading switch inputs and assigning functions
Post by: Tyler Reed on April 08, 2011, 04:50:35 PM
Hey Les,
Thanks for the update... Im glad to hear that updating fsuipc fixed the delay.

As for the other bug that you mentioned, I am aware that for some reason the card gets "Frozen" and the software ignores it.  It should mention in the debug log that the card is ignored if this happens again.  If you plug the card into another usb port it will usually fix the problem.  There is something in my code that causes the software to freeze because the card isn't ready when i ask it for some data.  I have been working on it, and that is my next big bug to work out.

It isn't anything wrong with the card, just something else in the software that needs to be debugged.

Thanks,
Tyler
Title: Re: Reading switch inputs and assigning functions
Post by: iwik on April 08, 2011, 04:56:17 PM
Thanks,
no problems, you deserve some rest. well done.
Les