Jump to content
The simFlight Network Forums

joeherwig

Members
  • Posts

    73
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by joeherwig

  1. Just one addition... 

    If i could just add the calculator code as free text directly to a btn press/release or axis range without the (my) events.txt in between, it would also be a huge improvement. I suppose this would be also ways easier to implement. 

    Currently it seems that we're adding the presetName from (my)events.txt, writing it to the FSUIPC7.ini and on btn event it needs to be resolved again to send the calcCode from the txt. 

    Having the option to directly paste in just the calccodes i retrieved for instance from the hubhop.mobiflight.com and keeping that in the FSUIPC7.ini might be an option for you as well. 

    Joe

     

  2. On 5/14/2023 at 1:25 PM, John Dowson said:

     There are issues involved  if the tree selection was used to filter the preset drop-down by aircraft or aircraft sub-system, For example, when a button is pressed, any exisiting assignment on that button needs to be displayed, and this could be to a preset that is not in the filtered list.

    Got it. I'm sure you'll find a helpful way somehow that improves the performance and ease of selecting of the presets or showing them - if already assigned - in the context of which vendor/aircraft/system. 

    Thanks for the again super fast response. 

  3. On 5/12/2023 at 11:37 AM, John Dowson said:

    I could add a button that pops-up a tree-view window, and then the selection made there could populate the drop-down selection.

    I like that idea especially if that tree selection would keep the selection until deliberately changed. Then the dropdown/combobox would just hold the stuff of the single selected aircraft I'm currently working on. 

    Really a brilliant idea. 😎👏👍

  4. Hi John, 

     

    I see, you've already a couple of great ideas for improvements for that topic in one of the next releases. Really cool. Looking forward for it. 

    Btw. There has been a new (beta) of the websocket server released by Paul Henty which resolves a couple of stability issues. Would be great, if you could pack it with the next FSUIPC7 update as well. 

    All the best to you guys, 

    Joe

  5. Hi John,

    Just wanted to get back to this one...
    Over time even with a reduced myevents.txt with "just four aircraft plus the MSFS generics, i get nearly 3000 lines.
    Assigning presets is still not very comfortable as it is often hard to distinguish which one is the right.
    Nearly no chance without having the txt open in an editor aside. And even then it's hard as the dropdown always loads quite long until I'm able to key-in what i want.

    As the source of mobiflight seems to structure the stuff like 

    //SimWorks Studios/Kodiak 100/Engine
    Kodiak_100_Ignition_Off#0 (>L:SWS_ENGINE_Switch_Ignition_1, Bool)
    Kodiak_100_Ignition_On#1 (>L:SWS_ENGINE_Switch_Ignition_1, Bool)
    Kodiak_100_Ignition_toggle#(L:SWS_ENGINE_Switch_Ignition_1, Bool) ! (>L:SWS_ENGINE_Switch_Ignition_1, Bool)
    KODIAK_100_IGNITION_SWITCH_OFF#1 (>K:TURBINE_IGNITION_SWITCH_SET1)
    KODIAK_100_IGNITION_SWITCH_ON#2 (>K:TURBINE_IGNITION_SWITCH_SET1)
    KODIAK_100_IGNITION_SWITCH_TOGGLE#1 2 (A:TURB ENG IGNITION SWITCH EX1:1, enum) 2 == ? (>K:TURBINE_IGNITION_SWITCH_SET1)
    
    //SimWorks Studios/Kodiak 100/Engines
    Starter_Switch_Hi#2 (>L:SWS_ENGINE_Switch_Starter_ThreeState_1, Enum)
    Starter_Switch_Off#1 (>L:SWS_ENGINE_Switch_Starter_ThreeState_1, Enum)

    Would it probably be an option to use a combination of a treeview and a combobox which lazy-loads the available functions just after entering the leaf in the tree view?

    image.png.c3cf9414e7ac90ac1ddbcb24f51453f9.png
    It would definitely speed up the process of finding the right presets.

    Of course I'm also open for any other options that help to work with the brillant feature of having Presets.
    I'd also add them directly into the FSUIPC.ini by text editor if I could easier grab the colored stuff:
    image.png.fed68cd6efd7e877a6e02bb0b9576197.png

    especially the device (Joystick and Button) stuff behind the line index (does it have a purpose?) and the preset name.
    The rest seems to be parameter and the static identifier to use the preset.

    So if I could "copy" from the assignment-page somehow the Device+Button it would help at least a bit.

    Sorry for bothering again,

           Joe

     

  6. Ah... I suppose also about the timing stuff...

    Sending the following (looped through) commands fast one after another,

    {"command":"vars.calc","name":"calcCode_wifinode-overhead_1","code":"(A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:2)","interval":200}
    
    {"command":"vars.calc","name":"calcCode_wifinode-overhead_2","code":"(A:FUELSYSTEM PUMP SWITCH:5, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:5)","interval":200}
    
    {"command":"vars.calc","name":"calcCode_wifinode-overhead_3","code":"(A:FUELSYSTEM PUMP SWITCH:1, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:1)","interval":200}
    
    {"command":"vars.calc","name":"calcCode_wifinode-overhead_4","code":"(A:FUELSYSTEM PUMP SWITCH:4, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:4)","interval":200}
    
    {"command":"vars.calc","name":"calcCode_wifinode-overhead_5","code":"(A:FUELSYSTEM PUMP SWITCH:3, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:3)","interval":200}
    
    {"command":"vars.calc","name":"calcCode_wifinode-overhead_6","code":"(A:FUELSYSTEM PUMP SWITCH:6, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:6)","interval":200}	

    I get 

    {
      "command": "vars.calc",
      "name": "calcCode_wifinode-overhead_1",
      "success": true,
      "errorMessage": null,
      "errorCode": null
    }

    which is fine. But afterwards I receive a couple of times the following:

    {
      "command": "Unknown",
      "name": "Unknown",
      "success": false,
      "errorMessage": "Additional text encountered after finished reading JSON content: {. Path '', line 1, position 355.",
      "errorCode": "BadMessage"
    }

    Unfortunately without the "wrong" JSON content nor the command nor its name.
    So it's hard to check for me.

    Joe

  7. Hm... 

    Tried it a lot right now...
    Seems to be a timing issue as well when the vars.calc is sent. So if I wait inbetween it seems to work.
     

    function sleep(delay) {
        var start = new Date().getTime();
        while (new Date().getTime() < start + delay);
    }
    
    let calc = {
        command: "vars.calc", 
        name: "calc", 
        code: "(A:FUELSYSTEM PUMP SWITCH:2, Enum) (>L:A20N_FUELSYSTEM_PUMP_SWITCH:2)", 
        interval: 200
    };
    
    let calc2 = {
        command: "vars.calc",
        name: "calc2",
        code: "(A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:2)",
        interval: 200
    };
    
    let declare = {
        command: "vars.declare",
        name: "myVarSet",
        changesOnly: false,
        vars: [
            { name: "A20N_FUELSYSTEM_PUMP_SWITCH:2" },
            { name: "A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED"},
            {name: "A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:2"},
            {name: "A32NX_OVHD_INTLT_ANN"},
            {name: "A20N_CIRCUIT_BREAKER_GENERAL_PANEL_ON"}
        ]
    }
    
    //let vars = {command: 'vars.list', name: 'list',notify: 'auto' }
    let read = {
        command: "vars.read",
        name: "myVarSet",
        changesOnly: false,
        interval:200
    }
    
    let socket = new WebSocket("ws://myIP:2048/fsuipc", "fsuipc");
    
    socket.onopen = function(e) {
      sleep(200); 
      socket.send(JSON.stringify(calc));
      sleep(2000); 
      socket.send(JSON.stringify(calc2));
      sleep(2000); 
      socket.send(JSON.stringify(declare));
      sleep(2000); 
      socket.send(JSON.stringify(read));
    };
    
    socket.onmessage = function(event) {
      console.log(`[message] Data received from server: ${event.data}`);
    };
    
    socket.onclose = function(event) {
      if (event.wasClean) {
        console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
      } else {
        console.log('[close] Connection died');
      }
    };
    
    socket.onerror = function(error) {
      console.log(`[error] ${error.message}`);
    };

    Regarding the crashes...

    You can reproduce it, if you send in an CalcCode causing an error and you get the Message 

    Quote

    [ERROR]: Error setting Client Data Calculator Code: '...

    and then try to "Reload" from that tab, in my case it freezes the application reproduceable.
    image.thumb.png.de29ffd9bfd463d38b05020727207eac.png

    To avoid that, I first stop the Websocket on the "Web Services" Tab, then do the "Reload" and afterwards re-enable the Web Socket serving and need to reconnect.
    Not sure, whether that makes sense... But at least it helped.

    As long as I only update the vars.calc with codes that do not cause throwing errors within the application UI I can confirm, that I can update hundreds of Times without Issues.

    For me it seems that sending a faulty CalcCode will be the "calcCode of death" ;-).
    So probably there's room for improvement on error-handling.

    What about checking whether a CalcCode is throwing the above error and then stopping with sending it again and just displaying something like the above just once?
    Probably the timing-issue can be fixed as well. The same code sometimes works and sometime doesn't... Waiting long enough solves it.
    It would be really helpfull, if there is a timing issue with the variable service on sim side, if the Websocket server could ensure the required delay before pushing the received commands to the sim.

    Hope that helps a bit. And keep up the great work! 
    Really love working with it. The options it provides are really great!

    Joe
     

  8. Take the FBW A32nx. 

    On the overhead the fuel tank pump 1 left

    Check the updating of the (off) LED annunciator which should only be on, if the bus is powered and the fuse is in and either the pump is off or the annunciator light testis active. 

    According to hubhop. Mobiflight there is an working output calccodee but i tried simpler ones as well.. 

     

  9. That's really great Paul. Thanks a lot!

    Probably it also helps to get this unhandled exeption error that has been thrown by the Websocket-Server:

    Quote

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidOperationException: Value Dispose() cannot be called while doing CreateHandle().
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at FSUIPCWebSockets.Server.GUI.ctlPanel.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at FSUIPCWebSockets.Server.GUI.frmMain.setPanel()
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4614.0 built by: NET48REL1LAST_B
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
    ----------------------------------------
    FSUIPCWebSocketServer
        Assembly Version: 1.1.1.24
        Win32 Version: 1.1.1.24
        CodeBase: file:///H:/FSUIPC7/Utils/FSUIPCWebSocketServer.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4550.0 built by: NET48REL1LAST_C
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4605.0 built by: NET48REL1LAST_C
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4390.0 built by: NET48REL1LAST_C
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Configuration
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Core
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4605.0 built by: NET48REL1LAST_C
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4084.0 built by: NET48REL1
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Numerics
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4084.0 built by: NET48REL1
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
    ----------------------------------------
    System.Runtime.Serialization
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4536.0 built by: NET48REL1LAST_C
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
    ----------------------------------------
    System.Data
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.4584.0 built by: NET48REL1LAST_B
        CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.

    It's quite strange...
    If I setup for instance 

    {command: "vars.calc", name: "calc", interval: 200, code: "(L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED) 1 == (A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == + d (>L:A20N_FUELSYSTEM_PUMP_SWITCH_OFF_ANNUN:F2)"}

    it works for quite well a while before it stops working and doesn't update the LVar anymore.
    within the logfile I couldn't find anything valuable. If I set the LogLevel to DEBUG, I get quite a lot of crashes... So sorry for being not more helpful at the moment.

    Joe
     

    FSUIPC_WASM.log

  10. @John Dowson, @Paul Henty

    On trying to debug it seems, that I struggle on "redefining" or "killing" my LVar definitions.

    Of course on setting the interval for the vars.calc using the Websocket Server I'm able to stop the updating.
    Setting and interval > 0 afterwards re-enables the auto updating as expected. 
    But when I again set a changed vars.calc definition with the same name and an interval > 0 and a new "calc" definition, it seems the old one is still active and can't be "redefined."

    The behaviour remains even after stopping and closing the websocket server, reloading the FSUIPC WASM (via FSUIPC Menu) and restarting the Websocket server.

    So after I set 

    {command: "vars.calc", name: "calc2", interval: 200, code: "(A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == d (>L:A20N_FUELSYSTEM_PUMP_SWITCH2)"}

    I'm getting 
    and then redefining it using 

    {command: "vars.calc", name: "calc2", interval: 200, code: "222 (>L:A20N_FUELSYSTEM_PUMP_SWITCH2)"}

    I'd expect to be the LVar set each 200ms to a value of 200 but I don't get that. It still toggles between 0 and 1 on setting the afore mentioned Simvar.
    So if I want to check the CalcCodes, I currently always need to at least stop the Websocket Server and then reload the WASM from within FSUIPC and restart the Server.

    1. Is there an working and easier option to reset the WASM and FSUIPC websocket and let them forget all the before commands including my LVars without restarting the sim and tools completely?

    I'd be happy to get an hint how to proceed best.

    Joe

  11. 11 hours ago, Paul Henty said:

    I need to know if the calculator code is not updating them, or if my server is just not sending them to you.

    Quote

    I'm not at the sim right now... But I noticed, that when I ran the calculator code via FSUIPC7 the change of the changed Lvar is not published to the subscribers. But if I read the LVar within FSUIPC7 it shows the correct value. 

    Hope, that helps at least a bit. I'll check asap and get back to you. 

  12. @Paul Henty hm... No idea, what happened.

    The above script doesn't retrigger the calculator codes reliable as it seems.
    The first read is correct, but afterwards I don't get any further updates.
    For offsets the regular updates are fine.

    btw:
    Also got with Version V1.1.1 of FSUIPC WebSockets Server:

    Quote

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidOperationException: Value Dispose() cannot be called while doing CreateHandle().
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at System.Windows.Forms.Control.Dispose(Boolean disposing)
       at FSUIPCWebSockets.Server.GUI.ctlPanel.Dispose(Boolean disposing)
       at System.ComponentModel.Component.Dispose()
       at FSUIPCWebSockets.Server.GUI.frmMain.setPanel()
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9139.0 built by: NET481REL1LAST_B
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
    ----------------------------------------
    FSUIPCWebSocketServer
        Assembly Version: 1.1.1.24
        Win32 Version: 1.1.1.24
        CodeBase: file:///C:/FSUIPC7/Utils/FSUIPCWebSocketServer.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9075.0 built by: NET481REL1LAST_C
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9139.0 built by: NET481REL1LAST_B
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9032.0 built by: NET481REL1
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Configuration
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9032.0 built by: NET481REL1
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Core
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9139.0 built by: NET481REL1LAST_B
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9032.0 built by: NET481REL1
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Numerics
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9032.0 built by: NET481REL1
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
    ----------------------------------------
    System.Runtime.Serialization
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9032.0 built by: NET481REL1
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
    ----------------------------------------
    System.Data
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9110.0 built by: NET481REL1LAST_B
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    Accessibility
        Assembly Version: 4.0.0.0
        Win32 Version: 4.8.9032.0 built by: NET481REL1
        CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.


     

     

  13. Thanks @John Dowson, Thanks @Paul Henty

    Succeeded now finally to try it out with 7.3.17 and 1.1.1 and I'm fully happy.
    Really a HUGE improvement for my Annunciators.

    If you like to try... The code I checked from browser console...

    function Sleep(milliseconds) {
      return new Promise(resolve => setTimeout(resolve, milliseconds));
    };
    
    let reqJoeTestSync = {command: 'vars.calc',name: 'calc',code: '(A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 0.1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A20N_L_TK_Pump_1_Off)', interval: 200}
    let declare = {command: "vars.declare",name: "myVarSet",changesOnly: true,vars: [{ name: "A20N_L_TK_Pump_1_Off" },{name: "A32NX_OVHD_INTLT_ANN"}]}
    //let vars = {command: 'vars.list', name: 'list',notify: 'auto' }
    let read = {command: "vars.read",name: "myVarSet",changesOnly: true, interval:200}
    let socket = new WebSocket("ws://Simulator:2048/fsuipc", "fsuipc");
    
    socket.onopen = function(e) {
      socket.send(JSON.stringify(reqJoeTestSync));
      Sleep(200); 
      socket.send(JSON.stringify(declare));
      Sleep(200); 
      socket.send(JSON.stringify(read));
    };
    
    socket.onmessage = function(event) {
      console.log(`[message] Data received from server: ${event.data}`);
    };
    
    socket.onclose = function(event) {
      if (event.wasClean) {
        console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
      } else {
        console.log('[close] Connection died');
      }
    };
    
    socket.onerror = function(error) {
      console.log(`[error] ${error.message}`);
    };

     

    • Like 2
  14. 13 hours ago, Paul Henty said:

    Let me know if that sounds like a useable solution. But before I do the work, please check that you can indeed write to a new LVar from the calc code and read the resulting value back.

    Hi @Paul Henty

    TL;DR
    Your suggested server-side retriggering would help a lot (if we're unable to use the calculatorCode to get the result as return value AND assign it to a LVar) 👍

    As I'm not sure, whether a calculatorCode in a system/gauge like mentioned above 

    (A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 0.1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) *

    would still work within the aircraft if I add the LVar-Value assignment at the end.

    (A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 0.1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) * (>L:A32NX_OVHD_FUEL_LTK1_PUMP_ANNUN)

    If that's the case I see some chances that the LVars (adding and updating) could be better done within the Aircraft - which reduces the load for regular polling which would imho still the better variant.


    My Tests
    I checked it a bit more in detail and can state that when I "recalculate" by sending the "vars.calc" command, it updates the LVar and I get it via my subscribed event. 👍
    I tested it with two LVars which I created via the vars.calc command as suggested by John and then regularely updating them via execCalcCode to a different value.

    Here is my quick test from within the chrome browser console:

    function Sleep(milliseconds) {
      return new Promise(resolve => setTimeout(resolve, milliseconds));
    }
    
    let putOwnVar = {command: 'vars.calc',name: 'calc',code: '0 (>L:A00000_JOE_TEST)'}
    let putCockpitTemp = {command: 'vars.calc',name: 'calc',code: '(L:A32NX_COND_CKPT_TEMP) '+Math.random()+' * (>L:A00001_JOE_TEMP)'}
    let reqAnnunToggle = {command: 'vars.calc',name: 'calc',code: '(L:A32NX_OVHD_INTLT_ANN) ! (>L:A32NX_OVHD_INTLT_ANN)'}
    let reqJoeTestSync = {command: 'vars.calc',name: 'calc',code: '(L:A32NX_OVHD_INTLT_ANN) (>L:A00000_JOE_TEST)'}
    let declare = {command: "vars.declare",name: "myVarSet",changesOnly: true,vars: [{ name: "A00001_JOE_TEMP" },{ name: "A00000_JOE_TEST"},{name: "A32NX_OVHD_INTLT_ANN"}]}
    //let vars = {command: 'vars.list', name: 'list',notify: 'auto' }
    let read = {command: "vars.read",name: "myVarSet",changesOnly: true, interval:200}
    let socket = new WebSocket("ws://192.168.178.34:2048/fsuipc", "fsuipc");
    let timerId = setInterval(() => {
      updateVars();
    }, 2000);
    
    socket.onopen = function(e) {
      socket.send(JSON.stringify(putOwnVar));
      Sleep(200); 
      socket.send(JSON.stringify(putCockpitTemp));
      Sleep(200); 
      socket.send(JSON.stringify(declare));
      Sleep(200); 
      socket.send(JSON.stringify(read));
      let timerId = setInterval(() => updateVars(), 5000);
      setTimeout(() => { clearInterval(timerId)}, 10000);
    };
    
    socket.onmessage = function(event) {
      console.log(`[message] Data received from server: ${event.data}`);
    };
    
    socket.onclose = function(event) {
      if (event.wasClean) {
        console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
      } else {
        console.log('[close] Connection died');
      }
    };
    
    socket.onerror = function(error) {
      console.log(`[error] ${error.message}`);
    };
    
    function updateVars(){
      socket.send(JSON.stringify(putCockpitTemp));
      Sleep(200); 
      /*
      socket.send(JSON.stringify(reqAnnunToggle));
      Sleep(200); 
      */
      socket.send(JSON.stringify(reqJoeTestSync));
    }
    
      

    @John Dowson I noticed, that my own LVars remained available within FSUIPC "even after closing and restarting FSUIPC. How can I get rid of these test-LVars?

    @Paul Henty Is it correct, that the "vars.reload" request is triggering the WASM "Reload & list lvar" function as within FSUIPC?

    2023-01-20_095501-Norma Connect - im besten Netz.png

  15. 4 hours ago, John Dowson said:

    You need to execute the calculator code to update the lvar.

    That's unuseable for me.

    It's like calling the answering machine and entering the menu where I get told about the number of new voice messages each minute. So in >99% of the requests there is completely NO value but a lot of cost.
    What I need instead, is that my answering machine (LVar) is informing me automatically if the number of new messages (here the result of the calculation) **changed**.

    That's what happens with the websockets... You subscribe on change events and the system cares for you to monitor changes.

    There is no sense in asking your buttler to inform you when the weather changes, but he will only take a look outside, when he is explicitly told by you.
    So the buttler will obviously never notice on his own **that** the weather changed and thus will never inform you.

    Not sure, whether i succeeded to make the difference between "request/response" and "event subscriptions" a bit more clear. Hope so...

  16. Well if I subscribe on LVar change events to get informed via the FSUIPC websocket serve, the value should be updated in the LVAR and the websocket update event fired, when the result of the calculatorCode calculation gets different, without the need of explicitly retriggering (polling) the calculatorCode... 

    So I need it as an server send change event instead of regular client side requests aka polling.

    As long as it works... Great. 

    I'll also try to check it out... And many thanks for your investigation and updates. 

    Joe

     

  17. 1 hour ago, John Dowson said:

    You can create your own lvar, have the calculator code write its result to an lvar,

    But that needs to be done within the code of the aircraft? Doing that stuff on Aircraft side I already did successfully for the FBW A32nx in my branch.
    But if the maintainers of the Aircraft decide "for performance reasons" not to add all those LVars to the aircraft...  it seems my pull request will not have a big chance to be accepted.

    In the scope of FSUIPC7 I only found within the Advanced Users guide the section "Adding Lvars to Offsets" - but it seems that this doesn't help here, as for me there is no difference whether I read an LVar or an Offset. Both already works including the updating in case of changes.
    ut I don't get the return value of the Calculator Code into that LVar...

    Do you have probably somewhere else an example how I can get the result of the CalculatorCode execution into an LVAR so that changes are triggering to update the LVAR?
    That would really help me a lot...

    btw: Just found Pete's post from January 22, 2020 stating:

    Quote

     

    FSUIPC doesn't create L:Vars, it only provides facilities to read and write them.

    Pete

     

     

  18. Dear @John Dowson, Dear @Paul Henty

    I noticed, that it seems to be possible to get values via the execute_calculator_code function of Simconnect.
    See: https://docs.flightsimulator.com/html/Programming_Tools/WASM/Gauge_API/execute_calculator_code.htm

    As FSUIPC7 already supports execCalcCode and it works great "triggering" stuff with it, I'd like to make use of it on reading those values (and subscribing on value changes with the FSUIPC Websocket Server).

    That it seems to be supported by SimConnect API and can be seen in places like Mobiflight where it is implemented.
    Is that already possible with FSUIPC and its websocket server? If yes, how can this be done? If no... Is there a chance that we'll get it one day?

    Best regards,

               Joe

    Some probably usefull links:

    • https://docs.flightsimulator.com/html/Programming_Tools/WASM/Gauge_API/execute_calculator_code.htm
    • https://forums.flightsimulator.com/t/simconnect-wasm-combined-project-using-vs2019/486871/22?page=2
    • Mobiflight
    • image.png.c9ac82632ca2cbb9b9289954c0c5160c.png
    • https://hubhop.mobiflight.com/presets/ (select the "Outputs" to check what is run there.
    • image.png.19f26750e946bc31add551f8847933d0.png

      I tried it already from JS to "read" the
      L TK Pump 1 Off
       Annunciator LED value as defined within the FBW A32nx...
       
      let request = {command: 'vars.calc',name: 'calc',code: '(A:FUELSYSTEM PUMP SWITCH:2, Enum) 0 == (L:A32NX_OVHD_INTLT_ANN) 0 == or 1 and (L:A32NX_ELEC_AC_ESS_SHED_BUS_IS_POWERED, Bool) and (L:A32NX_OVHD_INTLT_ANN, number) 2 == if{ 0.1 } els{ 1 } * (A:CIRCUIT GENERAL PANEL ON, Bool) *'}
      let socket = new WebSocket("ws://myHost:2048/fsuipc", "fsuipc");
      
      socket.onopen = function(e) {
        console.log("[open] Connection established");
        socket.send(JSON.stringify(request));
      };
      
      socket.onmessage = function(event) {
        console.log(`[message] Data received from server: ${event.data}`);
      };
      
      socket.onclose = function(event) {
        if (event.wasClean) {
          console.log(`[close] Connection closed cleanly, code=${event.code} reason=${event.reason}`);
        } else {
          console.log('[close] Connection died');
        }
      };
      
      socket.onerror = function(error) {
        console.log(`[error] ${error.message}`);
      };

      And I received

    • {
        "command": "vars.calc",
        "name": "calc",
        "success": true,
        "errorMessage": null,
        "errorCode": null
      }

      So sucessfully sent the calculatorCode... But there is no return value nor any chance to subscribe for changes which I need to be able to update the annunciator LEDs in case the conditions change...

      Looking forward for your feedback,

      Joe

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