Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Can someone write a LUA script for the Honeycomb Alpha and Bravo products to detect more than 31 buttons? 

I tried to read the instructions for writing a script, but I got confused after the 1st 2 paragraphs lol...

right now, FSUIPC does not detect any buttons past 31 on the Alpha, and does not detect the 7 toggle switches on the Bravo

Thank you in advance

BTW this will be for P3D v4.5

Charli

Posted

Hello,

I was able to use the HidButtons32-39.lua provided in one of the threads to map the buttons above 32 on my Honeycomb Alpha. In doing so I've been able to assign all of the rotatory magneto switch positions using FSUIPC7 in MSFS2020

I have now received my Honeycomb Bravo throttle quadrant and I'm attempting to do the same for it. 

Hidscanner shows the Alpha as:

Vendor = 0x294B
Product = 0x1900

and the Bravo as:

Vendor = 0x294B
Product = 0x1901

I created a second lua file named HidButtonsBravo.lua using the 0x1901 product ID and the FSUIPC7.ini has entries to load both lua files.

When running MSFS2020 and FSUIPC7 the low switches on the Alpha show as Joystick A and the Bravo shows as Joystick D which can also be seen in the FSUICP7.ini Joystick names section. 

The issue I'm having is that when I trigger switches above 32 (or 0-31) FSUIPC7 is seeing them as Joy# 65 for BOTH the Alpha and the Bravo controllers and they are therefore in conflict with each other and manipulating the same functional assignment within the MSFS2020 simulator. 

How can I assign the Bravo to another separate Joystick like Joy# 66 for the higher than 32 switches? I haven't been able to figure this part out? 

In addition I believe the Bravo also has a total of 48 switches and the 32-39 lua file I'm using doesn't seem to detect any Joy# 65 Button inputs when I trigger the higher switches on the Bravo. Can I modify this lua to accommodate up to 48 switch inputs? 

I'm a complete lua noob so some assistance would be appreciated. 

Thanks 

 

Quote

 

 

Posted
3 minutes ago, morrispe said:

The issue I'm having is that when I trigger switches above 32 (or 0-31) FSUIPC7 is seeing them as Joy# 65 for BOTH the Alpha and the Bravo controllers and they are therefore in conflict with each other and manipulating the same functional assignment within the MSFS2020 simulator. 

That, of course, shouldn't happen. Most probably a problem in the lua script. I will look into this, but I'm afraid it will have to wait for the new year now. One question, did you change this line:

Quote

Device = 0  -- Multiple devices of the same name need increasing Device numbers.

If not, try that first.

7 minutes ago, morrispe said:

In addition I believe the Bravo also has a total of 48 switches and the 32-39 lua file I'm using doesn't seem to detect any Joy# 65 Button inputs when I trigger the higher switches on the Bravo. Can I modify this lua to accommodate up to 48 switch inputs?

Yes, the lua can support up to 256 buttons. Maybe take a look at the original lua (HidDemo.lua, in the lua examples zip in your FSUIPC documents folder). If you compare that to 32-39 lua file you are using, you should be able to see what changes I made to restrict to those numbers and then change to handle the button numbers you need.

John

Posted
1 hour ago, John Dowson said:

That, of course, shouldn't happen. Most probably a problem in the lua script. I will look into this, but I'm afraid it will have to wait for the new year now. One question, did you change this line:

If not, try that first.

Yes, the lua can support up to 256 buttons. Maybe take a look at the original lua (HidDemo.lua, in the lua examples zip in your FSUIPC documents folder). If you compare that to 32-39 lua file you are using, you should be able to see what changes I made to restrict to those numbers and then change to handle the button numbers you need.

John

I tried increasing it to "Device = 1" in the Bravo lua file but it doesn't seem to work unless I have it set to zero. With both lua's using Device = 0 and their respective product ID's I'm getting Joy# 65 for both. 

I tested loading the HidDemo.lua as is and inserting Vendor = 0x294B, Product = 0x1901 and that does work for all the buttons on the Bravo however for some reason its showing a 4 - 5 second lag when registering switch inputs. I might try extracting just the button sections as I don't require the axis to see if I can resolve the event registration lag issue. 

Thanks for the responses. P. 

Posted (edited)

I've merged the button code section of the HidDemo LUA into the previously downloaded HidButtons32-39 LUA file and came up with the attached HidButtonsBravoQuad LUA file. when calling both LUA files (for the Alpha and Bravo) from the FSUIPC7.ini FSUIPC7 is now detecting events from all switches on both controllers. The button event detection lag issue I was seeing previously on the Bravo is also gone. 

The only remaining issue is that the above 32 high switches on both devices are seen as Joy# 65 by FSUIPC7. Just need to figure out how to get FSUIPC7 to see each controller as a separate Joy# and I'll be able to assign all the desired MSFS2020 functions to the Bravo switches. 

Making progress.  

HidButtonsBravoQuad.lua

Edited by morrispe
Posted (edited)

Morrispe,

Using the HIDDemo as is for both devices will never work. It is a demo to prove that 256 buttons can be programmed to ONE joystick.
By using the same lua for both the ALPHA & the BRAVO, they will write to the same address space reserved for virtual joysticks. (0x3344 thru 0x3363. The first joystick slot 0x3340, Joy #64, was not used in this lua )
Attached are 2 luas 1 for the ALPHA, 1 for the BRAVO.
ALPHA buttons greater than 32 will be on joystick #64 with 32 additional buttons provided. (0x3340)
BRAVO buttons greater than 32 will be on joystick #65 with 32 additional buttons provided. (0x3344)

Neither of these have been tested at all, can't think of a way to spoof FSUIPC into thinking my only controller (<32 buttons) can also be copied as Joy#64 and/or Joy#65 at the same time. 
Perhaps not enough coffee yet?  ha...
Hope these may help you. ( have high confidence they will work right from the start )

Roman
 

EDIT - found a way to test and there were 2 syntax errors in each, now corrected. Both work as intended. 

 

hidAlphaButtons.lua hidBravoButtons.lua

Edited by spokes2112
Performed tests and corrected luas
  • Like 1
Posted
11 hours ago, morrispe said:

The only remaining issue is that the above 32 high switches on both devices are seen as Joy# 65 by FSUIPC7. Just need to figure out how to get FSUIPC7 to see each controller as a separate Joy# and I'll be able to assign all the desired MSFS2020 functions to the Bravo switches. 

You are probably triggering the same virtual buttons in each script - each DWORD (32 bits) from offset 0x3340 represents one "joystick". So, for a second joystick, start at offset 0x3344.

John

Posted
17 hours ago, morrispe said:

How can I assign the Bravo to another separate Joystick like Joy# 66 for the higher than 32 switches? I haven't been able to figure this part out? 

If you are using renamed and edited copies of the HidDemo.lua, find the line which addresses the virtual buttons. In the original Lua this was:

               ipc.writeUD(0x3340 + ((i-1) * 4), buttons)

This addresses the virtual button offsets 3340 onwards, with 3440-3443 being Joy#64, 3444-3447 being Joy#65, and so on.

So, if your previous plug-in used up Joys #64 and #65, the second plug-in needs to address #66 and following, so change the 0x3340 to 0x3348. If you are already using #66 too, add another 4 -- and so on.

Pete

Oh, I see you just received other replies too.

 

Posted

Pete,

In the demo, i = 2 to begin with, skipping the first 32 buttons picked up by FSUIPC, therefore 
               ipc.writeUD(0x3340 + ((i-1) * 4), buttons["eye"] -- "eye" = i, the forum picks it up as italic formatting 
will yield 0x3344 as the first address used.
No biggy, excellent demo lua! Never looked at it before.. Now what can I do with it here? lol

Roman

Posted
5 minutes ago, spokes2112 said:

In the demo, i = 2 to begin with, skipping the first 32 buttons picked up by FSUIPC, therefore 
               ipc.writeUD(0x3340 + ((i-1) * 4), buttons["eye"])  
will yield 0x3344 as the first address used.

Hmm. Odd. I wonder why I did that?

Pete

 

Posted
8 minutes ago, spokes2112 said:

In the demo, i = 2 to begin with,

I see it as 1:

Quote

        -- check for changes   
        fbutton = false
        i = 1
        while i <= 8 do
...

?

Posted
10 minutes ago, spokes2112 said:

In the demo, i = 2

Ah, sorry. You mean in the attached/modified version. I changed this in the modified version as a user didn't want both the original and virtual buttons triggering in the UI, so I changed this to disable update of the 1st 32 buttons.

John

  • Thanks 1
Posted

Pete,

Just some early morning theory with the coffee ))
I think it's because FSUIPC picks up the first 32 buttons, correct?
In this line * all * the buttons are picked up but we only need the ones * not * picked up by FSUIPC to be placed into the VJ offsets.
        buttons[1], buttons[2], buttons[3], buttons[4], buttons[5], buttons[6], buttons[7], buttons[8] = com.GetHidButtons(dev, CurrentData)
So with that, if true, "i" should equal 2 starting the loop.

Again just a theory, you 2 are the masters! 😉 

Posted
10 hours ago, spokes2112 said:

Morrispe,

Using the HIDDemo as is for both devices will never work. It is a demo to prove that 256 buttons can be programmed to ONE joystick.
By using the same lua for both the ALPHA & the BRAVO, they will write to the same address space reserved for virtual joysticks. (0x3344 thru 0x3363. The first joystick slot 0x3340, Joy #64, was not used in this lua )
Attached are 2 luas 1 for the ALPHA, 1 for the BRAVO.
ALPHA buttons greater than 32 will be on joystick #64 with 32 additional buttons provided. (0x3340)
BRAVO buttons greater than 32 will be on joystick #65 with 32 additional buttons provided. (0x3344)

Neither of these have been tested at all, can't think of a way to spoof FSUIPC into thinking my only controller (<32 buttons) can also be copied as Joy#64 and/or Joy#65 at the same time. 
Perhaps not enough coffee yet?  ha...
Hope these may help you. ( have high confidence they will work right from the start )

Roman
 

EDIT - found a way to test and there were 2 syntax errors in each, now corrected. Both work as intended. 

 

hidAlphaButtons.lua 2.71 kB · 1 download hidBravoButtons.lua 2.71 kB · 1 download

Thanks so much for posting these. The two LUA files with separate 3340 = ALPHA, 3344 = BRAVO offsets are what I needed. Both controllers are working properly now with FSUIPC7 and I'm able to assign functions to all of the switches in MSFS2020 🙂

  • Like 1

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.