Jump to content
The simFlight Network Forums

Programming of the Saitek Pro Flight Panels with FSUIPC and LUA


funkyp

Recommended Posts

The Saitek Pro Flight Switch, Radio and Multi Panels can be accessed directly from FSUIPC and with the lua com library. Start with the HidDemo.lua and open the HID interface to the panels just as with a joystick. Vendor and product names can be retrieved with HIDScanner. Note that the switch panel has "HOLTEK" as Vendor/Manufacturer.

Switch Panel

For the Switch panel one 32-bit word is retrieved by com.read containing all the switches (incl. the rotary starter button). Adressing the LEDs works by sending a two-by string by com.writefeature(dev, s, wrf). The first byte must be char(0), the second byte contains a char which represents binary numerical representation of the LED-states:

0 b X X R1 R2 R3 G1 G2 G3

X stands for "ignored", R1 is the top, R2 bottom left, R3 bottom right LED, all in red, G1-3 the same in green. I.e. if you want turn on all LEDs in green then the character code is 0b00000111 or 7d (decimal). You can also turn on green and red at the same time by sending 0b00111111 (or 63d) to the feature data.

Multi Panel

It works similar for the Multi-Panel. Again, com.read retrieves all the button states. It has to be noticed that the trim wheel and the rotary button generates only short pulses in two individual bits each, indicating the turn direction. Not to miss relevant events by the proposed polling routine in HidDemo and also not to overload the lua-engine, I recommend to use at the begin of the polling routine this:


while com.test(dev) >= 10*rd do
CurrentData, n = com.read(dev, rd)
End

CurrentData, n = com.read(dev, rd)
...
[/CODE]

This discards effectively all but the last 10 button events and thus will provide enough rotary events to adjust trim and autopilot effectively, without having to much momentum effect after turning the knobs.

Setting the display of the Multi-Panel works similar as with the Switch panel. Now the data string to the panel contains 13 bytes, which might be created like this:

string.char(0, a1,a2,a3,a4,a5,b1,b2,b3,b4,b5,x)

Again the first character must be a zero, then five characters follow for the first display line, and another five characters for the second display line. The last byte seems to be ingored. The displayed digit is the same as the character code. Character codes from 10-13 result in a blank position. In the second line character code 14 results in a "-". If all positions are filled with character code 15, the display is turned off. The display labels are not programmable, instead depend on the position of the mode selector switch (which is also mapped as a set of buttons). Also, when displaying courses, only the last three digits of the first line are shown. However the format of the writ string remains the same (i.e. only a3-a5 are shown on the panel).

[b]Radio Panel[/b]

As with the previous, the rotary, mode selector, and ACT/STBY buttons are mapped to buttons in the HID input section. Addressing the digital displays works similar as with the Multi-Panel by writing a string to the feature data. In this case the string contains 23 characters. As before, the first character code must be 0, then 20 characters follow containing the 5 digits each of the four displays. The last two characters seem to be ignored again:

string.char(0,a1,a2,a3,a4,a5,b1,b2,b3,b4,b5,c1,c2,c3,c4,c5,d1,d2,d3,d4,d5,X,X)

Again the first character code has to be zero, the next five codes show the upper left display, then upper right and so forth.

Character codes are converted to the display as follows:

[CODE]Code Display
0-9 0-9
10-15 <blank>
This repeats in modulo 16 until a character code of 207.

208-217 0.-9. (decimal dot set)
218-223 .
224-239 -
240-248 0-9
250-255 <blank>
[/CODE]

[b]Annunciator Panel[/b]

I don't have it, so I can't test it, but I'd expect it works the same way.

[b]Finally[/b]

Forgive me not to provide all the individual button mappings, I simply verified that it works this way and used the rotaries to dial through all possible codes at the digit positions, for finding out what they do. However, up to now I have now idea, what the effect is in writing other codes than "0" in the first byte (other than that the panel does not seem to accept anything), or in the ignored positions at the end of the string. Furthermore, the Multi-Panel has altogether two features caps, and I have no idea what the "second" means.

Anyway, I know there a number of people interested in programming the Saitek Panels directly and this may help.

  • Upvote 1
Link to comment
Share on other sites

  • 2 years later...

Your topic has helped me a lot !    Thank you for sharing this information.

If I may add another piece...

For the multi panel,
 - string.char(0, a1,a2,a3,a4,a5,b1,b2,b3,b4,b5,x)

The last "x" position represents a byte.  And every bit represents one of the 8 buttons starting with "AP".

If the bit is "on", then the button illuminates  :-)

For example:      

 - string.char(0,10,1, 1, 1, 1,10, 2, 2, 2, 2, 64)

will turn on the APR button.

 

Hope this helps someone.

 

Greetings,

Pilot Gus, aka Staafke
 

  • Upvote 1
Link to comment
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
×
×
  • 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.