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; } }
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; } }
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(); } }
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(); } }
//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"); } }
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"); } } } }