Пример #1
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();
        }
Пример #2
0
        void InitEmisoraUSB()
        {
            /*
            if (singleton.planeState != null)
            {
                _modem_lon = singleton.planeState.homeLon;
                _modem_lat = singleton.planeState.homeLat;
            }
            else
            {
                _modem_lon = -6.0f;
                _modem_lat = 37.5f;
            }
            */

            _modem_lon = singleton.HomeLon;
            _modem_lat = singleton.HomeLat;
            _modem_alt = singleton.HomeAlt+100;

            wfly = new EmisoraUSB();
            if (wfly.IsOpen())
            {
                //fijamos que canal se modifica
                ConfigurarCanales(wfly);      
                
                wfly.SetLowBattery(singleton.uplinkValarm);
                wfly.SaveToFlash();
             }
        }
Пример #3
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");
                }

            }
        }
Пример #4
0
        void ConfigurarCanales(EmisoraUSB wfly)
        {
            if (!configurado)
            {
                byte[] mask = new byte[11];
                for (int i = 0; i < mask.Length; i++)
                    mask[i] = 0;

                if (singleton.servo_ch[(int)Singleton.Canales.CTRL] < mask.Length)
                {
                    mask[singleton.servo_ch[(int)Singleton.Canales.CTRL]] = 2;

                    int[] slot0 = WflyUplink.SetSwitches(WflyUplink.Ruta.Casa, WflyUplink.Autopilot.Manual, _modem_hud, _modem_cam);
                    int[] slot1 = WflyUplink.SetAltura((int)_modem_alt);
                    int[] slot2 = WflyUplink.SetLon(_modem_lon);
                    int[] slot3 = WflyUplink.SetLat(modem_lat);
                    int[] slot4 = new int[0]; // WflyUplink.SetDebugVar(0xff, 0.0f);

                    int[] seq = new int[] { 0, 1, 0, 2, 0, 3, 0, 4 };

                    wfly.SetSlot(0, slot0);
                    wfly.SetSlot(1, slot1);
                    wfly.SetSlot(2, slot2);
                    wfly.SetSlot(3, slot3);
                    wfly.SetSlot(4, slot4);

                    wfly.SetSequence((int)Singleton.Canales.CTRL, 1, seq);
                }

                this.SetMasks(joy_enabled);
                configurado = true;
            }
        }