Jump to content
The simFlight Network Forums

Tom_G_2010

Members
  • Posts

    73
  • Joined

  • Last visited

Posts posted by Tom_G_2010

  1. 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
    

  2. 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.

  3. Now here's a problem. I don't understand at all what you are saying you are doing here. How exactly are you "pointing" the encoder this way?

    Sorry for any confusion, by that I meant buttons 3.30 and 3.31 are defined in the FSUIPC config as follows:

    71=P3,30,CL1:R,0
    72=P3,31,CL1:R,0

    Should I be removing those lines? I thought that was what triggered the lua script, but now reading that it runs in a continuous loop in the background I'm questioning that.

    So, at some time, you changed your whole method of doing things for some reason, and i now don't understand what you are up to. I think you'll need to go through it, step by step, and tell me EXACTLY what you are doing now and what you have changed since it was all nearly working . . .

    In the process of trouble shooting I may have made an inadvertent change, or done something that I'm not recalling, but nothing intentional. When I get home I will be restarting from scratch and re-doing everything, to include reloading the original script , and subsequent logging modification. I'll document step by step and if I'm not able to resolve it I'll post all the steps I took and all the logs to be sure I'm not leaving anything unaccounted for.

    If you want to use the Lua script I provided originally to someone else for the purpose of detecting fast and slow turning rotaries, then you really must use it in the way suggested for it. It works for all the other users I know using it. Why or how you are getting into a complete mess with it is bewildering me. Each time you post things are worse and less explainable!

    Pete your patients and assistance have been above and beyond the call of duty!!!

    As for my efforts, while I've been away from it for a few years (the curse of being pulled into management) I'm a degree'd EE with experience in design, prototyping, fabrication, and trouble shooting. This encoder project has left me feeling a bit inadequate. I feel about as clueless as I was back in my first freshman year lab back in the 80's...

    Again, thanks for your help on this!!! I'll be back at it with a fresh start when I get home on Tuesday.

  4. Pete,

    I really appreciate your time on this, and I'm trying to post all the information I can here. I'm wracking my brain trying to figure out what key trouble shooting element I'm missing that I could add to what I've posted.

    Diode info came from Leo's site here where he states that diodes should be used if 3 or more switches may be left in an on condition rather than just pulsing. I have some switches that will so I installed the diodes.

    Here's some of the info from that page:

    full 6x6 matrix
    • connects to six ROWS and six COLUMNS pins on the controller...
    • ..with diodes if there will be 3 or more contacts activated simultaneously, e.g. if you use ON/OFF switches
    • ..no diodes if buttons used only momentarily like most joysticks
    • First 32 buttons are standard buttons
    • Last 4 contacts make up 8-direction point-of-view hat (coolie) switch
    • Literally any diodes can be used - 1N4148 or 1N4004 are good ones

    6x6.png
    What is puzzling me is that it's only the lua scripts that don't seem to see the buttons consistently???.
    1. I can see the encoder buttons pulsing in the FSX calibration utility and trigger functions with the encoder from the native FSX control settings. I set the encoder buttons to pan views left and right to check this and it works.
    2. I can see the encoder buttons come up on the FSUIPC Options Button tab and trigger FSUIPC functions with the encoder. I used the encoder to rotate the heading bug using fast dec and fast inc and it works
    3. When I point the encoder back to the lua script it's triggering the script. But the script doesn't seem to be seeing the buttons. At least I believe that's what the logs are telling me.

    • The FSUIPC log shows the button events are launching the script but the script is getting killed
        86518 Button changed: bRef=0, Joy=3, Btn=30, Pressed
        86518 [Buttons] 71=P3,30,CL1:R,0
        86971 LUA: "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua": killed
        86971 Button changed: bRef=0, Joy=3, Btn=30, Released
        88063 Button changed: bRef=0, Joy=3, Btn=31, Pressed
        88063 [Buttons] 72=P3,31,CL1:R,0
        88515 LUA: "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua": killed
        88515 Button changed: bRef=0, Joy=3, Btn=31, Released
    


    But, when I look at the HIDDemo or IPCReady log as you saw in my post above they aren't seeing the buttons ???
    This is my first venture into encoder use, so maybe I'm missing something there...

    1. Based on the encoder spec sheet and what I read on Leo's site I have the correct pins connected to the correct inputs as if it where switch 31 and 32 in the diagram above.
    2. The A and B pins of the encoder are connected to the column 1 and 2 in the diagram above
    3. The common pin is connected to Row 6. I tested that with and without the diode
    4. I used his encoder flash utility to to set pair 31/32 as an encoder input at 1:1 and left the pulse width at the default of 48ms

    Questions I have that I'll attempt to answer when I get back home:

    1. Could reversing the encoder connections row vs. column make any difference?
    2. Is the 48ms pulse width an issue? Should it be longer or shorter?
    3. If I remove all the code from the current IPCReady script and come up with some simple script that does a single and observable rudimenentary function does it show in the log and can I see the action in FSX?
    4. What might be preventing the button inputs that FSX and FDUIPC be can see from getting through to the lua script ???

    Pete, any further observations or ideas would be greatly appreciated!!!

  5. Okay.

    Hopefully we can resolve it before next Friday (14th) as I'm then away till the 25th.

    Regards

    Pete

    Pete,

    Making one last attempt before leaving town. Might be in trouble with the wife for not helping to pack, but the encoder problem is bugging me more than she'll be scolding me so . . . icon_mrgreen.gif

    I cleared all the connections from my bodnar board and have just the one encoder hooked up with a new (and tested) diode. That should eliminate wiring questions. and to prove to myself that the encoder was being read I did the following:

    • I checked it against the stock calibration/test window in FSX and can see the correct button pulses on 31 and 32 (Joy 3.30 and 3.31) in the test window
    • I temporarily configured Joy 3.30 and 3.31 in the FSUIPC config to do other FSX functions and they were able to trigger those functions. Then pointed them back at LuaIPCReady
    • I turned on the FSUIPC log and can see both buttons come up with the corresponding rotation, but as seen below it's executing the Lua script is being killed.
    • "LUA: "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua": killed"
    • And with the logging lines in the script it returned the same four log entries for each click:

    ********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
        79233 System time = 06/10/2011 20:42:33, Simulator time = 20:42:04 (00:42Z)
        79233 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
        80481 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
        80481 System time = 06/10/2011 20:42:34, Simulator time = 20:42:05 (00:42Z)
    ********* LUA execution terminated: Log Closed *********
    

    And the HidDemo log shows this now:

    ********* LUA: "HidDemo" Log [from FSUIPC version 4.734] *********
        68469 System time = 06/10/2011 20:42:22, Simulator time = 20:41:53 (00:41Z)
        68469 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\HidDemo.lua"
        68578 LUA: Device has 1 x Hat axis, Max= 7
        68656 LUA: Hat = 15 0 0 0
        93585 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\HidDemo.lua"
        93585 System time = 06/10/2011 20:42:47, Simulator time = 20:42:18 (00:42Z)
    ********* LUA execution terminated: Log Closed *********

    Unfortunately no movement on the heading bug, but that seems to be in line with the log entries above if I'm understanding it all correctly.

    That's about all I can sneak in tonight. I'll be sure to check for any replies over the weekend, and I'll be back at the test bench on Tuesday evening.

    Thanks for all your help, and have a great weekend!

    Tom G.

  6. Pete,

    I may have a bad diode in my wiring. After I changed the logging code I was getting some strange results that pointed back to an electrical issue so I went back to retest all the wiring. I'm using diodes on my bodnar board as suggested on leo's web site, but I'm starting to notice some intermittent results on a couple inputs. I'm going to go back and retest the diodes and replace anything questionable and double check the wiring and pick up after that. May be past the weekend though as I'll be out of town for a couple days. I'll post again when I have that done and can retest.

    Thanks!

    Tom G.

  7. Pete,

    I setup the HidDemo.lua on a spare toggle switch on my instrument panel. I started the hiddemo, turned my encoder 2 clicks ccw and 2 clicks cw and stopped the hiddemo.

    The HidDemo.log shows this:

     ********* LUA: "HidDemo" Log [from FSUIPC version 4.734] *********
      1729037 System time = 05/10/2011 23:42:16, Simulator time = 23:36:51 (03:36Z)
      1729037 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\HidDemo.lua"
      1729162 LUA: Device has 1 x Hat axis, Max= 7
      1729271 LUA: Hat = 15 0 0 0
      1751673 LUA: Buttons= 80000000 0 0 0 0 0 0 0
      1751751 LUA: Buttons= 0 0 0 0 0 0 0 0
      1754028 LUA: Buttons= 80000000 0 0 0 0 0 0 0
      1754059 LUA: Buttons= 0 0 0 0 0 0 0 0
      1756618 LUA: Buttons= 40000000 0 0 0 0 0 0 0
      1756649 LUA: Buttons= 0 0 0 0 0 0 0 0
      1758365 LUA: Buttons= 40000000 0 0 0 0 0 0 0
      1758427 LUA: Buttons= 0 0 0 0 0 0 0 0
      1766118 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\HidDemo.lua"
      1766118 System time = 05/10/2011 23:42:53, Simulator time = 23:37:27 (03:37Z)
    ********* LUA execution terminated: Log Closed *********
    

    The corresponding events in the FSUIPC log show this:

     1729037 Button changed: bRef=0, Joy=2, Btn=2, Pressed
     1729037 [Buttons] 27=P2,2,CL2:R,0
     1729271 WRITElua 3BBE,   2 bytes: 92 08                                            ..
     1751501 Button changed: bRef=0, Joy=3, Btn=31, Pressed
     1751501 [Buttons] 72=P3,31,CL1:R,0
     1751579 Button changed: bRef=0, Joy=3, Btn=31, Released
     1751673 WRITElua 3340,   4 bytes: 00 00 00 80                                      ....
     1751751 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
     1753857 Button changed: bRef=0, Joy=3, Btn=31, Pressed
     1753857 [Buttons] 72=P3,31,CL1:R,0
     1753888 Button changed: bRef=0, Joy=3, Btn=31, Released
     1754028 WRITElua 3340,   4 bytes: 00 00 00 80                                      ....
     1754059 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
     1756399 Button changed: bRef=0, Joy=3, Btn=30, Pressed
     1756415 [Buttons] 71=P3,30,CL1:R,0
     1756446 Button changed: bRef=0, Joy=3, Btn=30, Released
     1756618 WRITElua 3340,   4 bytes: 00 00 00 40                                      ...@
     1756649 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
     1758193 Button changed: bRef=0, Joy=3, Btn=30, Pressed
     1758193 [Buttons] 71=P3,30,CL1:R,0
     1758225 Button changed: bRef=0, Joy=3, Btn=30, Released
     1758365 WRITElua 3340,   4 bytes: 00 00 00 40                                      ...@
     1758427 WRITElua 3340,   4 bytes: 00 00 00 00                                      ....
     1765666 Button changed: bRef=0, Joy=2, Btn=2, Released
     1765666 [Buttons] 74=U2,2,CL2:K,0
     1766118 LUA: "HidDemo.lua": killed
    

    I also setup the logging entry you suggested in IPCReady.lua (these are lines 52, 53, and 54 of that file.

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

    For those same 4 encoder clicks the log is returning an error related to line 53 (the ipc.log line) as follows:

     ********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
      1751501 System time = 05/10/2011 23:42:38, Simulator time = 23:37:13 (03:37Z)
      1751501 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1751501 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua:53: ')' expected near 'PrevButtons'
      1751501 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1751501 System time = 05/10/2011 23:42:38, Simulator time = 23:37:13 (03:37Z)
    ********* LUA execution terminated: Log Closed *********
    
    ********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
      1753857 System time = 05/10/2011 23:42:41, Simulator time = 23:37:16 (03:37Z)
      1753857 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1753857 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua:53: ')' expected near 'PrevButtons'
      1753857 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1753857 System time = 05/10/2011 23:42:41, Simulator time = 23:37:16 (03:37Z)
    ********* LUA execution terminated: Log Closed *********
    
    ********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
      1756415 System time = 05/10/2011 23:42:43, Simulator time = 23:37:18 (03:37Z)
      1756415 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1756415 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua:53: ')' expected near 'PrevButtons'
      1756415 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1756415 System time = 05/10/2011 23:42:43, Simulator time = 23:37:18 (03:37Z)
    ********* LUA execution terminated: Log Closed *********
    
    ********* LUA: "ipcReady" Log [from FSUIPC version 4.734] *********
      1758193 System time = 05/10/2011 23:42:45, Simulator time = 23:37:20 (03:37Z)
      1758193 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1758193 *** LUA Error: ... (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua:53: ')' expected near 'PrevButtons'
      1758193 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"
      1758193 System time = 05/10/2011 23:42:45, Simulator time = 23:37:20 (03:37Z)
    ********* LUA execution terminated: Log Closed *********
    

  8. Pete,

    Thanks for your patients and help with this. I added the IgnoreThese statement, and made sure all the buttons showed in the INI file, but I'm still not getting clockwise action.

    My encoder is coming in through button inputs 30 and 31. 30 is ccw and 31 is cw.

    In the FSUIPC INI file I added "IgnoreThese=3.30, 3.31"

    The following buttons are defined in association with this

    77=P3,31,CL3:R,0

    78=P3,30,CL3:R,0

    and

    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

    I'm getting a little bit better understanding of the code, but still haven't digested it all. I'm not sure if I understand how it increments the button assignments for Joy 64. 64 0 and 64 1 are working for the ccw dec and fast dec rotation. Are 64 2 and 64 3 the correct next assignments for inc and fast inc cw rotation?

    When looking at the Button tab in FSUIPC Options the ignore statement has taken out the hits on 30 and 31 as you indicated it would. When I rotate the encoder counter clockwise I see Joy# 64 Btn# 0 and Btn# 1 come up, but when I turn it clockwise it's not giving me anything.

    I greatly appreciate any assistance you can offer.

    Tom G.

  9. Pete,

    Sorry for the confusion. I realized my mistake with the script and must have been editing my post when you were replying. At this time I'm running the more up to date script. you posted and the current release of FSUIPC. It's working for counter clockwise rotation. Sometimes on the first click I get a fast dec instead of a dec, but after that I get expected behavior. Other than that first click all seems good counter clockwise.

    But, I'm not getting anything when turning clockwise. When I look at the buttons tab in options I see Joy# 64 Btn# 0 and Btn# 1 come up as I turn the encoder counter clockwise, but when I turn it clockwise all I get is my device Joy# 3 Btn# 31.

    Here's the debug log from 1 ccw click and one cw click.

    ********* LUA: "ipcDebug" Log [from FSUIPC version 4.734] *********

    113522 System time = 02/10/2011 14:43:58, Simulator time = 14:43:30 (18:43Z)

    113522 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcDebug.lua"

    113522 LUA: 0

    113522 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    113522 LUA: return

    113522 LUA:

    113522 LUA: 0

    113522 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    113522 LUA: call

    113522 LUA:

    113522 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua:38

    113522 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcDebug.lua"

    113522 System time = 02/10/2011 14:43:58, Simulator time = 14:43:30 (18:43Z)

    ********* LUA execution terminated: Log Closed *********

    ********* LUA: "ipcDebug" Log [from FSUIPC version 4.734] *********

    147826 System time = 02/10/2011 14:44:32, Simulator time = 14:44:04 (18:44Z)

    147826 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcDebug.lua"

    147826 LUA: 0

    147826 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    147826 LUA: return

    147826 LUA:

    147826 LUA: 0

    147826 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    147826 LUA: call

    147826 LUA:

    147826 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua:38

    147826 LUA: ended "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcDebug.lua"

    147826 System time = 02/10/2011 14:44:32, Simulator time = 14:44:04 (18:44Z)

    ********* LUA execution terminated: Log Closed *********

    And, Here's the script:

    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)

    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")

  10. Thanks

    I was using the code from the older post dated 10 May 2011 - 07:41 AM, above. I've now replaced that with the updated code from the 14 June 2011 - 06:58 AM post. Sorry for the confusion.

    Before figuring out my blunder though I found the code causing the error on line 34 of the 10 May 2011 - 07:41 AM reads "data, n = com.readlast(dev, rd)" Reading the library reference doc I find a routine template for n = com.read (handle, max) but no reference to a variant called "readlast". Hope I'm reading the most up to date doc.

    Since replacing it with the code with what you posted on 14 June 2011 - 06:58 AM and editing line 9 to match my encoder buttons "Rotaries = {31, 30}" here's what I am getting:

    ********* LUA: "ipcReady" Log [from FSUIPC version 4.70b] *********

    10765973 System time = 02/10/2011 11:06:03, Simulator time = 10:31:55 (14:31Z)

    10765973 LUA: 0

    10765973 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    10765973 LUA: return

    10765973 LUA:

    10765973 LUA: 0

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    10765988 LUA: call

    10765988 LUA:

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua:38

    10765988 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:1

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:2

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:3

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:9

    10765988 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:15

    10767018 >>> Thread killed <<<

    10767018 System time = 02/10/2011 11:06:04, Simulator time = 10:31:56 (14:31Z)

    ********* LUA execution terminated: Log Closed *********

    Still not seeing any activity from the virtual buttons.

  11. Pete,

    I'm attempting the same encoder setup as Reid and haven't got it working yet. I'm reading (and re-reading) the thread to see if I can glean more, but not getting very far. I'm going to start experimenting with the timing values after I get a few hours sleep, but this is what the debug log is giving me so far:

    ********* LUA: "ipcReady" Log [from FSUIPC version 4.70b] *********

    52051995 System time = 02/10/2011 01:34:56, Simulator time = 01:07:00 (05:07Z)

    52051995 LUA: 0

    52051995 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    52051995 LUA: return

    52051995 LUA:

    52051995 LUA: 0

    52051995 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua

    52051995 LUA: call

    52051995 LUA:

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcDebug.lua:38

    52052011 LUA: beginning "C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\Modules\ipcReady.lua"

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:1

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:2

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:3

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:5

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:6

    52052011 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:8

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:10

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:18

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:22

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:26

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:27

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:28

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:29

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:69

    52052136 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:32

    52052151 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:71

    52052198 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:34

    52052198 *** LUA Error: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:34: attempt to call field 'readlast' (a nil value)

    52052229 LUA: ...es\Microsoft Flight Simulator X\Modules\ipcReady.lua:34

    From a single click of the decoder I got the above plus about 400 repeats of the error message on the last two lines.

  12. Peter,

    Thanks for the info. Until yesterday it had been 29 years (to the day) since I logged my last hour in the left seat. I'm another one who started but never finished their Private Pilot's license. Yesterday, as a birthday gift my wife booked me an hour in a 172SP with a CFI. Having gotten back in a real plane yesterday much about control reaction, feel. and feedback, including rudder feel and action while taxiing have come back to me. As you suggest I think much of what I'm feeling is prop wash and perhaps some less than convenient winds.

    After yesterday I am am convinced of a couple things:1. I will be looking for the cash to finish my pilots license; 2. For any Sim pilots who've never been in the left seat for real, an hour or two with a CFI in a real plane will make a HUGE difference in how they configure and use their SIM. Yesterday now has me thinking about Force Feedback for my flight controls and how to further enhance the out the window view so I can reduce my tendency to overuse of instruments. Of course the new twist is how to do that without taking cash away from my new Private Pilot's fund...

    I do think a couple of my planes have less than realistic modeling related to rudder and nose wheel interaction and you've given me an idea of how I might deal with it. I'll be adding a second potentiometer to my rudder pedals (the advantage of DIY flight controls) to allow for splitting of the function/calibration where needed while still maintaining the realizm of sterring from the pedals.

    Tom G.

  13. I fly mostly GA aircraft so, of course, my rudder pedals control both the rudder and the nose wheel. On some aircraft I'm finding that the two seem out of sync. With the pedals centered (I checked this physically on my pedals, visually in the 3d cockpit, and the calibration values in FSUIPC seem to agree) the planes rudder shows centered, but while taxing (with winds calm) the plane is pulling to one side quite a bit and I have to kick in a fair amount of rudder to taxi straight.

    Is it possible to get separate calibration for each function? Could I assign both the rudder and the tiller function to the same axis and calibrate each differently?

  14. Pete,

    It is for an Add On, I run a TrackIR 5 Pro and use my F2 key to suspend tracking when needed. And, I did read your documentation, in fact I have it printed out in a binder with my other flight sim apps so I can make notes on it etc. Nothing I found in the docs indicated this shouldn't work, hence my puzzlement and the reason I posted here.

    One thing you said in your reply caught my attention ". . . or something else you are running is stealing the keypress before FSUIPC can see it?" As it turns out the very Add On I wanted to control was stealing the key press ahead of FSUIPC4. So, I shut down TrackIR, booted up FSX, and sure enough I was able to map F2 to my joystick button. I reloaded the TrackIR and now the joystick button sends the F2 and controls TrackIR just as I want it to.

    I've made Note of this on my documentation for future reference.

    Thanks again for your support!!!

    Tom G.

  15. I have the buttons on my yoke programmed as various aircraft functions with two exceptions. I have a button on the left hand grip set to press and release the cap lock key for radio use in multi-player. And I tried to program the button on the right hand grip to send F2. But I can't seem to figure out how.

    Can FSUIPC send function keys based on a joystick button? If so how do I program that? I attempted to use the "set" button like I did to capture the cap-lock key for the other button but that would not work as it did not seem to see the key press when I hit F2. If it can send a function key, how do I program that?

    Thanks!

    Tom G.

  16. Pete,

    Thanks! I thought that might be the case but wanted to cover all bases as I'm still learning how FSUIPC4 works.

    I have posted on their forum and when I did I noticed some other threads where ASE behaviour changed after FSUPC was installed. However I also just did a quick test by disabling FSUIPC4 and ASE still does not load configured weather, only live weather... Off to add that fact to my other post and try to figure out what else might have changed at the same time.

    Thanks again for the quick response.

    Tom G.

  17. I've been running Active Sky Evolution for a few months now and recently added FSUIPC4 (to control an new throttle quad). I'm running FSX on Win 7 64bit. Since loading FSUIPC4, if I configure weather and try to load it to FSX nothing changes other than the automated downloads stop as they should, but nothing changes to show the weather I configured. ASE seems to work on automated downloads (at least the initial load). But not on manually configured weather.What in FSX, FSUIPC4, or ASE might cause this?

    Tom G.

  18. I just started using FSUIPC4 with FSX. It's running on an HP with Win 7 64bit, a Core I5, and 6 gigg of ram.

    I have a switch panel that is running off the electronics from from a logitec joystick. I am trying to get the com and nav radio audio selectors to work but running into problems.

    I can select the button and then use the drop down to add the function, but it will not stay programmed. As soon as I click ok or select the next button the function goes blank on the one that was just set. I tested the button with several other functions and it works properly, but the sound toggles won't stay????

    Here are the functions I selected from the drop down that won't stay programmed:

    Nav1 Sound Toggle

    Nav 2 Sound Toggle

    ADF Sound Toggle

    DME Sound Toggle

    I thought maybe I could edit the config file directly so I pulled up the FSX Controls list and to my surprise none of those functions are listed. I checked the alpha listing closely and did my best to scan the numeric list but could not find them.

    Has anyone else run into this? Is this a known issue or is it just me? Is there a fix or work around?

    Tom G.

    Quick update: did a full reload of everything FSX and FSX related All other functions seem to work, still no luck with sound toggles...

    Could really use some help on this one.

×
×
  • 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.