Ejemplo n.º 1
0
        public void LogInstruction(InstructionCNC instruction)
        {
            var axes = instruction as Axes;

            if (axes == null)
            {
                throw new NotImplementedException();
            }

            _u.LoadInstruction(axes.InstructionU);
            _v.LoadInstruction(axes.InstructionV);
            _x.LoadInstruction(axes.InstructionX);
            _y.LoadInstruction(axes.InstructionY);

            while (_u.IsActive || _v.IsActive || _x.IsActive || _y.IsActive)
            {
                var minActivation = int.MaxValue;

                if (_u.IsActive)
                {
                    minActivation = Math.Min(minActivation, _u.NextActivation);
                }

                if (_v.IsActive)
                {
                    minActivation = Math.Min(minActivation, _v.NextActivation);
                }

                if (_x.IsActive)
                {
                    minActivation = Math.Min(minActivation, _x.NextActivation);
                }

                if (_y.IsActive)
                {
                    minActivation = Math.Min(minActivation, _y.NextActivation);
                }

                //TODO to be precise, change dir should be considered
                _u.TryStep(minActivation);
                _v.TryStep(minActivation);
                _x.TryStep(minActivation);
                _y.TryStep(minActivation);
            }
        }
Ejemplo n.º 2
0
 private void Execute(InstructionCNC instruction, bool duplicateUV = true)
 {
     Execute(new[] { instruction }, duplicateUV);
 }