Jump to content
The simFlight Network Forums

rotary encoder input speed


Recommended Posts

Pete,

(pardon typos I'm replying from my phone)

What I know of lua I'm learning from reading your documentation and threads in the forum. This is my first venture using it though. I fear I'm trying your patients and wearing out my welcome. For that I apologize!!!

I have taken the documentation with me for my road trip and will be reading over it again this weekend so I am better equipped when I get back home and can continue work on this. I am self taught on a handful of programming and scripting languges so this shouldn't be the difficult exercise I've managed to make it. Hopefully my study time this weekend and continued efforts come Tuesday will fill in the obvious gaps in my knowledge.

Many thanks!

Tom G.

Link to comment
Share on other sites

  • Replies 92
  • Created
  • Last Reply

Top Posters In This Topic

What I know of lua I'm learning from reading your documentation and threads in the forum. This is my first venture using it though. I fear I'm trying your patients and wearing out my welcome. For that I apologize!!!

Not a problem, though i'm still a little mystified. The lua script you are using was designed for someone who tested it for me (i don't have the means to test it properly here). It isn't an example I support or provide anywhere, so I assume you got it from that original thread? If so, were there instructions there on how to use it? When you started this thread you appeared to know what you were doing, which is why I was getting more and more mystified as things changed inexplicably.

I have taken the documentation with me for my road trip and will be reading over it again this weekend so I am better equipped when I get back home and can continue work on this. I am self taught on a handful of programming and scripting languges so this shouldn't be the difficult exercise I've managed to make it. Hopefully my study time this weekend and continued efforts come Tuesday will fill in the obvious gaps in my knowledge.

If you use the script exactly as I supplied to the original tester, and you have the fully tested and working version, then really there is no more programming needed. It should work, though you may need to adjust timings and, of course, the device details and button numbers used.

The main thing you seem to be getting wrong is starting it. As I said ipcReady.lua is the name of the script which is always started by FSUIPC when FS is ready. Really all you need to read is the introductory document.

The library document is for reference when actually programming, and only gives the ADDITIONS to Lua provided in FSUIPC (and mostly in WideClient too). The language and main bulk of lua is described and defined in books you can purchase, or view less comfortably on-line at the Lua website.

Regards

Pete

Link to comment
Share on other sites

Not a problem, though i'm still a little mystified. The lua script you are using was designed for someone who tested it for me (i don't have the means to test it properly here). It isn't an example I support or provide anywhere, so I assume you got it from that original thread? If so, were there instructions there on how to use it? When you started this thread you appeared to know what you were doing, which is why I was getting more and more mystified as things changed inexplicably.

If you use the script exactly as I supplied to the original tester, and you have the fully tested and working version, then really there is no more programming needed. It should work, though you may need to adjust timings and, of course, the device details and button numbers used.

Regards

Pete

Pete,

I am the original tester. I did not get a chance to test your 2nd version of the script due to some life changes, so cannot confirm whether it actually works with the hardware the way you intended. I neglected to follow up and tell you that and am sorry. I hope that omitted information is not causing communication problems between you and Tom_G.

Reid

Link to comment
Share on other sites

I am the original tester. I did not get a chance to test your 2nd version of the script due to some life changes, so cannot confirm whether it actually works with the hardware the way you intended. I neglected to follow up and tell you that and am sorry. I hope that omitted information is not causing communication problems between you and Tom_G.

Not really, but it thickens the plot somewhat! We'll see what we can do when Tom_G has more time. Now I know the score it should be clearer.

Thanks for commenting.

Regards

Pete

Link to comment
Share on other sites

Pete,

Sorry, I didn't realize there was confusion on who started the thread vs. when I joined in. That behind us though, I have, as promised, re-read all the documentation, and started from scratch on this with a bodnar board that only has the single encoder installed and tested, the lua script has been re-entered and verified line by line based on the posted update in this thread. I did add the logging lines to it that you asked for as well.

I don't want to chance leaving out an details so I am posting all three logs in this post, the IPCReady.lua script, and the buttons portion of the FSUIPC Config.

I ran FSX launched the HidDemo (via Joy 2 btn 2). I then rotated the encoder (joy 3 btn's 31 and 30) 2 clicks ccw and 2 clicks cw and captured the result in the logs below. In FSX I can observe the heading bug responding to the ccw clicks but not the cw clicks. This is as it was before I inadvertently introduced the other problems.

If I understand what the logs are telling me the script is seeing the inputs from the encoder in both directions but not acting on the cw inputs. Before going further I wanted to post this much and get your feedback. I'm trying to figure out the next best point in the code to pull some log entries from to see where it's not working.

Here's what the HidDemo log shows:

********* LUA: "HidDemo" Log [from FSUIPC version 4.734] *********
    41980 System time = 11/10/2011 08:08:47, Simulator time = 08:08:15 (12:08Z)
    41980 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\HidDemo.lua"
    42121 LUA: Device has 1 x Hat axis, Max= 7
    42230 LUA: Hat = 15 0 0 0
    47877 LUA: Buttons= 40000000 0 0 0 0 0 0 0
    47986 LUA: Buttons= 0 0 0 0 0 0 0 0
    49624 LUA: Buttons= 40000000 0 0 0 0 0 0 0
    49687 LUA: Buttons= 0 0 0 0 0 0 0 0
    51543 LUA: Buttons= 80000000 0 0 0 0 0 0 0
    51574 LUA: Buttons= 0 0 0 0 0 0 0 0
    52744 LUA: Buttons= 80000000 0 0 0 0 0 0 0
    52853 LUA: Buttons= 0 0 0 0 0 0 0 0
    57409 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\HidDemo.lua"
    57409 System time = 11/10/2011 08:09:03, Simulator time = 08:08:30 (12:08Z)
********* LUA execution terminated: Log Closed *********

Here's what the lua log shows:

********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
    36863 System time = 11/10/2011 08:08:42, Simulator time = 08:08:10 (12:08Z)
    36863 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
    47846 LUA: Datalength=6 Buttons=1073741824 PrevButtons=0
    47877 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    47908 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    47939 LUA: Datalength=6 Buttons=0 PrevButtons=1073741824
    49546 LUA: Datalength=6 Buttons=1073741824 PrevButtons=0
    49577 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    49624 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    49655 LUA: Datalength=6 Buttons=0 PrevButtons=1073741824
    51481 LUA: Datalength=6 Buttons=2147483648 PrevButtons=0
    51512 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    51543 LUA: Datalength=6 Buttons=0 PrevButtons=2147483648
    52682 LUA: Datalength=6 Buttons=2147483648 PrevButtons=0
    52713 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    52760 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    52791 LUA: Datalength=6 Buttons=0 PrevButtons=2147483648
   121276 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
   121276 System time = 11/10/2011 08:10:07, Simulator time = 08:09:28 (12:09Z)
********* LUA execution terminated: Log Closed *********

Here's what the FSUIPC log shows:

********* FSUIPC4, Version 4.734 by Pete Dowson *********
User Name="Tom Gauvin"
User Addr="tom@thegauvins.com"
FSUIPC4 Key is provided
WIDEFS7 not user registered, or expired
Running inside FSX on Windows 7
Module base=61000000
Wind smoothing fix is not installed
DebugStatus=15
      500 System time = 11/10/2011 08:08:06
      500 FLT path = "C:\Users\Tom and Judy\Documents\Flight Simulator X Files\"
      531 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      546 FS path = "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\"
      890 LogOptions=E0000000 0000001D
      890 SimConnect_Open succeeded: waiting to check version okay
      890 Trying to use SimConnect Acc/SP2 Oct07
 	4353 Running in "Microsoft Flight Simulator X", Version: 10.0.61637.0 (SimConnect: 10.0.61259.0)
 	4353 Initialising SimConnect data requests now
 	4353 FSUIPC Menu entry added
 	4384 Ready Flags: Ready-To-Fly=N, In Menu=Y, In Dlg=Y
 	4384 C:\Users\Tom and Judy\Documents\Flight Simulator X Files\KTRG 172.FLT
 	4384 C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\SimObjects\Airplanes\C172\Cessna172SP.AIR
 	4509 *** EVENT: Cntrl= 66416 (0x00010370), Param= -1 (0xffffffff) PAN_VIEW
    23837 *** EVENT: Cntrl= 66514 (0x000103d2), Param= 0 (0x00000000) ATC_MENU_CLOSE
    35849 Ready Flags: Ready-To-Fly=N, In Menu=N, In Dlg=N
    35881 Button changed: bRef=0, Joy=1, Btn=6, Pressed
    35881 [Buttons] 11=P1,6,C66286,0
    35881 FS Control Sent: Ctrl=66286, Param=0
    35881 *** EVENT: Cntrl= 66286 (0x000102ee), Param= 0 (0x00000000) TOGGLE_DME
    36661 System time = 11/10/2011 08:08:42, Simulator time = 08:08:10 (12:08Z)
    36676 Aircraft="Cessna Skyhawk 172SP Paint2"
    36863 Starting everything now ...
    36895 Ready Flags: Ready-To-Fly=Y, In Menu=N, In Dlg=N
    41980 Button changed: bRef=0, Joy=2, Btn=2, Pressed
    41980 [Buttons] 27=P2,2,CL2:R,0
    42214 WRITElua 3BBE,   2 bytes: 92 08                                            ..
    47877 WRITElua 3340,   4 bytes: 01 00 00 40                                      ...@
    47877 WRITElua 3340,   1 bytes: 01                               				.
    47877 Button changed: bRef=0, Joy=64, Btn=0, Pressed
    47877 [Buttons] 51=P64,0,C65880,0
    47877 FS Control Sent: Ctrl=65880, Param=0
    47877 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    47971 WRITElua 3340,   4 bytes: 01 00 00 00                                      ....
    47971 WRITElua 3340,   1 bytes: 01                               				.
    49577 WRITElua 3340,   1 bytes: 00                               				.
    49577 Button changed: bRef=0, Joy=64, Btn=0, Released
    49577 [Buttons] 52=U64,0,C65880,0
    49577 FS Control Sent: Ctrl=65880, Param=0
    49577 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    49609 WRITElua 3340,   4 bytes: 00 00 00 40                                      ...@
    49687 WRITElua 3340,   4 bytes: 01 00 00 00                                      ....
    49687 WRITElua 3340,   1 bytes: 01                               				.
    49687 Button changed: bRef=0, Joy=64, Btn=0, Pressed
    49687 [Buttons] 51=P64,0,C65880,0
    49687 FS Control Sent: Ctrl=65880, Param=0
    49687 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    51543 WRITElua 3340,   4 bytes: 00 00 00 80                                      ....
    51543 Button changed: bRef=0, Joy=64, Btn=0, Released
    51543 [Buttons] 52=U64,0,C65880,0
    51543 FS Control Sent: Ctrl=65880, Param=0
    51543 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    51574 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
    52744 WRITElua 3340,   4 bytes: 00 00 00 80                                      ....
    52853 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
    56956 Button changed: bRef=0, Joy=2, Btn=2, Released
    56956 [Buttons] 74=U2,2,CL2:K,0
    57409 LUA: "HidDemo.lua": killed
   115254 *** EVENT: Cntrl= 65732 (0x000100c4), Param= 0 (0x00000000) EXIT
   115285 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
   115285 Sim stopped: average frame rate for last 79 secs = 29.7 fps
   122789 System time = 11/10/2011 08:10:08, Simulator time = 08:09:28 (12:09Z)
   122789 *** FSUIPC log file being closed
Average frame rate for running time of 79 secs = 29.7 fps
Memory managed: 46 Allocs, 46 Freed
********* FSUIPC Log file closed ***********

Here's the lua script as presently entered:

Vendor = "Leo Bodnar"
Product = "BU0836A Interface"
Device = 0  -- Multiple devices of the same name need increasing Device numbers.
-- Use separate Lua plug-ins for separate cards!

-- NOTE: this can handle up to 16 rotaries only, using the first 64 "virtual buttons"
-- List the pairs here:

Rotaries = {31, 30} 

-- Example { 31, 30, 25, 22 } would be 31+30 for one, 25+22 for the next, and so on
-- Which is clockwise and which counterclockwise doesn't matter -- you'll get
-- fast and slow of each in any case

dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report)

if dev == 0 then
   ipc.log("Could not open HID")
   ipc.exit()
end

-- Set the boundary time in milliseconds between
-- "fast" (shorter) and "slow" (longer) signalling

FastTimeLimit = 60 -- Adjust to taste

-- Polling time in milliseconds: should be much shorter than 
-- the boundary time

Pollrate = 20  -- same as 50 times per second

-- Initialise variables used to keep track of things
LastTimes = {}
Buttons = 0
PrevButtons = 0
Diff = 0

-- This function will be called by a time event, set at the end of the program before exit.
function poll(Time)
   -- read any data available from the device (only need most recent report)
  data, n = com.readlast(dev, rd)

  if n ~= 0 then
        -- Data was returned, so get the status of all the possible "buttons" we are using
        -- one value of 32 bits
        Buttons = com.gethidbuttons(dev, data)          

        -- See if any changes occurred:
        Diff = logic.Xor(Buttons, PrevButtons)

if (Buttons ~= 0) or (PrevButtons ~= 0) then
   ipc.log("Datalength=" .. n .. " Buttons=" .. Buttons .. " PrevButtons=" .. PrevButtons)
end

        PrevButtons = Buttons

        if Diff ~= 0 then 
        offset = 0x3340
        buttonbit = 1
        j = 1
        while Rotaries[j] ~= nil do
   			mask = logic.Shl(1, Rotaries[j]-1)       				
   			if logic.And(Diff,mask) ~= 0 then
                  -- This one changed
                -- See if changed in less than the "boundary" time
                thisbutton = buttonbit
                if (LastTimes[j] ~= nil) and ((Time - LastTimes[j]) < FastTimeLimit) then
                thisbutton = buttonbit + buttonbit  -- Use next higher button for fast
                end
 			LastTimes[j] = Time

                -- Toggle a virtual button accordingly
                ipc.togglebitsUB(offset, thisbutton)
                end

                j = j + 1
        buttonbit = 4 * buttonbit
          if logic.And(j,15) == 0 then
                buttonbit = 1
                offset = offset + 4
 			end
      end
    end
  end
end

event.timer(Pollrate, "poll")

And here's the buttons portion of my FSUIPC Config:

JoyNames]
AutoAssignLetters=No
2=Saitek Pro Flight TPM System
2.GUID={FD845DF0-45C1-11E0-8001-444553540000}
0=CH FLIGHT SIM YOKE USB
0.GUID={666AE7F0-0E11-11E0-8001-444553540000}
1=Logitech Extreme 3D
1.GUID={138A7360-1BEB-11E0-8001-444553540000}
3=BU0836A Interface
3.GUID={F6F16B00-E561-11E0-8001-444553540000}

[Buttons]
ButtonRepeat=20,10
1=H0,0,K20,8
3=P1,1,C65580,0
4=U1,1,C65580,0
5=P1,0,C66375,0
6=U1,0,C66375,0
7=P1,34,C65956,0
8=P1,32,C65957,0
9=P1,36,C65958,0
10=H1,38,K81,10
11=P1,6,C66286,0
12=U1,6,C66286,0
17=R0,4,C65662,0
18=R0,5,C65663,0
19=R0,6,C65879,0
20=R0,7,C65880,0
21=P2,0,C66023,0
22=U2,0,C66023,0
23=P2,1,C65930,0
24=H2,3,K66,8
25=U2,3,K68,8
26=U2,1,C66026,0
27=P2,2,CL2:R,0
29=P2,4,C66513,0
30=U2,4,C66514,0
31=P2,5,C66199,0
32=U2,5,C66199,0
33=P2,7,C65908,0
34=U2,7,C65908,0
35=P2,8,C65914,0
36=U2,8,C65914,0
37=P2,6,C65907,0
38=U2,6,C65907,0
41=P1,7,C66477,0
44=P1,5,C66465,0
45=P1,2,C66464,0
46=P1,4,C66463,0
47=P0,1,K113,8
48=U0,1,K32,10
51=P64,0,C65880,0
52=U64,0,C65880,0
53=P64,1,C1024,0
54=U64,1,C1024,0
55=P64,2,C65879,0
56=U64,2,C65879,0
57=P64,3,C1025,0
58=U64,3,C1025,0
74=U2,2,CL2:K,0

Link to comment
Share on other sites

I don't want to chance leaving out an details so I am posting all three logs in this post, the IPCReady.lua script, and the buttons portion of the FSUIPC Config.

I ran FSX launched the HidDemo (via Joy 2 btn 2). I then rotated the encoder (joy 3 btn's 31 and 30) 2 clicks ccw and 2 clicks cw and captured the result in the logs below. In FSX I can observe the heading bug responding to the ccw clicks but not the cw clicks.

But they were all seen. Let's see:

HidDemo log:

    47877 LUA: Buttons= 40000000 0 0 0 0 0 0 0
    47986 LUA: Buttons= 0 0 0 0 0 0 0 0
    49624 LUA: Buttons= 40000000 0 0 0 0 0 0 0
    49687 LUA: Buttons= 0 0 0 0 0 0 0 0
    51543 LUA: Buttons= 80000000 0 0 0 0 0 0 0
    51574 LUA: Buttons= 0 0 0 0 0 0 0 0
    52744 LUA: Buttons= 80000000 0 0 0 0 0 0 0
    52853 LUA: Buttons= 0 0 0 0 0 0 0 0

Both buttons, twice.

lua log:

	47846 LUA: Datalength=6 Buttons=1073741824 PrevButtons=0
    47877 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    47908 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    47939 LUA: Datalength=6 Buttons=0 PrevButtons=1073741824
    49546 LUA: Datalength=6 Buttons=1073741824 PrevButtons=0
    49577 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    49624 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    49655 LUA: Datalength=6 Buttons=0 PrevButtons=1073741824
    51481 LUA: Datalength=6 Buttons=2147483648 PrevButtons=0
    51512 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    51543 LUA: Datalength=6 Buttons=0 PrevButtons=2147483648
    52682 LUA: Datalength=6 Buttons=2147483648 PrevButtons=0
    52713 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    52760 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    52791 LUA: Datalength=6 Buttons=0 PrevButtons=2147483648

I should have put those numbers out in Hex, not Decimal. nevertheless they are correct, 0x40000000 and 0x80000000 respectively.

FSUIPC log:

    42214 WRITElua 3BBE,   2 bytes: 92 08                                            ..
    47877 WRITElua 3340,   4 bytes: 01 00 00 40                                      ...@
    47877 WRITElua 3340,   1 bytes: 01                   							.
    47877 Button changed: bRef=0, Joy=64, Btn=0, Pressed
    47877 [Buttons] 51=P64,0,C65880,0
    47877 FS Control Sent: Ctrl=65880, Param=0
    47877 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC

That's one of your rotary turns. I see two virtual buttons, 30 (the '40' value) and 0 (the '01' value) are being set, at slightly different times. What is setting virtual button 30? Nothing in the Lua you've shown me does, but some Lua is doing it!

	47971 WRITElua 3340,   4 bytes: 01 00 00 00                                      ....
    47971 WRITElua 3340,   1 bytes: 01                   							.
    49577 WRITElua 3340,   1 bytes: 00                   							.
    49577 Button changed: bRef=0, Joy=64, Btn=0, Released
    49577 [Buttons] 52=U64,0,C65880,0
    49577 FS Control Sent: Ctrl=65880, Param=0
    49577 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC

Button 30 is released, then 0. so far so good.

This is repeated, but with a subtle difference:

    51543 WRITElua 3340,   4 bytes: 00 00 00 80                                      ....
    51543 Button changed: bRef=0, Joy=64, Btn=0, Released
    51543 [Buttons] 52=U64,0,C65880,0
    51543 FS Control Sent: Ctrl=65880, Param=0
    51543 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    51574 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
    52744 WRITElua 3340,   4 bytes: 00 00 00 80                                      ....
    52853 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....

The button press of 31 is seen (the '80'), but it is cleared so soon.

So, something else -- another Lua program -- is writing to the same virtual button offsets at the same time, but using buttons 30 and 31 instead of your 0 and 1. This is interacting with your Lua inputs and so destroying some of the results. And stopping the rotary one working.

i notice this in your FSUIPC button assignments:

74=U2,2,CL2:K,0

This appears to be running a Lua program, number 2 in the list in the INI file (which you omitted). And you are pressing that button and getting that Lua running just before you do the test:

41980 Button changed: bRef=0, Joy=2, Btn=2, Pressed

41980 [buttons] 27=P2,2,CL2:R,0

Why? What is this you are doing?

Pete

Link to comment
Share on other sites

So, something else -- another Lua program -- is writing to the same virtual button offsets at the same time, but using buttons 30 and 31 instead of your 0 and 1. This is interacting with your Lua inputs and so destroying some of the results. And stopping the rotary one working.

I'll go back through everything this evening and make sure there aren't any other lua scripts in modules folder. There should not be anything beyond IPCReady, IPCDebug, and HIDDemo since I've never used lua before, but I'll make sure.

i notice this in your FSUIPC button assignments:

74=U2,2,CL2:K,0

This appears to be running a Lua program, number 2 in the list in the INI file (which you omitted). And you are pressing that button and getting that Lua running just before you do the test:

41980 Button changed: bRef=0, Joy=2, Btn=2, Pressed

41980 [buttons] 27=P2,2,CL2:R,0

Why? What is this you are doing?

Pete

That was how I launched the HidDemo lua script based on one of your earlier posts. Since it seems that has now proven the buttons are sending correctly I'll assume I can stop using it. Tests this morning with or without HidDemo running still had no cw activity so I don't think it was interfering.

While re-reading my post from this morning I also just noticed that I had not added one update line to the FSUIPC Config Buttons section that you also earlier suggested, "IgnoreThese=3.30, 3.31". I will add that back in and retest before posting again.

One other quick question. Above you commented,

"I should have put those numbers out in Hex, not Decimal. nevertheless they are correct, 0x40000000 and 0x80000000 respectively."

How hard is it to modify the logging statement to do that? It would seem that would make it easier to follow.

Link to comment
Share on other sites

I've removed the button assignment that launched the HIDDemo from the FSUIPC config and added the "IgnoreThese = 3.31, 3.30" back in. I also removed the HIDDemo and IPCDebug scripts from the modules folder.

I re-launched FSX and repeated the test of two clicks ccw and two clicks cw. No change, still only decrimenting with ccw and no action with cw. The IPCReady log and FSUIPC log are below.

I may try to place a couple other log statements in to look at some of the other variables to see if I can understand more of the script myself.

Any further thoughts?

********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
    30248 System time = 11/10/2011 18:11:58, Simulator time = 18:11:32 (22:11Z)
    30248 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
    34913 LUA: Datalength=6 Buttons=1073741824 PrevButtons=0
    34944 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    34975 LUA: Datalength=6 Buttons=0 PrevButtons=1073741824
    36285 LUA: Datalength=6 Buttons=1073741824 PrevButtons=0
    36317 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    36348 LUA: Datalength=6 Buttons=1073741824 PrevButtons=1073741824
    36379 LUA: Datalength=6 Buttons=0 PrevButtons=1073741824
    37892 LUA: Datalength=6 Buttons=2147483648 PrevButtons=0
    37923 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    38001 LUA: Datalength=6 Buttons=0 PrevButtons=2147483648
    39218 LUA: Datalength=6 Buttons=2147483648 PrevButtons=0
    39265 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    39296 LUA: Datalength=6 Buttons=2147483648 PrevButtons=2147483648
    39327 LUA: Datalength=6 Buttons=0 PrevButtons=2147483648
    49733 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
    49733 System time = 11/10/2011 18:12:17, Simulator time = 18:11:46 (22:11Z)
********* LUA execution terminated: Log Closed *********

********* FSUIPC4, Version 4.734 by Pete Dowson *********
User Name="Tom Gauvin"
User Addr="tom@thegauvins.com"
FSUIPC4 Key is provided
WIDEFS7 not user registered, or expired
Running inside FSX on Windows 7
Module base=61000000
Wind smoothing fix is not installed
DebugStatus=15
      546 System time = 11/10/2011 18:11:28
      546 FLT path = "C:\Users\Tom and Judy\Documents\Flight Simulator X Files\"
      592 Trying to connect to SimConnect Acc/SP2 Oct07 ...
      592 FS path = "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\"
 	1138 LogOptions=E0000000 0000001D
 	1138 SimConnect_Open succeeded: waiting to check version okay
 	1138 Trying to use SimConnect Acc/SP2 Oct07
 	3868 Running in "Microsoft Flight Simulator X", Version: 10.0.61637.0 (SimConnect: 10.0.61259.0)
 	3868 Initialising SimConnect data requests now
 	3868 FSUIPC Menu entry added
 	3915 Ready Flags: Ready-To-Fly=N, In Menu=Y, In Dlg=Y
 	3915 C:\Users\Tom and Judy\Documents\Flight Simulator X Files\KTRG 172.FLT
 	3915 C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\SimObjects\Airplanes\C172\Cessna172SP.AIR
 	4040 *** EVENT: Cntrl= 66416 (0x00010370), Param= -1 (0xffffffff) PAN_VIEW
    13369 *** EVENT: Cntrl= 66514 (0x000103d2), Param= 0 (0x00000000) ATC_MENU_CLOSE
    29219 Ready Flags: Ready-To-Fly=N, In Menu=N, In Dlg=N
    30061 System time = 11/10/2011 18:11:57, Simulator time = 18:11:32 (22:11Z)
    30077 Aircraft="Cessna Skyhawk 172SP Paint2"
    30248 Starting everything now ...
    30264 Ready Flags: Ready-To-Fly=Y, In Menu=N, In Dlg=N
    34944 WRITElua 3340,   1 bytes: 01                                           	.
    34944 Button changed: bRef=0, Joy=64, Btn=0, Pressed
    34944 [Buttons] 51=P64,0,C65880,0
    34944 FS Control Sent: Ctrl=65880, Param=0
    34944 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    35006 WRITElua 3340,   1 bytes: 00                                           	.
    35006 Button changed: bRef=0, Joy=64, Btn=0, Released
    35006 [Buttons] 52=U64,0,C65880,0
    35006 FS Control Sent: Ctrl=65880, Param=0
    35006 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    36317 WRITElua 3340,   1 bytes: 01                                           	.
    36317 Button changed: bRef=0, Joy=64, Btn=0, Pressed
    36317 [Buttons] 51=P64,0,C65880,0
    36317 FS Control Sent: Ctrl=65880, Param=0
    36317 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    36410 WRITElua 3340,   1 bytes: 00                                           	.
    36410 Button changed: bRef=0, Joy=64, Btn=0, Released
    36410 [Buttons] 52=U64,0,C65880,0
    36410 FS Control Sent: Ctrl=65880, Param=0
    36410 *** EVENT: Cntrl= 65880 (0x00010158), Param= 0 (0x00000000) HEADING_BUG_DEC
    45037 *** EVENT: Cntrl= 65732 (0x000100c4), Param= 0 (0x00000000) EXIT
    45177 Ready Flags: Ready-To-Fly=Y, In Menu=Y, In Dlg=Y
    51261 System time = 11/10/2011 18:12:19, Simulator time = 18:11:46 (22:11Z)
    51261 *** FSUIPC log file being closed
Average frame rate for running time of 16 secs = 29.8 fps
Memory managed: 25 Allocs, 25 Freed
********* FSUIPC Log file closed ***********

Link to comment
Share on other sites

I've removed the button assignment that launched the HIDDemo from the FSUIPC config and added the "IgnoreThese = 3.31, 3.30" back in. I also removed the HIDDemo and IPCDebug scripts from the modules folder.

It wasn't necessary to do any of that. The Lua files don't run unless you tell them to. All you needed to do was not push the button to start HidDemo -- you certainly don't want that running at the same time as the Rotaries one. As they stand they conflict. If you want to run both together I can tell you how to change one of them so they don't conflict.

I re-launched FSX and repeated the test of two clicks ccw and two clicks cw. No change, still only decrimenting with ccw and no action with cw. The IPCReady log and FSUIPC log are below.

The Lua log shows:

	34913 Button 30 pressed
	34975 Button 30 released
    36285 Button 30 pressed
	36379 Button 30 released
    37892 Button 31 pressed
	38001 Button 31 released
    39218 Button 31 pressed
	39327 Button 31 released

So that's fine.

The FSUIPC4 log shows the first 4 events,

    34944 WRITElua 3340,   1 bytes: 01                           					.
	35006 WRITElua 3340,   1 bytes: 00                           					.
	36317 WRITElua 3340,   1 bytes: 01                           					.
	36410 WRITElua 3340,   1 bytes: 00                           					.

each occurrence being only around 30 mSecs after the Lua logged it.

But then nothing for button 31.

Now the one glaring error here is that in your Lua program, button 31 is listed BEFORE button 30. So button 31 should be joystick 64, button 0 and button 30 should be button 1. But we are seeing button 0 for 30 and nothing for 31. So it looks like the error is in the Lua code (untested as we now know, at least before you started using it!). Button 31 is probably trying to be button -1. ie. the code is one out.

Interestingly, if you'd used buttons 30 and 29 (etc) you'd have been fine and we'd never have discovered this bug. Only buttons 31 (and probably 0) would go wrong.

So, the error is in this line:

mask = logic.Shl(1, Rotaries[j]-1)  

This is written assuming you count button numbers from 1. But we don't. Your buttons 31, 30 are the last two -- the first would be 0. Obviously we don't subtract 1 from 0 to compute a shift to the left!

I think this mistake arose from the mixture between thinking in "C" (my native prograsmming language) and in "Lua" (which is certainly not). Lua always counts from 1. "C" alsways counts from 0!

The correct line is:

mask = logic.Shl(1, Rotaries[j])  

Now please tell me this works! ;-)

Note that this will reverse the rotary action. Rather than reprogram it in FSUIPC you might want to simply swap the button numbers over. i.e.

Rotaries = {30, 31}

Then we need to find other postings of the code and correct those. Can you tell me the source you found, please?

Regards

Pete

Link to comment
Share on other sites

THAT'S DONE IT! ALL IS WORKING NOW!! biggrin.gif

Then we need to find other postings of the code and correct those. Can you tell me the source you found, please?

Pete, the Code came from post #25 of this thread, your 14 June 2011 - 06:58 AM reply post

I had a little bit of a time getting the fast timing limit set to trigger fast movement, but did get it. I threw in some logging lines to show me the time difference when the if statement triggered and experimented until I had a comfortable timing. It's at 100 now but that's on the test bench so I may fine tune that further when I get the encoders installed in the real panel and as I gain experience.

THANKS!!! For all your help and patience.

Tom G.

Link to comment
Share on other sites

THAT'S DONE IT! ALL IS WORKING NOW!! biggrin.gif

Good! Sorry it took so long -- a lot of red herrings on the way!

Pete, the Code came from post #25 of this thread, your 14 June 2011 - 06:58 AM reply post

Okay, thanks.

I had a little bit of a time getting the fast timing limit set to trigger fast movement, but did get it. I threw in some logging lines to show me the time difference when the if statement triggered and experimented until I had a comfortable timing. It's at 100 now but that's on the test bench so I may fine tune that further when I get the encoders installed in the real panel and as I gain experience.

I'm thinking of providing the code as one of the samples in the Lua plug-ins package. Should I change the timing in that do you think? I assume you mean this line:

FastTimeLimit = 60 -- Adjust to taste

Better at 100?

Thsnks,

Pete

Link to comment
Share on other sites

I'm thinking of providing the code as one of the samples in the Lua plug-ins package. Should I change the timing in that do you think? I assume you mean this line:

FastTimeLimit = 60 -- Adjust to taste

Better at 100?

Thsnks,

Pete

Pete,

I've been doing some more experimenting back and forth in a range between 80 and 100. I found 70 too short, and a bit more experimentation is showing me that 100 may be a bit long as it occasionally catches a tail end click as a fast when I'm slowing down to zero in in a specific heading.

I would go with 90 as a starting point.

Tom G.

Link to comment
Share on other sites

I've been doing some more experimenting back and forth in a range between 80 and 100. I found 70 too short, and a bit more experimentation is showing me that 100 may be a bit long as it occasionally catches a tail end click as a fast when I'm slowing down to zero in in a specific heading.

I would go with 90 as a starting point.

Thanks. I've left it as a round 100 for now as I think it will be pretty dependent on the system you use it on and the type of rotary, so it'll always need experimentation in any case.

Regards

Pete

Link to comment
Share on other sites

Hi There,

I have followed this thread with interest and have been able to get the 'Joystick 64' to work on one BU0836 card. The problem is I have three of these cards and need to add a second one to the Lua script arrangment.

I copied the original Lua script and gave it a different name. ipcready1.lua and it appears in the FSUIPC drop down list. I have tried assigning increasing Device numbers starting from 1 and going up to 7, which is the total number identified using the HID programme. I have added the paired outputs within the curly brackets but no luck.

Any advice on how I can get a second card to work would be very welcome.

Thanks in advance.

My regards

Dave

Link to comment
Share on other sites

I have followed this thread with interest and have been able to get the 'Joystick 64' to work on one BU0836 card. The problem is I have three of these cards and need to add a second one to the Lua script arrangment.

That would be pretty complicated. Best to have one Lua for each.

I copied the original Lua script and gave it a different name. ipcready1.lua and it appears in the FSUIPC drop down list. I have tried assigning increasing Device numbers starting from 1 and going up to 7, which is the total number identified using the HID programme. I have added the paired outputs within the curly brackets but no luck.

The name "ipcReady.lua" is special in that it is automatically loaded and run by FSUIPC as soon as FS is ready to fly. That won't occur with "ipcReady1.lua".

To run several Lua plug-ins automatically there are two ways. But first name the Lua files something other than "ipcReady.lua" -- eg BU0836_1.lua, BU083621.lua, and BU0836_3.lua in your case, or something more descriptive if they have specific roles.

The first way is to create and ipcReady.lua which has the sole job of running other Luas, thus:

RunLua("BU0836_1")

RunLua("BU0836_2")

RunLua("BU0836_3")

The second way it to edit the FSUIPC INI file and add a new section:

[Auto]

1=Lua BU0836_1

2=Lua BU0836_2

3=Lua BU0836_3

If you use the latter method don't forget to remove the ipcReady.lua file you are currently using.

Regards

Pete

Link to comment
Share on other sites

  • 2 weeks later...

Hi Pete,

I've tried not to come back with silly questions but I'm afraid I have failed!

I have created two lua files, BU0836X_0.lua and BU0836X_1.lua each with the same content as the ipcready.lua file I used previously and placed them both in the modules folder of FSX.

In FSUIPC.ini I have placed the entry:

[Auto]

1=Lua BU0836X_0

2=Lua BU0836X_1

When FSX runs I can both Lua files listed in FSUIPC.

I need two of the three BU0836X cards I have to operate the virtual joystick, these are Joytick B & H. These are also designated 0 and 7 in FSUIPC.ini.

At the start of the lua files I have inserted 0 in one and 7 in the other as the device; thus:

Vendor = "Leo Bodnar"

Product = "BU0836X Interface"

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

and

Vendor = "Leo Bodnar"

Product = "BU0836X Interface"

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

I have the pairs listed within the curly brackets thus for dveice 0:

Rotaries = {31,30,29,28,27,26}

And thus for device 7

Rotaries = {31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}

I am sure these pairings are correct.

In FSUPC Device 0 (joystick B) the pairs 30+31 and 28+29 are showing joystick 64 but pair 27+26 are not. None of the pairs for device 7 (joytick H) are showing the virtual joystick.

I have tried using device 0 and device 1 with pretty much the same outcome.

Any guidance as to where I am going wrong would be most welcome.

Thanks in advance.

Dave

Link to comment
Share on other sites

I need two of the three BU0836X cards I have to operate the virtual joystick, these are Joytick B & H. These are also designated 0 and 7 in FSUIPC.ini.

How can they be 0 and 7? To get to 7 you'd have to have 8 cards connected!

In FSUPC Device 0 (joystick cool.gif the pairs 30+31 and 28+29 are showing joystick 64 but pair 27+26 are not. None of the pairs for device 7 (joytick H) are showing the virtual joystick.

Well 7 isn't surprising until you add the intervening 6 cards. As for 27+26 it really must be your connections because if the first two pairs are okay there's nothing stopping any others. What normal button numbers are you getting?

I have tried using device 0 and device 1 with pretty much the same outcome.

You said you had 3 cards -- what if your second card is 2? They have to be 0,1 and 2 with three cards, there's no other option.

Pete

Link to comment
Share on other sites

Hi Pete,

I do have eight cards connected and showing in FSUIPC but they are not all BU0836X types, the first one is and the last two. So, you are saying I should number the BU0836X devices as if they are the only cards attached and not follow the numbering in FSUIPC?

The normal button numbers are 26 and 27 showing in FSUIPC. I'll check connections but the joystick shows up as 'B' and the button numbers as 26 & 27, the ones that work show up as Joystick 'B' button numbers 28 & 29 and 30 & 31.

(just tried numbering 0, 1 & 2 with same result)

Thanks

Dave

Edited by egkkman
Link to comment
Share on other sites

I do have eight cards connected and showing in FSUIPC but they are not all BU0836X types, the first one is and the last two. So, you are saying I should number the BU0836X devices as if they are the only cards attached and not follow the numbering in FSUIPC?

What "numbering in FSUIPC"? Are you referring to the Windows IDs used for Windows-recognised joystick devices? Those are absolutely nothing to do with what we are doing in these Lua plug-ins. The plugin is accessing the USB device directly, as a USB HID device, not via any Windows joystick facilities. As described in the comment in the plug-in, each device OF THE SAME VENDOR AND PRODUCT NAME is numbered in sequence. When the vendor and product names are different, they start from 0 again. Is is simply a sequence number for identical devices. If all the devices were different they'd all be number 0.

The normal button numbers are 26 and 27 showing in FSUIPC. I'll check connections but the joystick shows up as 'B' and the button numbers as 26 & 27, the ones that work show up as Joystick 'B' button numbers 28 & 29 and 30 & 31.

(just tried numbering 0, 1 & 2 with same result)

Well, the latter is completely mystifying as you should at least get the same results with two identical cards wired up in an identical manner. It makes no sense otherwise. From what i know of the BU0836 cards they deliver Windows-compatible button and analogue inputs and drive outputs too, and are configurable in how you connect stuff. But they directly-read inputs may be much more dependent on the actual physical configurations than that.

If i had your cards here I'd use a USB monitoring program to see what they are doing, but I strongly suspect that the button numbers provided by Windows' joystick drivers are not the same as the bits seen by the direct HID reading code used in the plug-ins. So your assumptions about button numbers might not be correct.

All I can suggest is using HidScanner first of all to check what the properties of the three cards are -- to see that they are in fact identical in their button arrangements. And also then to use the "HidDemo.lua" plug-in supplied as one of the examples in your FSUIPC installation to log all of the results from all of your connected buttons or dials.

I've a feeling that you are really outreaching your technical skills in these matters, but I'll try to help ... take a look at those two things first.

Regards

Pete

Link to comment
Share on other sites

Pete,

I am refering to this list:

[JoyNames]

AutoAssignLetters=Yes

0=BU0836X Interface

0.GUID={A0B7CCE0-90D8-11DF-8006-444553540000}

1=GoFlight GF-RC Rudder Control

1.GUID={A0B7A5D0-90D8-11DF-8004-444553540000}

2=SideWinder Precision 2 Joystick

2.GUID={D75A1460-97F9-11DF-8001-444553540000}

3=CH FLIGHT SIM YOKE USB

3.GUID={D93B5780-97F9-11DF-8002-444553540000}

4=GF-TQ6 Throttle System

4.GUID={DB39E6A0-97F9-11DF-8003-444553540000}

A=GoFlight GF-RC Rudder Control

A.GUID={A0B7A5D0-90D8-11DF-8004-444553540000}

B=BU0836X Interface

B.GUID={A0B7CCE0-90D8-11DF-8006-444553540000}

C=CH PRO PEDALS USB

C.GUID={339B9670-B83E-11DC-8001-444553540000}

D=CH FLIGHT SIM YOKE USB

D.GUID={D93B5780-97F9-11DF-8002-444553540000}

E=GF-TQ6 Throttle System

E.GUID={DB39E6A0-97F9-11DF-8003-444553540000}

5=CH PRO PEDALS USB

5.GUID={339B9670-B83E-11DC-8001-444553540000}

F=SideWinder Precision 2 Joystick

F.GUID={D75A1460-97F9-11DF-8001-444553540000}

G=BU0836X Interface

H=BU0836X Interface

H.GUID={775ED880-B7F4-11DC-8001-444553540000}

6=BU0836X Interface

6.GUID={FC794690-E793-11E0-8001-444553540000}

7=BU0836X Interface

7.GUID={775ED880-B7F4-11DC-8001-444553540000}

I did begin by numbering 0 and 1 but had the probolem described.

I have three BU0836X cards but only two have encoders attached, those named in the above list as 'B' and 'H'. I did not realise thyis was a windows ID list. I assumed it was the list that identified the joysticks as seen in FSUIPC.

I did use the HIDScanner here is the log

:

********* HidScanner, Version 2.00 by Pete Dowson *********

Device at "\\?\hid#vid_045e&pid_0038#7&34e3140e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=045E, Product=0038 (Version 1.8)

Manufacturer= Microsoft

Product= SideWinder Precision 2 Joystick

Serial Number= SideWinder Precision 2 Joystick

Usage Page: 1

Input Report Byte Length: 7

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 2

Number of Input Button Caps: 1

Number of InputValue Caps: 5

Number of InputData Indices: 13

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Buttons range 1 -> 8 at indices 4 -> 11

Value Y at index 0, range 0 -> 255, using 8 bits

Value X at index 1, range 0 -> 255, using 8 bits

Value Sldr at index 2, range 0 -> 255, using 8 bits

Value R/RZ at index 3, range 0 -> 255, using 8 bits

Value POV at index 12, range 0 -> 7, using 4 bits

**************************************************************************

Device at "\\?\hid#vid_05fe&pid_1011&mi_00#9&22543caa&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=05FE, Product=1011 (Version 3.0)

Manufacturer= Device

Product= USBice

Serial Number=

Device is a keyboard

Usage Page: 1

Input Report Byte Length: 9

Output Report Byte Length: 2

Feature Report Byte Length: 0

Number of Link Collection Nodes: 1

Number of Input Button Caps: 2

Number of InputValue Caps: 0

Number of InputData Indices: 173

Number of Output Button Caps: 1

Number of Output Value Caps: 0

Number of Output Data Indices: 5

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

**************************************************************************

Device at "\\?\hid#vid_05fe&pid_1011&mi_01&col01#9&3a17c8ef&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=05FE, Product=1011 (Version 3.0)

Manufacturer= Device

Product= USB Device

Serial Number=

Device is a mouse

Usage Page: 1

Input Report Byte Length: 6

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 2

Number of Input Button Caps: 1

Number of InputValue Caps: 4

Number of InputData Indices: 9

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Buttons range 1 -> 5 at indices 0 -> 4

Value Wh at index 5, range -127 -> 127, using 8 bits

Value Y at index 6, range -127 -> 127, using 8 bits

Value X at index 7, range -127 -> 127, using 8 bits

Value Wh at index 8, range -127 -> 127, using 8 bits

**************************************************************************

Device at "\\?\hid#vid_05fe&pid_1011&mi_01&col02#9&3a17c8ef&0&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=05FE, Product=1011 (Version 3.0)

Manufacturer= Device

Product= USB Device

Serial Number=

Usage Page: 1

Input Report Byte Length: 2

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 1

Number of Input Button Caps: 1

Number of InputValue Caps: 0

Number of InputData Indices: 3

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

**************************************************************************

Device at "\\?\hid#vid_05fe&pid_1011&mi_01&col03#9&3a17c8ef&0&0002#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=05FE, Product=1011 (Version 3.0)

Manufacturer= Device

Product= USB Device

Serial Number=

Usage Page: C

Input Report Byte Length: 4

Output Report Byte Length: 0

Feature Report Byte Length: 8

Number of Link Collection Nodes: 1

Number of Input Button Caps: 24

Number of InputValue Caps: 0

Number of InputData Indices: 24

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 1

Number of Feature Data Indices: 1

**************************************************************************

Device at "\\?\hid#vid_068e&pid_00f2#7&b0f9b87&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=068E, Product=00F2 (Version 0.0)

Manufacturer= CH PRODUCTS

Product= CH PRO PEDALS USB

Serial Number=

Usage Page: 1

Input Report Byte Length: 4

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 2

Number of Input Button Caps: 0

Number of InputValue Caps: 3

Number of InputData Indices: 3

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Value Z at index 0, range 0 -> 255, using 8 bits

Value Y at index 1, range 0 -> 255, using 8 bits

Value X at index 2, range 0 -> 255, using 8 bits

**************************************************************************

Device at "\\?\hid#vid_068e&pid_00ff#8&765ce72&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=068E, Product=00FF (Version 0.0)

Manufacturer= CH PRODUCTS

Product= CH FLIGHT SIM YOKE USB

Serial Number=

Usage Page: 1

Input Report Byte Length: 8

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 2

Number of Input Button Caps: 1

Number of InputValue Caps: 6

Number of InputData Indices: 18

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Buttons range 1 -> 12 at indices 6 -> 17

Value V/RY at index 0, range 0 -> 255, using 8 bits

Value U/RX at index 1, range 0 -> 255, using 8 bits

Value Z at index 2, range 0 -> 255, using 8 bits

Value Y at index 3, range 0 -> 255, using 8 bits

Value X at index 4, range 0 -> 255, using 8 bits

Value POV at index 5, range 1 -> 8, using 4 bits

**************************************************************************

Device at "\\?\hid#vid_06c2&pid_004c#7&c8feb02&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=06C2, Product=004C (Version 1.0)

Manufacturer= Phidgets Inc.

Product= PhidgetLED

Serial Number= 159572

Usage Page: FFA0

Input Report Byte Length: 42

Output Report Byte Length: 9

Feature Report Byte Length: 0

Number of Link Collection Nodes: 1

Number of Input Button Caps: 0

Number of InputValue Caps: 1

Number of InputData Indices: 1

Number of Output Button Caps: 0

Number of Output Value Caps: 1

Number of Output Data Indices: 1

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Value 0x02 at index 0, range 0 -> 1, using 8 bits

**************************************************************************

Device at "\\?\hid#vid_09f3&pid_0100#8&3434ff53&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=09F3, Product=0100 (Version 1.1)

Manufacturer= GoFlight

Product= GoFlight GF-RC Rudder Control

Serial Number=

Usage Page: 1

Input Report Byte Length: 4

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 2

Number of Input Button Caps: 0

Number of InputValue Caps: 3

Number of InputData Indices: 3

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Value Z at index 0, range 0 -> 255, using 8 bits

Value Y at index 1, range 0 -> 255, using 8 bits

Value X at index 2, range 0 -> 255, using 8 bits

**************************************************************************

Device at "\\?\hid#vid_09f3&pid_0200#6&3304c94e&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=09F3, Product=0200 (Version 1.0)

Manufacturer= GoFlight

Product= GF-TQ6 Throttle System

Serial Number=

Usage Page: 1

Input Report Byte Length: 8

Output Report Byte Length: 0

Feature Report Byte Length: 0

Number of Link Collection Nodes: 2

Number of Input Button Caps: 1

Number of InputValue Caps: 6

Number of InputData Indices: 10

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Buttons range 1 -> 4 at indices 6 -> 9

Value R/RZ at index 0, range 0 -> 255, using 8 bits

Value V/RY at index 1, range 0 -> 255, using 8 bits

Value U/RX at index 2, range 0 -> 255, using 8 bits

Value Z at index 3, range 0 -> 255, using 8 bits

Value Y at index 4, range 0 -> 255, using 8 bits

Value X at index 5, range 0 -> 255, using 8 bits

**************************************************************************

Device at "\\?\hid#vid_18ea&pid_0004#6&2d5ed5c4&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=18EA, Product=0004 (Version 1.0)

Manufacturer=

Product=

Serial Number=

Usage Page: FFA0

Input Report Byte Length: 65

Output Report Byte Length: 65

Feature Report Byte Length: 0

Number of Link Collection Nodes: 1

Number of Input Button Caps: 0

Number of InputValue Caps: 1

Number of InputData Indices: 1

Number of Output Button Caps: 0

Number of Output Value Caps: 1

Number of Output Data Indices: 1

Number of Feature Button Caps: 0

Number of Feature Value Caps: 0

Number of Feature Data Indices: 0

Value 0xA6 at index 0, range -128 -> 127, using 8 bits

**************************************************************************

Device at "\\?\hid#vid_1dd2&pid_1001#6&3129063&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=1DD2, Product=1001 (Version 1.36)

Manufacturer= Leo Bodnar

Product= BU0836X Interface

Serial Number= B20826

Usage Page: 1

Input Report Byte Length: 8

Output Report Byte Length: 0

Feature Report Byte Length: 18

Number of Link Collection Nodes: 3

Number of Input Button Caps: 1

Number of InputValue Caps: 2

Number of InputData Indices: 34

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 1

Number of Feature Data Indices: 1

Buttons range 1 -> 32 at indices 1 -> 32

Value X at index 0, range 0 -> 4095, using 16 bits

Value POV at index 33, range 0 -> 7, using 4 bits

**************************************************************************

Device at "\\?\hid#vid_1dd2&pid_1001#6&376360e3&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=1DD2, Product=1001 (Version 1.36)

Manufacturer= Leo Bodnar

Product= BU0836X Interface

Serial Number= B20825

Usage Page: 1

Input Report Byte Length: 12

Output Report Byte Length: 0

Feature Report Byte Length: 18

Number of Link Collection Nodes: 3

Number of Input Button Caps: 1

Number of InputValue Caps: 4

Number of InputData Indices: 36

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 1

Number of Feature Data Indices: 1

Buttons range 1 -> 32 at indices 3 -> 34

Value U/RX at index 0, range 0 -> 4095, using 16 bits

Value Z at index 1, range 0 -> 4095, using 16 bits

Value X at index 2, range 0 -> 4095, using 16 bits

Value POV at index 35, range 0 -> 7, using 4 bits

**************************************************************************

Device at "\\?\hid#vid_1dd2&pid_1001#7&1a6493e9&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"

Vendor=1DD2, Product=1001 (Version 1.35)

Manufacturer= Leo Bodnar

Product= BU0836X Interface

Serial Number= B10154

Usage Page: 1

Input Report Byte Length: 6

Output Report Byte Length: 0

Feature Report Byte Length: 18

Number of Link Collection Nodes: 3

Number of Input Button Caps: 1

Number of InputValue Caps: 1

Number of InputData Indices: 33

Number of Output Button Caps: 0

Number of Output Value Caps: 0

Number of Output Data Indices: 0

Number of Feature Button Caps: 0

Number of Feature Value Caps: 1

Number of Feature Data Indices: 1

Buttons range 1 -> 32 at indices 0 -> 31

Value POV at index 32, range 0 -> 7, using 4 bits

**************************************************************************

You say "I've a feeling that you are really outreaching your technical skills in these matters"

You maybe correct, but then this whole hobby has been a steep learning curve, that's what makes it enjoyable.

You also say "I'll try to help" for that I am very grateful. Rest assured I do not come for help unless I have tried every avenue I can think of.

I'll get stuck into the "HidDemo.lua", but will read up on it's use first.

Thanks

Dave

I

Link to comment
Share on other sites

I am refering to this list:

[JoyNames]

Yes, that is the list of joystick IDs which are assigned by Windows and recorded in the Registry. As I said, that has nothing whatsoever to do with the individual sequence numbers differentiating identicasl devices scanned in the USB list, many of which may not even be Joysticks as far as Windows is concerned. I honestly don't understand how you could get so confused. After all the comment in the Lua for your information did say:

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

Where is the ambiguity in that?

I have three BU0836X cards but only two have encoders attached, those named in the above list as 'B' and 'H'. I did not realise thyis was a windows ID list. I assumed it was the list that identified the joysticks as seen in FSUIPC.

It is both of those. But neither of those is what is described as the device number in the Lua HID device access. HID devices do NOT equate to joysticks only. For instance all of the individual Goflight modules are HID devices which can be programmed in Lua as such, but few of the normal modules show up as joysticks in Windows (the TQ6 being one notable exception).

I did use the HIDScanner here is the log

Okay. I've extracted the details for the three BU0836X boards you have connected, and they are all different: They will be devices 0, 1 and 2, but their inputs in the Luas will all be different. Here is a side by side comparison to show this clearly:

Input Report Byte Length: 8 OR 12 OR 6

Number of InputValue Caps: 2 OR 4 OR 1

Number of InputData Indices: 34 OR 36 OR 33

Buttons range 1 -> 32 at indices 1 -> 32 OR 3-> 34 OR 0->31

More tellingly are the differences in the analogue inputs shown:

Device 0:

Value X at index 0, range 0 -> 4095, using 16 bits

Value POV at index 33, range 0 -> 7, using 4 bits

Device 1:

Value U/RX at index 0, range 0 -> 4095, using 16 bits

Value Z at index 1, range 0 -> 4095, using 16 bits

Value X at index 2, range 0 -> 4095, using 16 bits

Value POV at index 35, range 0 -> 7, using 4 bits

Device 2:

Value POV at index 32, range 0 -> 7, using 4 bits

So, either all these are different, or you've wired them up differently and they then give different configuration information automatically. i honestly do not know which, but I'd guess the latter.

All of your buttons WILL be there somewhere, I guess, but you cannot assume they are the same numbers as those you see in Windows (and therefore in FSUIPC assignments). Quite honestly, the only way to proceed to is to find out. I'd do it using special tools. The only tool you have at your disposal is the HidDemo plug-in, with logging (which you'll need to ernable. But don't run it at the same time as any of the others. You'll have to adopt a methodical approach, operating each button or knob and noting what happens in the log for each in turn, and do this for each device, separately.

I'll get stuck into the "HidDemo.lua", but will read up on it's use first.

I'm afraid there's not much to "read up on". These Lua plug-ins were supplied as examples for programmers, not tools for beginners I'm afraid. Hopefully thee's enough in the way of comments to help.

Regards

Pete

Link to comment
Share on other sites

  • 1 month later...

Pete,

I have been tinkering with HidDemo.lua & rotaries.lua trying to increase the polling rate on a GoFlight GF-166. However, I have not made any headway at all in accomplishing this.

I am recalling that GF rotaries interact through GFDev.dll so I am assuming that is where my roadblock lies.

Nonetheless, is there a way that you know of whereby I can alter the polling rate of a GF-166?

Although the rotary speed is just fine when using GoFlight software, the rotary speed is terribly slow when working with Lua.

Have a great day!

Dan

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.