Exemplo n.º 1
0
        //FiltroMediana filtroLat = new FiltroMediana(10);
        //FiltroMediana filtroLon = new FiltroMediana(10);
        //FiltroMediana filtroAlt = new FiltroMediana(10);


        public AntTracker()
        {
       
            planeStateUpdated = false;
            terminate = false;
            antenaTracker = new AntenaTracker();
            datosAvion = new AntTrackerDatosAvion();
            datosAvion.LoadDefaults();

            debug = new AntTrackerDebug();
            debug.LoadDefaults();

            if (antenaTracker.IsOpen())
            {
                timer = new System.Threading.Timer(TimerTask, this, 1000, 1000 /5);
            }
            else if (singleton.Idioma == 0)
            {
                MessageBox.Show("No se puede abrir dispositivo AntTracker");
            }
            else
            {
                MessageBox.Show("Cannot open AntTracker device");
            }
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (device == Devices.OSD)
            {
                FlightPlanUSB dev = new FlightPlanUSB();
                if (dev.IsOpen())
                {
                    dev.FirmwareUpdate();
                    dev.Close();
                }
                else
                {
                    if (me.Idioma == 0)
                        MessageBox.Show("Error abriendo USB");
                    else
                        MessageBox.Show("Error opening USB");
                }
            }
            else if (device == Devices.Uplink)
            {
                EmisoraUSB dev = new EmisoraUSB();
                if (dev.IsOpen())
                {
                    dev.UpdateFirmware();
                    dev.Close();
                }
                else
                {
                    if (me.Idioma == 0)
                        MessageBox.Show("Error abriendo USB");
                    else
                        MessageBox.Show("Error opening USB");
                }
            }
            else if (device == Devices.AntTracker)
            {
                AntenaTracker dev = new AntenaTracker();
                if (dev.IsOpen())
                {
                    dev.UpdateFirmware();
                    dev.Close();
                }
                else
                {
                    if (me.Idioma == 0)
                        MessageBox.Show("Error abriendo USB");
                    else
                        MessageBox.Show("Error opening USB");
                }

            }
        }
Exemplo n.º 3
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();
            }

        }
 private void button3_Click(object sender, EventArgs e)
 {
     AntenaTracker antenaTracker = new AntenaTracker();
     antTrackConfig = antenaTracker.ReadConfig();
     antenaTracker.Close();
     
     UpdateControles();    
 }
 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();
     }
 }
 private void buttonUpdate_Click(object sender, EventArgs e)
 {
     timer1.Enabled = false;
     UpdateStruct();
     AntenaTracker antenaTracker = new AntenaTracker();
     antenaTracker.WriteConfig(antTrackConfig);
     antenaTracker.Close();
     if (me.Idioma == (int)Singleton.Idiomas.Spanish)
         MessageBox.Show("Configuración Actualizada");
     else
         MessageBox.Show("Config Updated");
     timer1.Enabled = true;
 }
        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;
            }
        }