Ejemplo n.º 1
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     getAvailablePorts();
     this.messageReceived.Clear();
     this.messageSent.Clear();
     this.pitchRoll.Image = PitchRoll.DrawPitchRoll(0, 0, this.pitchRoll.Size);
     this.compass.Image   = Compass.DrawCompass(0, 0, this.maxPitch, 0, this.maxRoll, this.compass.Size);
 }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            getAvailablePorts();
            GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();

            watcher.PositionChanged += watcher_PositionChanged;
            watcher.Start();

            this.compass.BackColor = System.Drawing.Color.Black;
            this.compass.Image     = Compass.DrawCompass(0, 0, this.maxPitch, 0, this.maxRoll, this.compass.Size);

            this.pitchRoll.BackColor = System.Drawing.Color.Black;
            this.pitchRoll.Image     = PitchRoll.DrawPitchRoll(0, 0, this.pitchRoll.Size);
        }
Ejemplo n.º 3
0
 private void read()
 {
     while (this.serialPort1.IsOpen)
     {
         try
         {
             if (this.serialPort1.BytesToRead > 0)
             {
                 this.message = serialPort1.ReadLine();
                 this.setText(message);
                 if (message.Length > 0 && message.IndexOf("ypr") == 0)
                 {
                     string[] splitMessage = message.Split('\t');
                     double   yaw          = Double.Parse(splitMessage[1]);
                     double   pitch        = Double.Parse(splitMessage[2]);
                     double   roll         = Double.Parse(splitMessage[3]);
                     this.compass.Image   = Compass.DrawCompass(yaw, pitch, this.maxPitch, roll, this.maxRoll, this.compass.Size);
                     this.pitchRoll.Image = PitchRoll.DrawPitchRoll(pitch, roll, this.pitchRoll.Size);
                 }
             }
         }
         catch (TimeoutException) { }
     }
 }