Jump to content
The simFlight Network Forums

How to approach controlling LED's in joystick


Recommended Posts

Hi,

So I want to be able to control on the LED's that come with the Honeycomb Bravo throttle quadrant.  This "joystick" has plenty of lights and LED's that should be fully addressable programmatically. I haven't found an interface built for it (nor any other API for that matter). My goal is to be able to use FSUIPC / LUA to control the lights. I'm not sure how or what libraries I need. Would it be even possible to do without library support from Honeycomb? 

Edited by Cool Dan Luke
Link to post
Share on other sites
14 hours ago, Cool Dan Luke said:

So I want to be able to control on the LED's that come with the Honeycomb Bravo throttle quadrant.  This "joystick" has plenty of lights and LED's that should be fully addressable programmatically. I haven't found an interface built for it (nor any other API for that matter). My goal is to be able to use FSUIPC / LUA to control the lights. I'm not sure how or what libraries I need. Would it be even possible to do without library support from Honeycomb? 

It would be possible using the COM and HID facilities in the FSUIPC lua libraries.  But you'd need to do a bit of research.  There are HID facilities to read axes and buttons, but nothing specific for displays of any sort -- as far as I know there's no fixed defined way for dealing with displays.  The LEDs may be encoded in the HID data as "features" in which case they should be controllable via the com.writefeature call.  I'm afraid, however, that you'd either need information supplied by the makers, or do your own investigation using a USB monitoring program whilst running their supplied software to operate the LEDs.

Pete

 

 

Link to post
Share on other sites

Thank you Pete. Following your advice I was able to figure out all the bits corresponding to the lights. I can set the individual lights by calling com.writefeature() and pass in the decimal corresponding to the WORD location of the light I want to activate like this:

com.writefeature(dev, "\0\0\0\0\2" , wrf)  -- parking brake light on

I've mapped all the lights to their individual bit logic and by using the above call I can call them out individually or in sets like this:

com.writefeature(dev, "\0\0\0\0\14" , wrf)  -- door, low volts and parking brake light on

My question now is, what is the recommended method for turning bits on and off in my program? The method used above of expressing the parameter using back slashes seem unorthodox. I tried passing various other combinations to the writefeature function like decimals or hex, or hex strings like this "0XC". Nothing worked except the "\" notation above.

Also, what's the best way to manage the bits on and off? For example, what if I want to turn off the "low volts" light that corresponds to the 3rd bit without affecting the other bits, so I would need to pass a decimal 9, but how to do this using bitwise operators and logic functions like AND and OR?

Thanks for your help Pete, I realize this question is specific to LUA programing and not with FSUIPC, thanks for your patience.

 

Link to post
Share on other sites
13 hours ago, Cool Dan Luke said:

My question now is, what is the recommended method for turning bits on and off in my program? The method used above of expressing the parameter using back slashes seem unorthodox. I tried passing various other combinations to the writefeature function like decimals or hex, or hex strings like this "0XC". Nothing worked except the "\" notation above.

\0 is simply a zero byte, so equivalent to 0x00.  What you are sending with "\0\0\0\0\2" is in fact the value 0x000200000000 including the additional zero at the end of the string. Intel style processors use Lo-Hi order, so the first byte is the least significant.

Your use of a string for this is reasonable and compact, so I wouldn't worry about what method you use.

Well done on the detective work!!

Pete

 

Link to post
Share on other sites
8 hours ago, Cool Dan Luke said:

I've uploaded my scripts to github: https://github.com/danderio/Honeycomb-Bravo-Lua_scripts to share among the community.

Could you post something about it to the User Contributions subforum, please? There it will have a longer life and be more easily found by other users.

Thanks,
Pete

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

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.