Jump to content
The simFlight Network Forums

pbrand

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by pbrand

  1. 14 minutes ago, John Dowson said:

    Hi Peter,

    ok, glad its now working (and a bit of a relief!). Thanks for the update.
    You could also try without the event.terminate, to see if that works in the latest version...or did you try that already?

    John

    Yes I tried the following:

    • Only the dll
    • The dll and TimeForLuaClosing=5
    • The dll and TimeForLuaClosing=5 and event.terminate

    Only the combination of all three seemed to work.

  2. 4 hours ago, John Dowson said:

    Hi Peter,

    sorry, but I think you tried the wrong dll - you used 6.1.1a (22nd April), whereas I would like you to try the latest added to that thread, which was 6.1.1f (2nd May). So before I look in detail at your scripts, could you first try that version, and any issues show me your FSUIPC6.log file again please. Just be be sure, here it is again:

    FSUIPC6.dll 495 kB · 0 downloads

     

    No, as they are not running then....

    But if you remove them from the [Auto] section, they aren't running!
    You should really add them to your [Auto.A2AC172] section - or whatever your A2A profile is called, assuming you have one. If not you should create one and use this. They would then only be started when you load the aorcraft that uses them.


    Try that dll, but I think there could be various threading/timing issues when starting the lua threads (which then start the coms) then you switch straight away, killing everything to restart.
     

    Of course, this is not to say that it shouldn't cause issues killing the scripts and restarting. I will look into this further if needed.

    John

     

    Hi John,

    Sorry, probably missed that latest version of the dll in the thread. I have tried the version you gave me now and it seems that, together with setting TimeForLuaClosing=5 and using event.terminate for com.close, it now works (using only the dll didn't do the trick) 🙂

    I have also followed up on your advice concerning a separate profile so now the lua scripts only auto run when the A2A C172 is loaded.

    I shall perform some more extensive testing to see if the error stays away.

    Thanks for the help! I will come back to this thread if I have more news after further testing. For now it's looking quite good sofar.

     

    Peter

  3. 9 hours ago, John Dowson said:

    Nice lua scripts you have written there!

    There are sometimes issues closing/killing luas that use the com library. First, could you please try the dll posted recently in this topic, which has a few improvements in this area:

     

    Also, check the value of your ini paramater TimeForLuaClosing  and maybe increase to 4 or 5.

    If you still have issues with that, you could add an event.terminate function where you can explicitly close your com connection (com.close).
     

    I have done all three things, John (one by one). Other dll, increased value for TimeForLuaClosing  and event.terminate. I no longer see a lua crashed in the log files. But p3d still hangs. I have put some debug message in the terminate function. And I can see that the com.close is called. But the ipc.log after the com.close is not present.

    Do you have any other things I can try? When I remove the luas from [Auto] it doesn't seem to crash anymore but of course that is not a real solution 😞

     

    Peter

     

    A2AC172RBravoAnn.lua A2AC172RBravoAp.lua A2AC172RBravoCommon.lua FSUIPC6.ini FSUIPC6.log

  4. 1 hour ago, John Dowson said:

    Nice lua scripts you have written there!

    There are sometimes issues closing/killing luas that use the com library. First, could you please try the dll posted recently in this topic, which has a few improvements in this area:

     

    Also, check the value of your ini paramater TimeForLuaClosing  and maybe increase to 4 or 5.

    If you still have issues with that, you could add an event.terminate function where you can explicitly close your com connection (com.close).
     

    Thanks for the compliment John 🙂. They are my first attempt at lua (c# developer myself) so not sure if it is 'the lua way' but I try to write maintainable and readable code.

    I shall try your suggestions tonight and come back with the results.

     

    Peter

     

  5. I hope someone can tell me if I'm doing something wrong, and if so what it is 🙂

    I have written some lua scripts for supporting the Honeycomb Bravo throttle. I have included them in the [Auto] section (two files) so they are auto loaded.

    I start p3d V5.1 with the default Mooney Bravo aircraft. When I then switch to the aircraft I want to use, the A2A C172, p3d crashes. The fsuipc logfile shows the following messages.

       167844 Lua threads being terminated:
       167844       1 = "D:\FlightSim\FSUIPC6\A2AC172RBravoAnn.lua"
       168000 LUA: "D:\FlightSim\FSUIPC6\A2AC172RBravoAnn.lua": killed
       168297 **** DevCom read/write threads still running - will exit anyway but could cause issues...
       168610 **** DevCom Read thread terminated
       168610 LUA.0: Crash C0000005 at 7FFB753F31A7: ""

     

    When I repeat the same procedure but with an empty [Auto] section, all is working fine. I can switch to the A2A 172 and p3d does not crash. 

    When I load only one file in [Auto] so either A2AC172RBravoAnn.lua or A2AC172RBravoAp.lua, then all seems to be working fine as well. So it seems to be that the lua scripts themselves do not contain errors?

    I hope someone can help me in how I can prevent the crash and use the lua scripts in fsuipc to operate correctly?

    I am of course not sure what the cause of the crash is.

    I have included the log, fsuipc.ini and the lua files. I hope that is enough info 🙂

     

    Peter

     

    Logs_etc.zip

  6. 5 minutes ago, Pete Dowson said:

    With encoders like your trim wheel you need to assign to both press and release -- each click is only a press or a release, alternately. That alone doubles the speed.

    You could also always alter the amount of trim from each press. There's a section on how to do that in the User Guide -- search for Offset Increment/Decrement Controls (it's on page 27 in my copy).

    If you want two different speeds of increase you'd need to use a Lua plug-in.  There's an example in your Example Lua Plugins document. It's called 'rotaries.lua'. It would need adapting for your device and needs.

    Pete

     

    Pete, I believe Offset Increment/Decrement Controls is just what I did in my example in the starting post?

    Your tip on press ánd release is great! That already helps a lot.

    I will also look into the rotaries.lua to see what I can do with that.

    Thanks for the help 🙂

     

  7. I am using p3d V5.1 with the trim wheel of the Honeycomb Bravo. The trim wheel is nothing more than two buttons which fire when moving the wheel. I have programmed the wheel to use an offset for trimming up/down:

    [Buttons]
    PollInterval=25
    ButtonRepeat=20,10
    3=R0,22,Cx32000BC0,x3FFF0040 	-{offset sword increment, offset 0BC0 (Incr=64, Limit=16383)}-
    4=R0,21,Cx42000BC0,xC0010040 	-{offset sword decrement, offset 0BC0 (Decr=64, Limit=-16383)}-
    

    This works just fine when moving the wheel slow. But when moving the wheel fast(er) the trim rate doesn't get much faster than moving it slow. I tried to enable the repeat option on the button but that has little to no effect. Perhaps because it isn't a fast repeat like when you have a button pressed but instead a slower repeat due to the rotation of the wheel?

    I would be grateful if someone knows how to increase the trim speed when moving the trim wheel faster.

    Regards,
    Peter

     

  8. @Paul actually I'm using a lua library provided by fsuipc. Don't know how that works under the hood and if it talks to the HID directly or via fsuipc.

    I have written some lua code to operate the LEDs on the Bravo. It is my first lua attempt and it works, but I found out that I'm not a great fan of lua. No strong typed variables etc. So I decided to have a go at it with c# since that is what I do for a living anyway 😄  I then came accross your library and thought it could do everything that fsuipc could but using .net. A clear misconception at my end and alas for me it doesn't. It's a great library but I need to do additional stuff in another way it seems.

    I could use a lua 'bridge' have to think about it. It would be easier but also contain lua 😎

     

    @Pete

    Your assumption is correct. You always test what you've done in the real environment of course. The development process itself looked easier using widefs which I purchased yesterday for that purpose. I shouldn't have done that now it seems 🤣

    Thanks for the tip about the debugging server! Hadn't thought of that. Shall look into that to see if you can also debug HID calls that way.

     

    Much to do and many thanks for your help Paul and Pete!

     

  9. Hi John,

    In the fsuipc client dll subforum I asked Paul about a possibility to identify a joystick based on vendor/product just as we can open a device in lua using those properties. Paul told me this currently isn't possible in the client dll because the information isn't available in the IPC interface.

    Pete then suggested some offsets could be added for this purpose and suggested I ask this in the main forum. The original conversation is in here.

    It would be nice if this feature could be added to FSUIPC (I use version 6).

    Kind Regards,
    Peter

     

  10. @paul

    Thanks Paul for your answer! You not only say it's not possible in the client dll but also give me a possible solution on how to get the information. Much appreciated! I have no experience with joy stick programming so your example code for SharpDX is very helpful and I will have to look into that further (Google is my friend 😄). Although it's a bit unfortunate I have to use such a library since I am now using widefs client to develop because I don't have Visual Studio 2019 installed on my flight sim computer. SharpDX will of course not work (I guess) if I'm not on the flight sim computer itself...

    On that same level: The Honeycomb Bravo LEDs are controlled (in the lua script I wrote) with com.readfeature and com.writefeature. I guess those commands are also not available in the fsuipc client dll then?

     

    @Pete

    Thanks for your additional info. It's very helpful in identifying the joystick. I think it could be very helpful if vendor/product would be available. Especially since I am using widefs client because I don't develop on my flight sim computer. I shall post a request in the main forum. I'm using FSUIPC6 🙂

     

    Peter

  11. I am a fresh user of the client dll. I am looking at the examples and very nice that they are there because many questions are answered by looking at them! However I could not find an answer to the following.

    When using lua in fsuipc you can open a device with something like

    local honeycombBravoDevice = {
          Vendor  = 0x294B -- Honeycomb Bravo vendor id
        , Product = 0x1901 -- Honeycomb Bravo product id
        , Number  = 0      -- Multiple devices of the same name need increasing Device numbers
        , Report  = 0      -- I *think* all joystick types use Input Report 0
    }
    
    local dev, rd, wrf, wr, init = com.openhid(honeycombBravoDevice.Vendor, honeycombBravoDevice.Product, honeycombBravoDevice.Number, honeycombBravoDevice.Report)

    Based on the vendor and product you now have access to the correct device.

    In the client dll I can use 

    FSUIPCConnection.UserInputServices.AddJoystickButtonPress("Btn0", joystickNumber, buttonNumber, StateChange.Both);

    Here you have to specify the joystick number. I don't know which joystick number the real device has (I'm trying to make it usable for other users with other configurations).

    Is there a possibility in the client dll to determine the joystick number based on vendor/product (or some other unique identifier)?

    If not, then I shall have to use a configuration file to define which joystick number to use but hoping I don't have to 🙂

    Regards,
    Peter

     

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