internal override void Stop()
 {
     base.Stop();
     ResetCylinders();
     AddedMotion.Add(new MomentaryPositionAndTimingFrameDataModel()
     {
         Time = TimeBetweenTicksMS, C1 = (byte)Cylinder1
     });
     new PositionAndTimingDataModel()
     {
         PostionsAndTimings = AddedMotion.ToArray()
     }.SaveDataToFile(SavePath);
 }
        protected override void Tick()
        {
            const byte SensitivtyBase = 127;

            int XAxis       = 32767;
            int YAxis       = 32767;
            int Sensitivity = 65534;

            Vector NormalizedVector;

            MomentaryPositionAndTimingFrameDataModel DataFrame = new MomentaryPositionAndTimingFrameDataModel();

            DataFrame.Time = TimeBetweenTicksMS;

            JoyStick.Poll();
            JoystickUpdate[] Data = JoyStick.GetBufferedData();
            int Num = 0;

            Sensitivity = ClampCast(SensitivtyBase * SensitivtyCalc);

            foreach (DeviceObjectInstance Axis in Owner.AxisInfos)
            {
                if (Data.Any(x => x.RawOffset == Axis.Offset + OtherAxisOffsetOffset || x.RawOffset == Axis.Offset))
                {
                    Axiss[Num] = Data.Last(x => x.RawOffset == Axis.Offset + OtherAxisOffsetOffset || x.RawOffset == Axis.Offset).Value;
                }
                if (Axis == JoyAxisForMechXAxisTilt)
                {
                    XAxis = Axiss[Num];
                }
                if (Axis == JoyAxisForMechYAxisTilt)
                {
                    YAxis = Axiss[Num];
                }
                if (Axis == JoyAxisForMechSensitivity)
                {
                    Sensitivity    = Axiss[Num];
                    SensitivtyCalc = CalculateUnsighedNormal(Sensitivity);
                    Sensitivity    = ClampCast(SensitivtyBase * SensitivtyCalc);
                }
                Num++;
            }

            NormalizedVector = CalculateNormalVector(new Vector()
            {
                X = (float)XAxis, Y = (float)YAxis
            });

            MoveForXY(NormalizedVector.X, NormalizedVector.Y, (byte)Sensitivity);


            DataFrame.C1 = (byte)Cylinder1;
            DataFrame.C2 = (byte)Cylinder2;

            Num = 0;
            foreach (DeviceObjectInstance POV in Owner.POVInfos)
            {
                if (Data.Any(x => x.RawOffset == POV.Offset + POVOffsetOffset))
                {
                    POVs[Num] = Data.Last(x => x.RawOffset == POV.Offset + POVOffsetOffset).Value;
                }
                Num++;
            }

            DoButtons(Data, ref DataFrame);

            //add noise on top of the regualr movement
            if (AddSytheticNoiseEffect)
            {
                DataFrame.C1 = ClampCast(DataFrame.C1 + SytheticNoiseEffectBaseHalfValue - RandomNumber.Next(0, SytheticNoiseEffectBaseValue));
                DataFrame.C2 = ClampCast(DataFrame.C2 + SytheticNoiseEffectBaseHalfValue - RandomNumber.Next(0, SytheticNoiseEffectBaseValue));
            }


            AddedMotion.Add(DataFrame);
            SetCylinders(DataFrame);
        }