MissionPlanner.Sikradio.Sleep C# (CSharp) Method

Sleep() private method

private Sleep ( int mstimeout, ICommsSerial comPort = null ) : void
mstimeout int
comPort ICommsSerial
return void
        private void Sleep(int mstimeout, ICommsSerial comPort = null)
        {
            var endtime = DateTime.Now.AddMilliseconds(mstimeout);

            while (DateTime.Now < endtime)
            {
                Thread.Sleep(1);
                Application.DoEvents();

                // prime the mavlinkserial loop with data.
                if (comPort != null)
                {
                    var test = comPort.BytesToRead;
                    test++;
                }
            }
        }