示例#1
0
        /// <summary>
        /// Converts the supplied targetFeedRate to a millisecond delay value to be used between step pulses, and a step resolution
        /// </summary>
        /// <param name="targetFeedRate">Desired Feed Rate in IPM</param>
        /// <param name="resolution">Resulting feed rate to be used</param>
        /// <returns>millisecond step pulse delay value to pass to the machine</returns>
        public int CalculateStepDelayFromFeedRate(int targetFeedRate, out FeedRate.StepResolutions resolution)
        {
            //TODO: These need to be stored as settings with the ability to measure them and determine their values.. right now everything
            //      is hard coded from the charting of my manual trial and error

            if (targetFeedRate > FeedRateMaximum) targetFeedRate = FeedRateMaximum;
            if (targetFeedRate < 5) targetFeedRate = 5;

            resolution = FeedRate.StepResolutions.Half;     //TODO: We've calculated these all on half steps which seem to work great for the full range
            // (Really making me wonder why I support changing resolutions)

            if (targetFeedRate > 50) return LinearInterpolation(50, 17, targetFeedRate, 60, 9);          // 51 to 60
            if (targetFeedRate > 40) return LinearInterpolation(40, 28, targetFeedRate, 50, 17);          // 41 to 50
            if (targetFeedRate > 30) return LinearInterpolation(30, 42, targetFeedRate, 40, 28);          // 31 to 40
            if (targetFeedRate > 20) return LinearInterpolation(20, 80, targetFeedRate, 30, 42);          // 21 to 30
            if (targetFeedRate > 10) return LinearInterpolation(10, 170, targetFeedRate, 20, 80);          // 11 to 20
            if (targetFeedRate >= 5) return LinearInterpolation(5, 350, targetFeedRate, 10, 170);          // 5 to 10

            return 40;      //Not used
        }
示例#2
0
文件: Machine.cs 项目: gflerm/DazCAM
 private void SendStepResolution(FeedRate.StepResolutions resolution)
 {
     _resolution = resolution;
     string resolutionCmd = "StepResolution:" + ((int)_resolution).ToString();
     SendCommand(resolutionCmd);
 }