Jump to content
The simFlight Network Forums

request simple c# demo script


michielsweb

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 🙂

Link to comment
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

Link to comment
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

 

Link to comment
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 🙂

 

Link to comment
Share on other sites

  • 4 months later...

Hey all its been a long time!!  Much RL troubles promotions and job changes🙂

But by now i am 100%  converted to the NGXu 🙂
cleaned up te code. and even  started the creation of  a virtual COPILOT.  
First voice actor has delivered.  GSX  voiced and CABINALIVe  now speak in 1 tong, and fluently.

now for the most exciting news !! yes i made it.  a co pilot.  is now actively working.
his checklists and procederus atleast the first checklists are here!! 🙂

i was wondering a minor questions tough!!

(can i read a fsuipc joystick input through the fsuipc.net DLL?
(i want to dedicate 1 button. to my joystick for a repeat button)  or any work arround ideas are welcome!!

 







 

Link to comment
Share on other sites

HI Michiel,

FSUIPC can report when a joystick button has been pressed. Have a look at the example code application: 

Input/Menu Services >> IS002_ButtonPresses

That's probably the easiest way. Otherwise you'll need to find a library that will let you use the DirectX/DirectInput features of Windows to read the joystick directly.

Quote

But by now i am 100%  converted to the NGXu 

If you're using PMDG, I'll be releasing a new version of the DLL in a few days. It has a few extra offsets in the 737 helper class for the NGXu. 

Paul

Link to comment
Share on other sites

Quote

wil it come whit a offset list? my fsuipc  doc one is seemingly old🙂

You can see all the offsets in the Intellisense list, but it's quite long. It's best to use the classes with the official FSUIPC documentation for the PMDG Offsets. The latest docs are installed when you update FSUIPC.

What offsets are available will depend of the your version of FSUIPC however. e.g. FSUIPC4 for FSX won't have the 737NGXu offsets.

Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.