Open allucche opened 4 years ago
I solved: https://github.com/xpnteam/xpnet/issues/23: X-Plane must only be called from the thread that it creates the Plugin on. Trying to read datarefs or make other calls back into X-Plane from other threads might crash the sim and might give you invalid data values, just as you're seeing. To do a timer, you have to let X-Plane do it for you. In XPNet you can do that with IXPlaneApi.Processing.RegisterFlightLoopHook().
Thanks
In My class i define:
private IXPlaneApi m_api = null;
In the constructor: public xPlaneSerialCom(IXPlaneApi api) { m_api = api; ...... }
When I send cmnd to xPlane in this function the system crashes:
private void SendCMND(string cmndString,int actionInt) { IXPCommand cmd = null; cmd = m_api.Commands.GetCommand(cmndString);
}
Where is my error? Thank you very much! Alessio