Jump to content
The simFlight Network Forums
michielsweb

request simple c# demo script

Recommended Posts

                    case "CRS1":
                        temp = this.raw_mcpcrs1.Value;
                        if (ser[1] == "1") { temp--; FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_CRS_L_SET, temp); } // rotate left.
                        else if (ser[1] == "2") { temp++; FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_CRS_L_SET, temp); } //rotate right
                        else if (ser[1] == "3") { FSUIPCConnection.SendControlToFS(PMDG_737_NGX_Control.EVT_MCP_VNAV_SWITCH, 1);  } //short push (APP)
                        else { } // longpush
                        FSUIPCConnection.Process();
                        break;

paul.  i push in serial ticks from encoders  to c# and proces like this.
i miss about 2 or 3 out of 5 ticks.

now i do know  i can get the ticks around 5/5 into c#  so i was wonder is this a slow way to update  sim and is there a faster way?
🙂 or is this as fast as it gets. 
it just feels  " slow "
sorry its just a snippet 🙂 but its all same just other value 🙂

Share this post


Link to post
Share on other sites

Hi,

I don't think you need the Process() call.The SendControlToFS() already includes its own Process() so you don't need to call Process() yourself to send the control. If there is no other reason for it being there, you can halve the time taken for each tick by removing that line.

Other than that, it will be as fast as it gets. It's going to take the time for a Process() call for each encoder 'tick'. How long that takes depends on your PC, what add-ons you're using etc. You can check for yourself by displaying the value of the following property:

FSUIPCConnection.Statistics.ProcessAvg.TimeForProcessCall

Turn a few encoders so it can build an average. The value is in milliseconds.

You can also see min and max values using ProcessMin and ProcessMax.

Paul

Share this post


Link to post
Share on other sites

rodger that paul !! i remove the procces 🙂
il wil think for a solutions to "reduce" the amount of send control update to sim

have to think about how i am gonna shape this into a better way. maybe i do a timely update. to send a 1 or 2 second update 🙂 whit all ticks created at that time at once

 

Share this post


Link to post
Share on other sites

small update too all  🙂

i recommand too all if u run  a larger program 🙂

todo this on form startup:

Process.GetCurrentProcess().ProcessorAffinity = (System.IntPtr)1;

i wil make sure ure app only works on core 0; i do this to make sure that p3d doesnt share his ipc 🙂 
on my relativly extended script 🙂 i gained a lowering of 20% of cpu cores for p3d 🙂

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

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