Exemple #1
0
        public void WriteScreen(int id, IkarusScreenConfig data)
        {
            byte[] buffer = new byte[data.size_bytes()];
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] = data.getByte(i);
            }

            Write(Comandos.Screen, id, 0, buffer);
            Flush();
            RemoteIkarus(0, id);
        }
Exemple #2
0
        public IkarusScreenConfig ReadScreen(int id)
        {
            IkarusScreenConfig data = new IkarusScreenConfig();

            byte[] buffer = Read(Comandos.Screen, (byte)id, 0, data.size_bytes());

            for (int i = 0; i < buffer.Length; i++)
            {
                data.setByte(i, buffer[i]);
            }
            return(data);
        }
Exemple #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            FlightPlanUSB fp = new FlightPlanUSB();

            if (fp.IsOpen())
            {
                hud = fp.ReadScreen(comboBoxScreenSlot.SelectedIndex);
                fp.Close();
                UpdateTextBoxes();
                pictureBox1.Invalidate();
            }
            else
            {
                MessageBox.Show("Not conected!");
            }
        }
Exemple #4
0
 private void button8_Click(object sender, EventArgs e)
 {
     hud = new IkarusScreenConfig();
     UpdateTextBoxes();
     pictureBox1.Invalidate();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            FlightPlanUSB fp = new FlightPlanUSB();

            if (fp.IsOpen())
            {
                IkarusBasicConfig basiccfg = new IkarusBasicConfig();
                basiccfg.LoadDefaults();

                basiccfg.LoadFromXmlString(global::UAVConsole.Properties.Resources.osd_config);

                basiccfg.videoPAL    = (byte)(1 - comboBoxVideoSystem.SelectedIndex);
                basiccfg.BaudRate    = (byte)comboBoxGPSBaudRate.SelectedIndex;
                basiccfg.Modo_PPM    = (byte)comboBoxModoPPM.SelectedIndex;
                basiccfg.PPM_Channel = (byte)(comboBoxCanalPPM.SelectedIndex + 4);

                TimeSpan rafa = TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime());
                basiccfg.TimeZone = (sbyte)rafa.Hours;

                fp.WriteConfig(basiccfg);

                IkarusAutopilotConfig autocfg = new IkarusAutopilotConfig();
                autocfg.LoadDefaults();

                autocfg.LoadFromXmlString(global::UAVConsole.Properties.Resources.autopilot_config);

                autocfg.tipo_mezcla = (byte)comboBoxTipoMezcla.SelectedIndex;
                fp.WriteConfigAutopilot(autocfg);


                if (checkBoxActualizarHUDs.Checked)
                {
                    IkarusScreenConfig scr = new IkarusScreenConfig();
                    scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.HUD1);
                    fp.WriteScreen(0, scr);     // HUD 0
                    scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.HUD2);
                    fp.WriteScreen(1, scr);     // HUD 1
                    scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.HUD3);
                    fp.WriteScreen(2, scr);     // HUD 2
                    scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.Failsafe);
                    fp.WriteScreen(3, scr);     // FailSafe
                    scr.LoadFromXmlString(global::UAVConsole.Properties.Resources.Resumen);
                    fp.WriteScreen(4, scr);     // Resumen
                }

                if (checkBoxActualizarCharSet.Checked)
                {
                    MemoryStream stream = new MemoryStream(global::UAVConsole.Properties.Resources.Ikarus);
                    FileCharset  fc     = new FileCharset(new StreamReader(stream));
                    byte[]       buff;

                    for (int i = 0; i < 256; i++)
                    {
                        buff = fc.getChar((byte)i);
                        fp.WriteCharSet(i, buff);
                    }
                }

                fp.Close();

                if (me.Idioma == 0)
                {
                    MessageBox.Show("Realizado!");
                }
                else
                {
                    MessageBox.Show("Done!");
                }
                this.Close();
            }
            else
            if (me.Idioma == 0)
            {
                MessageBox.Show("No esta conectado!");
            }
            else
            {
                MessageBox.Show("Not connected!");
            }
        }