Exemple #1
0
            /// <summary>
            /// Switch the axis motor on (in slow speed) during a specified time
            /// </summary>
            /// <param name="aDirection">Direction to turn.</param>
            /// <param name="duration">The duration in milli seconds that the motor should turn</param>
            public void Pulse(Direction aDirection, Int32 duration)
            {
                logger.Debug("Pulse {0}, {1}", aDirection, duration);

                if (pulseOffCommand != 0)
                {
                    logger.Debug("Already pulsing: ignore");
                    return;
                }

                // Switch to slow speed
                SendCommand(AxisCommands.FastOff);

                // Start turning in the right direction
                if (aDirection == Direction.forward)
                {
                    logger.Debug("Start pulse {0}", AxisCommands.RightOn);
                    SendCommand(AxisCommands.RightOn);
                    pulseOffCommand = AxisCommands.RightOff;
                }
                else
                {
                    logger.Debug("Start pulse {0}", AxisCommands.LeftOn);
                    SendCommand(AxisCommands.LeftOn);
                    pulseOffCommand = AxisCommands.LeftOff;
                }

                // Start a timer
                pulseTimer = new System.Threading.Timer(PulseTimeout, this, duration, Timeout.Infinite);
            }
Exemple #2
0
            private void EndPulse()
            {
                logger.Debug("Stop pulse {0}", pulseOffCommand);
                // Stop the movement
                SendCommand(pulseOffCommand);
                pulseOffCommand = 0;

                // Go back to fast mode
                SendCommand(AxisCommands.FastOn);
            }
Exemple #3
0
 /// <summary>
 /// Write a command to the controller
 /// </summary>
 /// <param name="aCommand">The command to be written. It is the <i>generic axis</i> command</param>
 protected void SendCommand(AxisCommands aCommand)
 {
     Debug.Assert(CommandRegister.ContainsKey(aCommand));
     Controller.Commands theCommand = CommandRegister[aCommand];
     WriteCommand(theCommand);
 }
Exemple #4
0
 /// <summary>
 /// Write a command to the controller
 /// </summary>
 /// <param name="aCommand">The command to be written. It is the <i>generic axis</i> command</param>
 protected void SendCommand(AxisCommands aCommand)
 {
     Debug.Assert(CommandRegister.ContainsKey(aCommand));
     Controller.Commands theCommand = CommandRegister[aCommand];
     WriteCommand(theCommand);
 }
Exemple #5
0
            private void EndPulse()
            {
                logger.Debug("Stop pulse {0}", pulseOffCommand);
                // Stop the movement
                SendCommand(pulseOffCommand);
                pulseOffCommand = 0;

                // Go back to fast mode
                SendCommand(AxisCommands.FastOn);
            }
Exemple #6
0
            /// <summary>
            /// Switch the axis motor on (in slow speed) during a specified time
            /// </summary>
            /// <param name="aDirection">Direction to turn.</param>
            /// <param name="duration">The duration in milli seconds that the motor should turn</param>
            public void Pulse(Direction aDirection, Int32 duration)
            {
                logger.Debug("Pulse {0}, {1}", aDirection, duration);

                if (pulseOffCommand != 0)
                {
                    logger.Debug("Already pulsing: ignore");
                    return;
                }

                // Switch to slow speed
                SendCommand(AxisCommands.FastOff);

                // Start turning in the right direction
                if (aDirection == Direction.forward)
                {
                    logger.Debug("Start pulse {0}", AxisCommands.RightOn);
                    SendCommand(AxisCommands.RightOn);
                    pulseOffCommand = AxisCommands.RightOff;
                }
                else
                {
                    logger.Debug("Start pulse {0}", AxisCommands.LeftOn);
                    SendCommand(AxisCommands.LeftOn);
                    pulseOffCommand = AxisCommands.LeftOff;
                }

                // Start a timer
                pulseTimer = new System.Threading.Timer(PulseTimeout, this, duration, Timeout.Infinite);
            }