Exemplo n.º 1
0
 /// <summary>
 /// bluetooth message call back funtion
 /// </summary>
 /// <param name="data"></param>
 /// bluetooth message
 private void OnReceiveBluetoothMsg(clsBlueTooth.BtData data)
 {
     lock (qBluetoothData.SyncRoot)
     {
         qBluetoothData.Enqueue(data);
     }
     Console.WriteLine(data.angle_Pit + "  " + data.angle_Rol + "  " + data.angle_Yaw);
 }
Exemplo n.º 2
0
        private void UpdateChart(clsBlueTooth.BtData data, double milSec)
        {
            if (zedGraphControl1.GraphPane.CurveList.Count <= 0)
            {
                return;
            }

            LineItem curve = zedGraphControl1.GraphPane.CurveList[0] as LineItem;

            if (curve == null)
            {
                return;
            }
            IPointListEdit list = curve.Points as IPointListEdit;

            if (list == null)
            {
                return;
            }

            valueXShow += (milSec);
            double x = valueXShow;

            try
            {
                pCurrentPoint1.X = x;
                pCurrentPoint1.Y = data.angle_Yaw;

                if (pCurrentPoint1.Y > 120)
                {
                    pCurrentPoint1.Y = 119;
                }
                if (pCurrentPoint1.Y < -120)
                {
                    pCurrentPoint1.Y = -119;
                }

                pCurrentPoint2.X = x;
                pCurrentPoint2.Y = data.angle_Pit;
                if (pCurrentPoint2.Y > 120)
                {
                    pCurrentPoint2.Y = 110;
                }
                if (pCurrentPoint2.Y < -120)
                {
                    pCurrentPoint2.Y = -119;
                }

                pCurrentPoint3.X = x;
                pCurrentPoint3.Y = data.angle_Rol;
                if (pCurrentPoint3.Y > 120)
                {
                    pCurrentPoint3.Y = 100;
                }
                if (pCurrentPoint3.Y < -120)
                {
                    pCurrentPoint3.Y = -119;
                }
            }
            catch (Exception ex)
            {
                return;
            }

            list1.Add(pCurrentPoint1);
            list2.Add(pCurrentPoint2);
            list3.Add(pCurrentPoint3);

            if (valueXShow >= 100)
            {
                list1.Clear();
                list2.Clear();
                list3.Clear();
                valueXShow = 0;
            }
            zedGraphControl1.Invalidate();
        }