Exemple #1
0
        public void SaveToFlash()
        {
            byte[] buff = new byte[17];
            int    i    = 0;

            USBXpress.toarray(buff,ref i,(byte)singleton.txNumCanales);
            USBXpress.toarray(buff,ref i,(Int16)singleton.txPeriodo);
            USBXpress.toarray(buff,ref i,(Int16)singleton.txSeparador);
            USBXpress.toarray(buff,ref i,(byte)(singleton.txPolarity?1:0));

            USBXpress.toarray(buff,ref i,(byte)singleton.headtrack_panCh);
            USBXpress.toarray(buff,ref i,(byte)singleton.servo_ch[(int)Singleton.Canales.PAN]);

            USBXpress.toarray(buff,ref i,(byte)singleton.headtrack_tiltCh);
            USBXpress.toarray(buff,ref i,(byte)singleton.servo_ch[(int)Singleton.Canales.TILT]);

            USBXpress.toarray(buff,ref i,(float)singleton.uplinkValarm);
            USBXpress.toarray(buff,ref i,(byte)(singleton.useEmisora?1:0));
            if (singleton.enable_headtrack)
            {
                USBXpress.toarray(buff,ref i,(byte)(singleton.enable_pan ? 1 : 0));
                USBXpress.toarray(buff,ref i,(byte)(singleton.enable_tilt ? 1 : 0));
            }
            WriteRAW(0xfc,buff);
        }
Exemple #2
0
        public void SetLowBattery(float v)                  // obsoleto
        {
            byte[] buff = new byte[4];
            int    i    = 0;

            USBXpress.toarray(buff,ref i,v);
            WriteRAW(0xfa,buff);
        }
Exemple #3
0
        public static int[] SetAltura(int altitude)
        {
            int i = 0;

            byte [] buff = new byte[2];
            USBXpress.toarray(buff, ref i, (Int16)altitude);
            return(build_packet((byte)REGS.Altura, buff));
        }
Exemple #4
0
        public int ReadMaxWpts()
        {
            byte[] buffer  = Read(Comandos.Ruta, 0xff, 0, 2);
            int    i       = 0;
            int    numwpts = USBXpress.toint16(buffer, ref i);

            return(numwpts);
        }
Exemple #5
0
        public float ReadBatteryLevel()
        {
            byte[] buff = ReadRAW(0xfb,sizeof(float));
            int    i    = 0;
            float  v    = USBXpress.tofloat(buff,ref i);

            return(v);
        }
Exemple #6
0
        public static int[] build_packet(byte id, float v)
        {
            int i = 0;

            byte[] buff = new byte[4];
            USBXpress.toarray(buff, ref i, v);
            return(build_packet(id, buff));
        }
Exemple #7
0
        public static int[] SetLat(float lat)
        {
            int i = 0;

            byte[] buff = new byte[4];
            USBXpress.toarray(buff, ref i, lat);
            return(build_packet((byte)REGS.Lat, buff));
        }
Exemple #8
0
        public void WriteMaxWpt(int num)
        {
            byte[] buffer = new byte[2];
            int    i      = 0;

            USBXpress.toarray(buffer, ref i, (Int16)num);
            Write(Comandos.Ruta, 0xff, 0, buffer);
            ClearScrIkarus();
            PrintAtIkarus(3, 3, string.Format("Escritos {0} Wpts", num));
        }
Exemple #9
0
        public int[] ReadServosRAW()
        {
            byte[] buffer = Read(Comandos.SERVOS_RAW, 0, 0, 12 * 2);
            int[]  servos = new int[buffer.Length / 2];
            int    i      = 0;

            for (int j = 0; j < servos.Length; j++)
            {
                servos[j] = USBXpress.toint16(buffer, ref i);
            }
            return(servos);
        }
Exemple #10
0
        public float[] ReadADCs()
        {
            byte[]   buffer = Read(Comandos.ADC_VALUES, 0, 0, 8 * 4);
            float [] adcs   = new float[buffer.Length / 4];
            int      i      = 0;

            for (int j = 0; j < adcs.Length; j++)
            {
                adcs[j] = USBXpress.tofloat(buffer, ref i);
            }
            return(adcs);
        }
Exemple #11
0
        public static int[] SetDebugVar(byte var, float value)
        {
            byte dato = (byte)(var & 0x3f);
            int  i    = 1;

            byte[] buff = new byte[5];
            seqid   = (byte)((seqid + 1) & 0x03);
            dato   |= (byte)(seqid << 6);
            buff[0] = dato;
            USBXpress.toarray(buff, ref i, value);
            return(build_packet((byte)0xF, buff));
        }
Exemple #12
0
        public void SetSlot(int slot,int[] mensaje)
        {
            byte[]  buff = new byte[mensaje.Length * 2 + 1];
            byte [] msg  = USBXpress.tobytearray(mensaje);
            buff[0] = (byte)mensaje.Length;
            for (int i = 0; i < msg.Length; i += 2)
            {
                buff[i + 1] = msg[i + 1];
                buff[i + 2] = msg[i];
            }

            Write(Comandos.SLOT,slot,0,buff);
        }
Exemple #13
0
        public WayPoint ReadWpt(int id)
        {
            WayPoint wpt = null;

            wpt = new WayPoint();
            int i = 0;

            byte[] buffer = Read(Comandos.Ruta, (byte)id, 0, 32);
            wpt.name      = USBXpress.tostring(buffer, ref i, 20);
            wpt.Longitude = USBXpress.tofloat(buffer, ref i);
            wpt.Latitude  = USBXpress.tofloat(buffer, ref i);
            wpt.Altitude  = USBXpress.tofloat(buffer, ref i);

            return(wpt);
        }
Exemple #14
0
        public void WriteWpt(int id, string Name, float lon, float lat, float alt)
        {
            byte[] buffer = new byte[32];
            int    i;

            for (i = 0; i < 20 && i < Name.Length; i++)
            {
                buffer[i] = (byte)Name[i];
            }
            for (; i < 20; i++)
            {
                buffer[i] = 0;
            }

            USBXpress.toarray(buffer, ref i, lon);
            USBXpress.toarray(buffer, ref i, lat);
            USBXpress.toarray(buffer, ref i, alt);
            Write(Comandos.Ruta, (byte)id, 0, buffer);
        }
Exemple #15
0
 public static extern USBXpress.ReturnCodes SI_CheckRXQueue(UInt32 cyHandle, ref UInt32 lpdwNumBytesInQueue, ref USBXpress.RXQueueStatus lpdwQueueStatus);
Exemple #16
0
 public static extern USBXpress.ReturnCodes SI_GetProductString(int dwDeviceNum, [MarshalAs(UnmanagedType.LPArray)] byte[] lpvDeviceString, USBXpress.ProductString dwFlags);
Exemple #17
0
 public USBXpress.ReturnCodes SI_GetProductString(int dwDeviceNum, [MarshalAs(UnmanagedType.LPArray)] byte[] lpvDeviceString, USBXpress.ProductString dwFlags)
 {
     if (tipo == TypeOS.i64) 
         return USBXpress64.SI_GetProductString(dwDeviceNum, lpvDeviceString, dwFlags);
     else
         return USBXpress32.SI_GetProductString(dwDeviceNum, lpvDeviceString, dwFlags);
 }
Exemple #18
0
 public USBXpress.ReturnCodes SI_CheckRXQueue(UInt32 cyHandle, ref UInt32 lpdwNumBytesInQueue, ref USBXpress.RXQueueStatus lpdwQueueStatus)
 {
     if (tipo == TypeOS.i64) 
         return USBXpress64.SI_CheckRXQueue(cyHandle, ref lpdwNumBytesInQueue, ref lpdwQueueStatus);
     else
         return USBXpress32.SI_CheckRXQueue(cyHandle, ref lpdwNumBytesInQueue, ref lpdwQueueStatus);
 }