/// <summary>
        /// Drives the diseqc motor in the direction specified by the number of steps
        /// </summary>
        /// <param name="direction">The direction.</param>
        /// <param name="numberOfSteps">The number of steps.</param>
        public void DriveMotor(DiSEqCDirection direction, byte numberOfSteps)
        {
            if (_cardHandler.IsLocal == false)
            {
                return;
            }

            IDiSEqCMotor motor = _cardHandler.Card.DiSEqCMotor;

            if (motor == null)
            {
                return;
            }
            motor.DriveMotor(direction, numberOfSteps);
        }
 /// <summary>
 /// Drives the motor.
 /// </summary>
 /// <param name="direction">The direction.</param>
 /// <param name="steps">the number of steps to move.</param>
 public void DriveMotor(DiSEqCDirection direction, byte steps)
 {
     if (steps == 0)
     {
         return;
     }
     StopMotor();
     Log.Log.Write("DiSEqC: drive motor {0} for {1} steps", direction.ToString(), steps);
     byte[] cmd = new byte[4];
     cmd[0] = (byte)DiSEqCFraming.FirstTransmission;
     if (direction == DiSEqCDirection.West)
     {
         cmd[1] = (byte)DiSEqCMovement.Azimutal;
         cmd[2] = (byte)DiSEqCCommands.DriveWest;
         _currentStepsAzimuth -= steps;
     }
     else if (direction == DiSEqCDirection.East)
     {
         cmd[1] = (byte)DiSEqCMovement.Azimutal;
         cmd[2] = (byte)DiSEqCCommands.DriveEast;
         _currentStepsAzimuth += steps;
     }
     else if (direction == DiSEqCDirection.Up)
     {
         cmd[1] = (byte)DiSEqCMovement.Elivation;
         cmd[2] = (byte)DiSEqCCommands.DriveWest;
         _currentStepsElevation -= steps;
     }
     else if (direction == DiSEqCDirection.Down)
     {
         cmd[1] = (byte)DiSEqCMovement.Elivation;
         cmd[2] = (byte)DiSEqCCommands.DriveEast;
         _currentStepsElevation += steps;
     }
     cmd[3] = (byte)(0x100 - steps);
     _controller.SendDiSEqCCommand(cmd);
     System.Threading.Thread.Sleep(100);
     //System.Threading.Thread.Sleep(1000*steps);
     //StopMotor();
 }
 public void DiSEqCDriveMotor(int cardId, DiSEqCDirection direction, byte numberOfSteps)
 {
   if (ValidateTvControllerParams(cardId))
     return;
   _cards[cardId].DisEqC.DriveMotor(direction, numberOfSteps);
 }
    /// <summary>
    /// Drives the diseqc motor in the direction specified by the number of steps
    /// </summary>
    /// <param name="direction">The direction.</param>
    /// <param name="numberOfSteps">The number of steps.</param>
    public void DriveMotor(DiSEqCDirection direction, byte numberOfSteps)
    {
      if (_cardHandler.IsLocal == false)
      {
        return;
      }

      IDiSEqCMotor motor = _cardHandler.Card.DiSEqCMotor;
      if (motor == null)
        return;
      motor.DriveMotor(direction, numberOfSteps);
    }
Exemple #5
0
 /// <summary>
 /// Drives the motor.
 /// </summary>
 /// <param name="direction">The direction.</param>
 /// <param name="steps">the number of steps to move.</param>
 public void DriveMotor(DiSEqCDirection direction, byte steps)
 {
   if (steps == 0)
     return;
   StopMotor();
   Log.Log.Write("DiSEqC: drive motor {0} for {1} steps", direction.ToString(), steps);
   byte[] cmd = new byte[4];
   cmd[0] = (byte)DiSEqCFraming.FirstTransmission;
   if (direction == DiSEqCDirection.West)
   {
     cmd[1] = (byte)DiSEqCMovement.Azimutal;
     cmd[2] = (byte)DiSEqCCommands.DriveWest;
     _currentStepsAzimuth -= steps;
   }
   else if (direction == DiSEqCDirection.East)
   {
     cmd[1] = (byte)DiSEqCMovement.Azimutal;
     cmd[2] = (byte)DiSEqCCommands.DriveEast;
     _currentStepsAzimuth += steps;
   }
   else if (direction == DiSEqCDirection.Up)
   {
     cmd[1] = (byte)DiSEqCMovement.Elivation;
     cmd[2] = (byte)DiSEqCCommands.DriveWest;
     _currentStepsElevation -= steps;
   }
   else if (direction == DiSEqCDirection.Down)
   {
     cmd[1] = (byte)DiSEqCMovement.Elivation;
     cmd[2] = (byte)DiSEqCCommands.DriveEast;
     _currentStepsElevation += steps;
   }
   cmd[3] = (byte)(0x100 - steps);
   _controller.SendDiSEqCCommand(cmd);
   System.Threading.Thread.Sleep(100);
   //System.Threading.Thread.Sleep(1000*steps);
   //StopMotor();
 }