private void timer1_Tick(object sender, EventArgs e)
        {
            if (antenaTracker.IsOpen())
            {
                if (firstTime)
                {
                    firstTime = false;

                    antTrackConfig = antenaTracker.ReadConfig();
                    UpdateControles();
                    panel1.Enabled = true;
                    control_pan    = (short)(int)numericUpDownServoPANcenter.Value;
                    control_tilt   = (short)(int)numericUpDownServoTILTcenter.Value;
                }
                labelStatus.Text      = "Connected!";
                labelStatus.ForeColor = Color.Green;

                // Aqui se envia realmente el comando.... mover de sitio?
                AntTrackerDebug dbg = new AntTrackerDebug();
                dbg.pan         = control_pan;
                dbg.tilt        = control_tilt;
                dbg.EnableDebug = 0x05;
                antenaTracker.WriteDebugInfo(dbg);
            }
            else
            {
                labelStatus.Text      = "Not connected.";
                labelStatus.ForeColor = Color.Red;
            }
        }
Esempio n. 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            AntenaTracker antenaTracker = new AntenaTracker();

            if (antenaTracker.IsOpen())
            {
                if (firstTime)
                {
                    antTrackConfig = antenaTracker.ReadConfig();
                    UpdateControles();
                    panel1.Enabled = true;
                    firstTime      = false;
                    control_pan    = numericUpDownServoPANcenter;
                    control_tilt   = numericUpDownServoTILTcenter;
                }
                labelStatus.Text      = "Connected!";
                labelStatus.ForeColor = Color.Green;
                AntTrackerDebug dbg = new AntTrackerDebug();
                dbg.pan         = (short)control_pan.Value;
                dbg.tilt        = (short)control_tilt.Value;
                dbg.EnableDebug = 0x05;
                antenaTracker.WriteDebugInfo(dbg);
                antenaTracker.Close();
            }
            else
            {
                labelStatus.Text      = "Not connected.";
                labelStatus.ForeColor = Color.Red;
            }
        }
Esempio n. 3
0
        private void FormConfigurarAntracker_FormClosing(object sender, FormClosingEventArgs e)
        {
            timer1.Enabled = false;
            AntenaTracker antenaTracker = new AntenaTracker();

            if (antenaTracker.IsOpen())
            {
                AntTrackerDebug dbg = new AntTrackerDebug();
                dbg.EnableDebug = 0x00;
                antenaTracker.WriteDebugInfo(dbg);
                antenaTracker.Close();
            }
        }
Esempio n. 4
0
        void tarea(AntTracker obj)
        {
            if (antenaTracker.IsOpen())
            {
                if (singleton.telemetria == Singleton.Telemetria.AntTracker)
                {
                    obj.packet = antenaTracker.ReadModem();
                }
                else if (obj.planeStateUpdated == true && CheckPlaneState(obj.planeState))
                {
                    datosAvion.lon = obj.planeState.Lon;
                    datosAvion.lat = obj.planeState.Lat;
                    datosAvion.alt = (short)obj.planeState.Alt;

                    datosAvion.home_lon = (float)obj.home.Longitude;
                    datosAvion.home_lat = (float)obj.home.Latitude;
                    datosAvion.home_alt = (short)obj.home.Altitude;
                    if (antenaTracker.WriteDatosAvion(datosAvion) != USBXpress.USBXpress.ReturnCodes.SI_SUCCESS)
                    {
                        antenaTracker.Close();
                    }
                    else
                    {
                        datosAntena = antenaTracker.ReadDatosAntena();
                    }
                }

                if (debugUpdated)
                {
                    antenaTracker.WriteDebugInfo(debug);
                    debugUpdated = false;
                }
            }
            else
            {
                antenaTracker = new AntenaTracker();
            }
        }