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 button1_Click(object sender, EventArgs e) { timer1.Enabled = false; labelStatus.Text = "Closed!"; labelStatus.ForeColor = Color.DarkRed; if (antenaTracker.IsOpen()) { AntTrackerDebug dbg = new AntTrackerDebug(); dbg.EnableDebug = 0x00; antenaTracker.WriteDebugInfo(dbg); antenaTracker.Close(); } FormActualizarFirmware form = new FormActualizarFirmware(FormActualizarFirmware.Devices.AntTracker); form.Show(this); }
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; }
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 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"); } } } }