/// <summary> /// Create a command for movement. Only the "data" field is sent to the MCU; the rest of the fields /// exist for internal tracking and estimations within the MCU manager. /// </summary> /// <param name="data"></param> /// <param name="CMDType"></param> /// <param name="azDir"></param> /// <param name="elDir"></param> /// <param name="AZSpeed"></param> /// <param name="ElSpeed"></param> public MCUCommand(ushort[] data, MCUCommandType CMDType, RadioTelescopeDirectionEnum azDir, RadioTelescopeDirectionEnum elDir, int AZSpeed, int ElSpeed) { CommandType = CMDType; commandData = data; AzimuthDirection = azDir; ElevationDirection = elDir; AzimuthSpeed = AZSpeed; ElevationSpeed = ElSpeed; }
/// <summary> /// send a clear move to the MCU to stop a jog /// </summary> public MovementResult ExecuteRadioTelescopeStopJog(MCUCommandType stopType) { MovementResult result = MovementResult.None; if (RadioTelescope.PLCDriver.CurrentMovementPriority != MovementPriority.Jog) { return(result); } if (Monitor.TryEnter(MovementLock)) { if (stopType == MCUCommandType.ControlledStop) { if (RadioTelescope.PLCDriver.Cancel_move()) { result = MovementResult.Success; } } else if (stopType == MCUCommandType.ImmediateStop) { if (RadioTelescope.PLCDriver.ImmediateStop()) { result = MovementResult.Success; } } else { throw new ArgumentException("Jogs can only be stopped with a controlled stop or immediate stop."); } RadioTelescope.PLCDriver.CurrentMovementPriority = MovementPriority.None; Monitor.Exit(MovementLock); } return(result); }
/// <summary> /// create a MCU command and record the current time /// </summary> /// <param name="data"></param> /// <param name="CMDType"></param> public MCUCommand(ushort[] data, MCUCommandType CMDType) { CommandType = CMDType; commandData = data; }