예제 #1
0
 void validate()
 {
     if (comboBoxVideoDevice.SelectedItem != null)
     {
         me.videoCaptureStr = comboBoxVideoDevice.SelectedItem.ToString();
     }
     me.cells1 = (int)numericUpDown1.Value;
     me.cells2 = (int)numericUpDown2.Value;
     me.ToRegistry(); // Singleton.GetInstance().ToRegistry();
 }
예제 #2
0
        private void FormIkarusConfig_FormClosing(object sender, FormClosingEventArgs e)
        {
            Singleton me = Singleton.GetInstance();

            timer1.Enabled = false;
            planUSB.Close();

            if (me != null && sconfig != null && !updateFirmware && (sconfig.HomeLon != 0 || sconfig.HomeLat != 0))
            {
                DialogResult res;
                if (me.Idioma == 0)
                {
                    res = MessageBox.Show(this,
                                          "A continuación se va a actualizar la casa del programa con las nuevas coordenadas. Pulse 'Cancelar' si no desea hacer esto.",
                                          "Actualizar Casa", MessageBoxButtons.OKCancel);
                }
                else
                {
                    res = MessageBox.Show(this,
                                          "Next, program home will be updated with the new coordinates. Press 'Cancel' if you don't want to do this.",
                                          "Update Home", MessageBoxButtons.OKCancel);
                }

                if (res == DialogResult.OK)
                {
                    me.HomeLon = sconfig.HomeLon;
                    me.HomeLat = sconfig.HomeLat;
                    me.HomeAlt = sconfig.HomeAltitude;

                    if (me.planeState != null)
                    {
                        me.planeState.homeLon = sconfig.HomeLon;
                        me.planeState.homeLat = sconfig.HomeLat;
                    }
                }
                if (me.planeState != null)
                {
                    me.planeState.Lat = sconfig.HomeLat;
                    me.planeState.Lon = sconfig.HomeLon;
                    me.planeState.Alt = sconfig.HomeAltitude;
                }
                me.ToRegistry();
            }
        }
        void UpdateRegistry()
        {
            // Valores de los PID a memorizar....
            try
            {
                me.uplink_pid_ail_P  = config_autopilot.pidRoll.P;
                me.uplink_pid_ail_I  = config_autopilot.pidRoll.I;
                me.uplink_pid_ail_D  = config_autopilot.pidRoll.D;
                me.uplink_pid_ail_IL = config_autopilot.pidRoll.ILim;
                me.uplink_pid_ail_DL = config_autopilot.pidRoll.DriveLim;

                me.uplink_pid_ele_P  = config_autopilot.pidPitch.P;
                me.uplink_pid_ele_I  = config_autopilot.pidPitch.I;
                me.uplink_pid_ele_D  = config_autopilot.pidPitch.D;
                me.uplink_pid_ele_IL = config_autopilot.pidPitch.ILim;
                me.uplink_pid_ele_DL = config_autopilot.pidPitch.DriveLim;

                me.uplink_pid_thr_P  = config_autopilot.pidMotor.P;
                me.uplink_pid_thr_I  = config_autopilot.pidMotor.I;
                me.uplink_pid_thr_D  = config_autopilot.pidMotor.D;
                me.uplink_pid_thr_IL = config_autopilot.pidMotor.ILim;
                me.uplink_pid_thr_DL = config_autopilot.pidMotor.DriveLim;

                me.uplink_pid_tail_P  = config_autopilot.pidTail.P;
                me.uplink_pid_tail_I  = config_autopilot.pidTail.I;
                me.uplink_pid_tail_D  = config_autopilot.pidTail.D;
                me.uplink_pid_tail_IL = config_autopilot.pidTail.ILim;
                me.uplink_pid_tail_DL = config_autopilot.pidTail.DriveLim;

                me.uplink_IR_offX    = config_autopilot.x_off;
                me.uplink_IR_offY    = config_autopilot.y_off;
                me.uplink_IR_gain    = config_autopilot.IR_max;
                me.uplink_rumbo_ail  = config_autopilot.Rumbo_Ail;
                me.uplink_altura_ele = config_autopilot.Altitud_Ele;

                me.uplink_IR_rev_P     = config_autopilot.IR_pitch_rev != 0;
                me.uplink_IR_rev_R     = config_autopilot.IR_roll_rev != 0;
                me.uplink_IR_cross     = config_autopilot.IR_cross_sensor != 0;
                me.uplink_IR_rev_cross = config_autopilot.IR_cross_rev != 0;
                me.ToRegistry();
            }
            catch (Exception) { }
        }
예제 #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            ToSingleton();
            me.ToRegistry();

            EmisoraUSB wfly = new EmisoraUSB();

            if (wfly.IsOpen())
            {
                wfly.SaveToFlash();
                wfly.Close();
            }

            if (me.Idioma == (int)Singleton.Idiomas.Spanish)
            {
                MessageBox.Show("Configuración Actualizada");
            }
            else
            {
                MessageBox.Show("Config Updated");
            }
            //this.Close();
        }
예제 #5
0
        void validate()
        {
            if (comboBoxCOM.SelectedItem != null)
            {
                me.commPort = comboBoxCOM.SelectedItem.ToString();
            }
            if (comboBoxCommBps.SelectedItem != null)
            {
                me.commBps = int.Parse(comboBoxCommBps.SelectedItem.ToString());
            }
            me.videosystem     = (Singleton.VideoSystem)comboBoxVideoSist.SelectedIndex;
            me.telemetria      = (Singleton.Telemetria)comboBoxModem.SelectedIndex;
            me.CacheMapsPath   = textBoxCacheMapsPath.Text;
            me.FlightLogPath   = textBoxFlightLogPath.Text;
            me.PicturePath     = textBoxPicturePath.Text;
            me.VideosPath      = textBoxVideosPath.Text;
            me.NombrePiloto    = textBoxNombrePiloto.Text;
            me.enableUDPinout  = checkBoxUDP.Checked;
            me.enableWebServer = checkBoxWebServer.Checked;
            int.TryParse(textBoxWebServer.Text, out me.portWebServer);
            int.TryParse(textBoxUDPport.Text, out me.portUDPinout);

            try
            {
                me.moduloTX = (Singleton.ModuloControl)comboBoxModuloTX.SelectedIndex;

                me.uplinkNumCells = comboBoxNumCellsUplink.SelectedIndex + 2;
                me.uplinkLipo     = checkBoxLipoUplink.Checked;
                me.uplinkVmin     = (float)numericUpDownVminUplink.Value;
                me.uplinkVmax     = (float)numericUpDownVmaxUplink.Value;
                me.uplinkValarm   = (float)numericUpDownValarmUplink.Value;
            }
            catch (Exception)
            {
            }

            try
            {
                me.enableCasaAntTrack = false;
                me.enableAntTrack     = checkBoxAntTrack.Checked;
            }
            catch (Exception)
            {
            }


            me.Idioma         = comboBoxLanguage.SelectedIndex;
            me.SistemaMetrico = comboBoxSistemaMetrico.SelectedIndex;

            try
            {
                float.TryParse(textBoxAlarmaAltitud.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out me.AlarmAltitude);
                // float.TryParse(textBoxAlarmAscenso.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out me.AlarmAscenso);
                float.TryParse(textBoxAlarmCellVoltage.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out me.AlarmCellVoltage);
                float.TryParse(textBoxAlarmDistance.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out me.AlarmDistance);
                float.TryParse(textBoxAlarmFastDescent.Text, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out me.AlarmFastDescentRate);

                me.AlarmAltitude_enabled        = checkBoxAlarmAltitude.Checked;
                me.AlarmAscenso_enabled         = checkBoxAlarmAscenso.Checked;
                me.AlarmCellVoltage_enabled     = checkBoxAlarmCellVoltage.Checked;
                me.AlarmDistance_enabled        = checkBoxAlarmDistance.Checked;
                me.AlarmFastDescentRate_enabled = checkBoxAlarmFastDescent.Checked;
            }
            catch (Exception)
            {
            }

            try
            {
                me.trocearVideo = checkBoxTrocearVideo.Checked;
                int.TryParse(textBoxTrocearMB.Text, out me.trocearTamMB);
                me.calidadVideo = trackBarCalidadVideo.Value;
                me.fpsVideo     = (int)numericUpDownFPScaptura.Value;
            }
            catch (Exception) { }

            me.ToRegistry(); // Singleton.GetInstance().ToRegistry();
        }
예제 #6
0
 private void button4_Click(object sender, EventArgs e)
 {
     ToSingleton();
     me.ToRegistry();
     this.Close();
 }