Пример #1
0
        public double GetRatioBetween(int gear)
        {
            //int gear = Telemetry.m.Sim.Player.Gear;
            double Ratio1 = ShiftRpm.GetRatio(gear);
            double Ratio2 = ShiftRpm.GetRatio(gear + 1);

            return(Ratio2 / Ratio1);
        }
Пример #2
0
        public static int GetGear()
        {
            return(Telemetry.m.Sim.Player.Gear);

            if (Telemetry.m.Sim.Drivers.Player.Gear == 0)
            {
                return(0);
            }
            double CurrentRatio = GetGearRatio_Pure(Telemetry.m.Sim.Drivers.Player.Gear);

            for (int i = 0; i <= Telemetry.m.Sim.Drivers.Player.Gears + 3; i++)
            {
                double d = CurrentRatio / ShiftRpm.GetRatio(i);
                if (d < 1.03 && d > 0.97)
                {
                    return(i);
                }
                if (d < 0.97 && i == Telemetry.m.Sim.Drivers.Player.Gears + 3)
                {
                    return(Telemetry.m.Sim.Drivers.Player.Gears);
                }
            }
            return(0);
        }
Пример #3
0
        private void Fire_LS(object o)
        {
            GameData_LS package = new GameData_LS();

            /** TYRE TEMPERATURES **/
            if (Telemetry.m.Sim.Player.Tyre_Temperature_LF_Middle > 0)
            {
                package.TyreTemperature_LF = Convert.ToByte(Telemetry.m.Sim.Player.Tyre_Temperature_LF_Middle - 273.16);
                package.TyreTemperature_RF = Convert.ToByte(Telemetry.m.Sim.Player.Tyre_Temperature_RF_Middle - 273.16);
                package.TyreTemperature_LR = Convert.ToByte(Telemetry.m.Sim.Player.Tyre_Temperature_LR_Middle - 273.16);
                package.TyreTemperature_RR = Convert.ToByte(Telemetry.m.Sim.Player.Tyre_Temperature_RR_Middle - 273.16);
            }
            /** TYRE & BRAKE WEAR **/
            package.TyreWear_F  = Convert.ToByte(200 * (Telemetry.m.Sim.Drivers.Player.TyreWear_LF + Telemetry.m.Sim.Drivers.Player.TyreWear_RF) / 2.0);
            package.TyreWear_R  = Convert.ToByte(200 * (Telemetry.m.Sim.Drivers.Player.TyreWear_LR + Telemetry.m.Sim.Drivers.Player.TyreWear_RR) / 2.0);
            package.BrakeWear_F = 0;
            package.BrakeWear_R = 0;

            /** CURRENT FUEL INFO **/
            package.Fuel_Litre = Convert.ToUInt16(Telemetry.m.Sim.Player.Fuel * 10);
            package.Fuel_Laps  = 0;

            /** DRIVING TIMES **/
            package.Laptime_Last = Telemetry.m.Sim.Drivers.Player.LapTime_Last;
            package.Laptime_Best = Telemetry.m.Sim.Drivers.Player.LapTime_Best;
            switch (Telemetry.m.Sim.Drivers.Player.SectorsDriven % 3)
            {
            case 0:
                package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_3_Last - Telemetry.m.Sim.Drivers.Player.Sector_3_Best;
                break;

            case 1:
                package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_1_Last - Telemetry.m.Sim.Drivers.Player.Sector_1_Best;
                break;

            case 2:
                package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_2_Last - Telemetry.m.Sim.Drivers.Player.Sector_2_Best;
                break;
            }
            package.Split_Lap = Telemetry.m.Sim.Drivers.Player.LapTime_Best - Telemetry.m.Sim.Drivers.Player.LapTime_Last;

            package.RaceTime   = Telemetry.m.Sim.Session.Time - 30;
            package.RaceLength = 3600;

            SendPackage(DashboardPackages.PACK_GAMEDATA_LS, ByteMethods.ToBytes(package));

            /*** Temporarely do cardata here as well ***/
            CarData cardata = new CarData();

            cardata.RPM_Max  = Convert.ToUInt16(Telemetry.m.Sim.Player.Engine_RPM_Max_Live * rads_to_rpm);
            cardata.RPM_Idle = Convert.ToUInt16(Telemetry.m.Sim.Player.Engine_RPM_Idle_Max * rads_to_rpm);

            //cardata.HP_Max = Convert.ToUInt16(EngineCurve.GetMaxHP());
            cardata.Gears    = (byte)Telemetry.m.Sim.Drivers.Player.Gears;
            cardata.Fuel_Max = (byte)Telemetry.m.Sim.Drivers.Player.Fuel_Max;

            cardata.GearRatio0 = Convert.ToSingle(GetGearRatio_Pure(0));
            cardata.GearRatio1 = Convert.ToSingle(GetGearRatio_Pure(1));
            cardata.GearRatio2 = Convert.ToSingle(GetGearRatio_Pure(2));
            cardata.GearRatio3 = Convert.ToSingle(GetGearRatio_Pure(3));
            cardata.GearRatio4 = Convert.ToSingle(GetGearRatio_Pure(4));
            cardata.GearRatio5 = Convert.ToSingle(GetGearRatio_Pure(5));
            cardata.GearRatio6 = Convert.ToSingle(GetGearRatio_Pure(6));
            cardata.GearRatio7 = Convert.ToSingle(GetGearRatio_Pure(7));

            ShiftRpm r = new ShiftRpm();

            cardata.RPM_Shift0 = cardata.RPM_Max;

            /*cardata.RPM_Shift1 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(1)));
            *  cardata.RPM_Shift2 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(2)));
            *  cardata.RPM_Shift3 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(3)));
            *  cardata.RPM_Shift4 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(4)));
            *  cardata.RPM_Shift5 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(5)));
            *  cardata.RPM_Shift6 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(6)));*/
            cardata.RPM_Shift1 = cardata.RPM_Max;
            cardata.RPM_Shift2 = cardata.RPM_Max;
            cardata.RPM_Shift3 = cardata.RPM_Max;
            cardata.RPM_Shift4 = cardata.RPM_Max;
            cardata.RPM_Shift5 = cardata.RPM_Max;
            cardata.RPM_Shift6 = cardata.RPM_Max;
            cardata.RPM_Shift7 = cardata.RPM_Max;

            SendPackage(DashboardPackages.PACK_CARDATA, ByteMethods.ToBytes(cardata));

            // Send leds config..
            //return;
            string[] leds = System.IO.File.ReadAllLines("LEDs.csv");
            byte[]   bf   = new byte[leds.Length * 9 + 1];
            bf[0] = 0;
            int i = 1;
            int k = 0;

            foreach (string led in leds)
            {
                string[] data = led.Split(",".ToCharArray());

                bf[i]     = (byte)(Convert.ToByte(data[4]));
                bf[i + 1] = (byte)(Convert.ToByte(data[1]));
                bf[i + 2] = (byte)(Convert.ToByte(data[2]));
                bf[i + 3] = (byte)(Convert.ToByte(data[3]));
                byte[] bf_tmp = BitConverter.GetBytes(0);
                bf[i + 4] = bf_tmp[0];
                bf[i + 5] = bf_tmp[1];
                bf[i + 6] = 0;
                bf[i + 7] = 0;
                bf[i + 8] = 12;

                i += 9;
                k++;
            }
            SendPackage(DashboardPackages.PACK_PREFS_SHIFTBAR, bf);
            bf    = new byte[leds.Length * 9 + 1];
            bf[0] = 1;
            i     = 1;
            k     = 0;
            foreach (string led in leds)
            {
                string[] data = led.Split(",".ToCharArray());

                bf[i]     = 0;
                bf[i + 1] = 5;
                bf[i + 2] = 0;
                bf[i + 3] = 5;
                byte[] bf_tmp = BitConverter.GetBytes(200);
                bf[i + 4] = bf_tmp[0];
                bf[i + 5] = bf_tmp[1];
                bf[i + 6] = 50;
                bf[i + 7] = Convert.ToByte(((k % 2 == 0) ? 50 : 0));
                bf[i + 8] = 0;

                i += 9;
                k++;
            }
            SendPackage(DashboardPackages.PACK_PREFS_SHIFTBAR, bf);

            return;
        }
Пример #4
0
        private void Fire_LS(object o)
        {
            try
            {
            GameData_LS package = new GameData_LS();

            /** TYRE TEMPERATURES **/
            try
            {
                if (Telemetry.m.Sim.Player.Tyre_Temperature_LF_Middle > 0)
                {
                    package.TyreTemperature_LF = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_LF_Middle - 273.16, 0, 150));
                    package.TyreTemperature_RF = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_RF_Middle - 273.16, 0, 150));
                    package.TyreTemperature_LR = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_LR_Middle - 273.16, 0, 150));
                    package.TyreTemperature_RR = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_RR_Middle - 273.16, 0, 150));
                }
            }
            catch (Exception ex)
            { }
            /** TYRE & BRAKE WEAR **/
            package.TyreWear_F = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Drivers.Player.TyreWear_LF + Telemetry.m.Sim.Drivers.Player.TyreWear_RF, 0, 2) / 2.0);
            package.TyreWear_R = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Drivers.Player.TyreWear_LR + Telemetry.m.Sim.Drivers.Player.TyreWear_RR, 0, 2) / 2.0);
            package.BrakeWear_F = 0;
            package.BrakeWear_R = 0;

            /** CURRENT FUEL INFO **/
            package.Fuel_Litre = Convert.ToUInt16(Limits(Telemetry.m.Sim.Player.Fuel, 0, 150) * 10);
            package.Fuel_Laps = 0;

            /** DRIVING TIMES **/
            package.Laptime_Last = Convert.ToSingle(Limits(Telemetry.m.Sim.Drivers.Player.LapTime_Last,0,1200));
            package.Laptime_Best = Convert.ToSingle(Limits(Telemetry.m.Sim.Drivers.Player.LapTime_Best,0,1200));
            switch (Telemetry.m.Sim.Drivers.Player.SectorsDriven % 3)
            {
                case 0:
                    package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_3_Last - Telemetry.m.Sim.Drivers.Player.Sector_3_Best;
                    break;
                case 1:
                    package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_1_Last - Telemetry.m.Sim.Drivers.Player.Sector_1_Best;
                    break;
                case 2:
                    package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_2_Last - Telemetry.m.Sim.Drivers.Player.Sector_2_Best;
                    break;

            }
            package.Split_Sector = Convert.ToSingle(Limits(package.Split_Sector, -2, 2));
            package.Split_Lap = Telemetry.m.Sim.Drivers.Player.LapTime_Best - Telemetry.m.Sim.Drivers.Player.LapTime_Last;
            package.Split_Lap = Convert.ToSingle(Limits(package.Split_Lap, -2, 2));

            package.RaceTime = (float)Limits(Telemetry.m.Sim.Session.Time - 30, 0, 3600);
            package.RaceLength = 3600;

            SendPackage(DashboardPackages.PACK_GAMEDATA_LS, ByteMethods.ToBytes(package));

            /*** Temporarely do cardata here as well ***/
            CarData cardata = new CarData();
            cardata.RPM_Max = Convert.ToUInt16(Limits(Telemetry.m.Sim.Player.Engine_RPM_Max_Live * rads_to_rpm,200,25000)-200);
            cardata.RPM_Idle = Convert.ToUInt16(Limits(Telemetry.m.Sim.Player.Engine_RPM_Idle_Max * rads_to_rpm,0,7000));

            //cardata.HP_Max = Convert.ToUInt16(EngineCurve.GetMaxHP());
            cardata.Gears = (byte)Limits(Telemetry.m.Sim.Drivers.Player.Gears,0, 10);
            cardata.Fuel_Max = (byte)Limits(Telemetry.m.Sim.Drivers.Player.Fuel_Max,0,100);

            cardata.GearRatio0 = Convert.ToSingle(Limits(GetGearRatio_Pure(0),0,20));
            cardata.GearRatio1 = Convert.ToSingle(Limits(GetGearRatio_Pure(1),0,20));
            cardata.GearRatio2 = Convert.ToSingle(Limits(GetGearRatio_Pure(2),0,20));
            cardata.GearRatio3 = Convert.ToSingle(Limits(GetGearRatio_Pure(3),0,20));
            cardata.GearRatio4 = Convert.ToSingle(Limits(GetGearRatio_Pure(4),0,20));
            cardata.GearRatio5 = Convert.ToSingle(Limits(GetGearRatio_Pure(5),0,20));
            cardata.GearRatio6 = Convert.ToSingle(Limits(GetGearRatio_Pure(6),0,20));
            cardata.GearRatio7 = Convert.ToSingle(Limits(GetGearRatio_Pure(7),0,20));

            //if (Telemetry.m.Sim.Name == "GTR2") // messy bugfix
            /*
            {
                cardata.GearRatio0 = 12.0f;
                cardata.GearRatio1 = cardata.GearRatio0 * 0.85f;
                cardata.GearRatio2 = cardata.GearRatio1 * 0.85f;
                cardata.GearRatio3 = cardata.GearRatio2 * 0.85f;
                cardata.GearRatio4 = cardata.GearRatio3 * 0.85f;
                cardata.GearRatio5 = cardata.GearRatio4 * 0.85f;
                cardata.GearRatio6 = cardata.GearRatio5 * 0.85f;
            }
            ShiftRpm r = new ShiftRpm();
             * cardata.RPM_Shift0 = cardata.RPM_Max;
            cardata.RPM_Shift1 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(1)));
            cardata.RPM_Shift2 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(2)));
            cardata.RPM_Shift3 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(3)));
            cardata.RPM_Shift4 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(4)));
            cardata.RPM_Shift5 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(5)));
            cardata.RPM_Shift6 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(6)));*/
            ShiftRpm r = new ShiftRpm();
            cardata.RPM_Shift0 = cardata.RPM_Max;
            cardata.RPM_Shift1 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
            cardata.RPM_Shift2 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
            cardata.RPM_Shift3 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
            cardata.RPM_Shift4 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
            cardata.RPM_Shift5 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
            cardata.RPM_Shift6 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
            cardata.RPM_Shift7 = (ushort)Limits(cardata.RPM_Max, 0, 25000);

            SendPackage(DashboardPackages.PACK_CARDATA, ByteMethods.ToBytes(cardata));

            // Send leds config..
            //return;
            string[] leds = System.IO.File.ReadAllLines("LEDs.csv");
            byte[] bf = new byte[leds.Length * 9 + 1];
            bf[0] = 0;
            int i = 1;
            int k = 0;
            foreach (string led in leds)
            {
                string[] data = led.Split(",".ToCharArray());

                bf[i] = (byte)(Convert.ToByte(data[4]));
                bf[i + 1] = (byte)(Convert.ToByte(data[1]));
                bf[i + 2] = (byte)(Convert.ToByte(data[2]));
                bf[i + 3] = (byte)(Convert.ToByte(data[3]));
                byte[] bf_tmp = BitConverter.GetBytes(0);
                bf[i + 4] = bf_tmp[0];
                bf[i + 5] = bf_tmp[1];
                bf[i + 6] = 64;
                bf[i + 7] = Convert.ToByte(k * 50 / 16);
                bf[i + 8] = 255;

                i += 9;
                k++;
            }
            SendPackage(DashboardPackages.PACK_PREFS_SHIFTBAR, bf);
            bf = new byte[leds.Length * 9 + 1];
            bf[0] = 1;
            i = 1;
            k = 0;
            foreach (string led in leds)
            {
                string[] data = led.Split(",".ToCharArray());

                bf[i] = 0;
                bf[i + 1] = 5;
                bf[i + 2] = 0;
                bf[i + 3] = 5;
                byte[] bf_tmp = BitConverter.GetBytes(600);
                bf[i + 4] = bf_tmp[0];
                bf[i + 5] = bf_tmp[1];
                bf[i + 6] = 50;
                bf[i + 7] = Convert.ToByte(((k % 2 == 0) ? 50 : 0));
                bf[i + 8] = 200;

                i += 9;
                k++;
            }
            SendPackage(DashboardPackages.PACK_PREFS_SHIFTBAR, bf);

            }
            catch (Exception ex)
            { }
            return;
        }
Пример #5
0
        private void Fire_LS(object o)
        {
            try
            {
                ICar car = Telemetry.m.Sim.Garage.SearchCar(Telemetry.m.Sim.Drivers.Player.CarClass,
                                                            Telemetry.m.Sim.Drivers.Player.CarModel);
                car.Scan();
                car.ScanGeneral();
                car.ScanEngine();

                GameData_LS package = new GameData_LS();

                /** TYRE TEMPERATURES **/
                try
                {
                    if (Telemetry.m.Sim.Player.Tyre_Temperature_LF_Middle > 0)
                    {
                        package.TyreTemperature_LF = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_LF_Middle - 273.16, 0, 150));
                        package.TyreTemperature_RF = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_RF_Middle - 273.16, 0, 150));
                        package.TyreTemperature_LR = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_LR_Middle - 273.16, 0, 150));
                        package.TyreTemperature_RR = Convert.ToByte(Limits(Telemetry.m.Sim.Player.Tyre_Temperature_RR_Middle - 273.16, 0, 150));
                    }
                }
                catch (Exception ex)
                { }
                /** TYRE & BRAKE WEAR **/
                // package.TyreWear_F = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Drivers.Player.Wheel_LeftFront.Wear + Telemetry.m.Sim.Drivers.Player.Wheel_RightFront.Wear, 0, 2) / 2.0);
                //package.TyreWear_R = Convert.ToByte(200 * Limits(Telemetry.m.Sim.Drivers.Player.Wheel_LeftRear.Wear + Telemetry.m.Sim.Drivers.Player.Wheel_RightRear.Wear, 0, 2) / 2.0);
                package.BrakeWear_F = 0;
                package.BrakeWear_R = 0;

                /** CURRENT FUEL INFO **/
                package.Fuel_Litre = Convert.ToUInt16(Limits(Telemetry.m.Sim.Player.Fuel, 0, 150) * 10);
                package.Fuel_Laps  = 0;

                /** DRIVING TIMES **/
                package.Laptime_Last = Convert.ToSingle(Limits(Telemetry.m.Sim.Drivers.Player.LapTime_Last, 0, 1200));
                package.Laptime_Best = Convert.ToSingle(Limits(Telemetry.m.Sim.Drivers.Player.LapTime_Best, 0, 1200));
                switch (Telemetry.m.Sim.Drivers.Player.SectorsDriven % 3)
                {
                case 0:
                    package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_3_Last - Telemetry.m.Sim.Drivers.Player.Sector_3_Best;
                    break;

                case 1:
                    package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_1_Last - Telemetry.m.Sim.Drivers.Player.Sector_1_Best;
                    break;

                case 2:
                    package.Split_Sector = Telemetry.m.Sim.Drivers.Player.Sector_2_Last - Telemetry.m.Sim.Drivers.Player.Sector_2_Best;
                    break;
                }
                package.Split_Sector = Convert.ToSingle(Limits(package.Split_Sector, -2, 2));
                package.Split_Lap    = Telemetry.m.Sim.Drivers.Player.LapTime_Best - Telemetry.m.Sim.Drivers.Player.LapTime_Last;
                package.Split_Lap    = Convert.ToSingle(Limits(package.Split_Lap, -2, 2));

                package.RaceTime   = (float)Limits(Telemetry.m.Sim.Session.Time - 30, 0, 3600);
                package.RaceLength = 3600;

                SendPackage(DashboardPackages.PACK_GAMEDATA_LS, ByteMethods.ToBytes(package));

                /*** Temporarely do cardata here as well ***/
                CarData cardata = new CarData();

                cardata.RPM_Max  = Convert.ToUInt16(Limits(Telemetry.m.Sim.Player.Engine_RPM_Max_Live, 200, 25000) - 200);
                cardata.RPM_Idle = Convert.ToUInt16(Limits(car.Engine.IdleRPM * rads_to_rpm, 0, 7000));
                cardata.RPM_Idle = 1000;

                //cardata.HP_Max = Convert.ToUInt16(EngineCurve.GetMaxHP());
                cardata.Gears = (byte)Limits(car.Gearbox.Gears, 0, 10);
                //cardata.Fuel_Max = (byte)Limits(car.General.Fueltank,0,100);
                cardata.Fuel_Max   = 100;
                cardata.GearRatio0 = Convert.ToSingle(Limits(GetGearRatio_Pure(0), 0, 20));
                cardata.GearRatio1 = Convert.ToSingle(Limits(GetGearRatio_Pure(1), 0, 20));
                cardata.GearRatio2 = Convert.ToSingle(Limits(GetGearRatio_Pure(2), 0, 20));
                cardata.GearRatio3 = Convert.ToSingle(Limits(GetGearRatio_Pure(3), 0, 20));
                cardata.GearRatio4 = Convert.ToSingle(Limits(GetGearRatio_Pure(4), 0, 20));
                cardata.GearRatio5 = Convert.ToSingle(Limits(GetGearRatio_Pure(5), 0, 20));
                cardata.GearRatio6 = Convert.ToSingle(Limits(GetGearRatio_Pure(6), 0, 20));
                cardata.GearRatio7 = Convert.ToSingle(Limits(GetGearRatio_Pure(7), 0, 20));


                //if (Telemetry.m.Sim.Name == "GTR2") // messy bugfix

                /*
                 * {
                 *  cardata.GearRatio0 = 12.0f;
                 *  cardata.GearRatio1 = cardata.GearRatio0 * 0.85f;
                 *  cardata.GearRatio2 = cardata.GearRatio1 * 0.85f;
                 *  cardata.GearRatio3 = cardata.GearRatio2 * 0.85f;
                 *  cardata.GearRatio4 = cardata.GearRatio3 * 0.85f;
                 *  cardata.GearRatio5 = cardata.GearRatio4 * 0.85f;
                 *  cardata.GearRatio6 = cardata.GearRatio5 * 0.85f;
                 * }*/
                ShiftRpm r = new ShiftRpm();
                cardata.RPM_Shift0 = cardata.RPM_Max;
                cardata.RPM_Shift1 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(1)));
                cardata.RPM_Shift2 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(2)));
                cardata.RPM_Shift3 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(3)));
                cardata.RPM_Shift4 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(4)));
                cardata.RPM_Shift5 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(5)));
                cardata.RPM_Shift6 = Convert.ToUInt16(r.Get(1, r.GetRatioBetween(6)));

                /*ShiftRpm r = new ShiftRpm();
                 * cardata.RPM_Shift0 = cardata.RPM_Max;
                 * cardata.RPM_Shift1 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
                 * cardata.RPM_Shift2 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
                 * cardata.RPM_Shift3 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
                 * cardata.RPM_Shift4 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
                 * cardata.RPM_Shift5 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
                 * cardata.RPM_Shift6 = (ushort)Limits(cardata.RPM_Max, 0, 25000);
                 * cardata.RPM_Shift7 = (ushort)Limits(cardata.RPM_Max, 0, 25000);*/

                SendPackage(DashboardPackages.PACK_CARDATA, ByteMethods.ToBytes(cardata));

                // Send leds config..
                //return;
                string[] leds = System.IO.File.ReadAllLines("LEDs.csv");
                byte[]   bf   = new byte[leds.Length * 9 + 1];
                bf[0] = 0;
                int i = 1;
                int k = 0;
                foreach (string led in leds)
                {
                    string[] data = led.Split(",".ToCharArray());

                    bf[i]     = (byte)(Convert.ToByte(data[4]));
                    bf[i + 1] = (byte)(Convert.ToByte(data[1]));
                    bf[i + 2] = (byte)(Convert.ToByte(data[2]));
                    bf[i + 3] = (byte)(Convert.ToByte(data[3]));
                    byte[] bf_tmp = BitConverter.GetBytes(0);
                    bf[i + 4] = bf_tmp[0];
                    bf[i + 5] = bf_tmp[1];
                    bf[i + 6] = 64;
                    bf[i + 7] = Convert.ToByte(k * 50 / 16);
                    bf[i + 8] = 255;

                    i += 9;
                    k++;
                }
                string t = BitConverter.ToString(bf);
                SendPackage(DashboardPackages.PACK_PREFS_SHIFTBAR, bf);

                /*
                 * bf = new byte[leds.Length * 9 + 1];
                 * bf[0] = 1;
                 * i = 1;
                 * k = 0;
                 * foreach (string led in leds)
                 * {
                 * string[] data = led.Split(",".ToCharArray());
                 *
                 * bf[i] = 0;
                 * bf[i + 1] = 5;
                 * bf[i + 2] = 0;
                 * bf[i + 3] = 5;
                 * byte[] bf_tmp = BitConverter.GetBytes(600);
                 * bf[i + 4] = bf_tmp[0];
                 * bf[i + 5] = bf_tmp[1];
                 * bf[i + 6] = 50;
                 * bf[i + 7] = Convert.ToByte(((k % 2 == 0) ? 50 : 0));
                 * bf[i + 8] = 200;
                 *
                 * i += 9;
                 * k++;
                 * }
                 * SendPackage(DashboardPackages.PACK_PREFS_SHIFTBAR, bf);
                 */
            }
            catch (Exception ex)
            { }
            return;
        }