/// <summary> /// Starts or stops the telescope. /// Positive movement is right or down; negative movement is left or up. /// </summary> /// <param name="Direction">Movement direction: coordinate increase or decrease.</param> /// <param name="DeviceID">Target device (preferably motor) internal system ID.</param> /// <param name="Speed">Speed from 0 (stop) to 9 (max slew rate).</param> public void StartSlewing(SlewDirections Direction, DeviceIDs DeviceID, byte Speed) { if (Speed != 0) { _log.LogVerbose($"Slewing device {DeviceID} to {Direction} at speed {Speed}."); } else { _log.LogVerbose($"Stopping device {DeviceID}."); } byte[] cmd = new byte[8]; cmd[0] = 0x50; cmd[1] = 0x02; if (DeviceID == DeviceIDs.ALT_Controller) { cmd[2] = (byte)DeviceID; } else if (DeviceID == DeviceIDs.AZM_Controller) { cmd[2] = (byte)DeviceID; } else { throw new ArgumentException("Device ID must be 0x10 or 0x11."); } if (Direction == SlewDirections.POS) { cmd[3] = 0x24; } else { cmd[3] = 0x25; } if (Speed > 9 || Speed < 0) { throw new ArgumentException("Speed value must be from 0 to 9."); } else { cmd[4] = Speed; } _helper.DoCommand(Encoding.GetString(cmd)); }
public virtual bool CanCreate(uint vid, uint pid) { return(DeviceIDs.Any(x => x.VID == vid && x.PID == pid)); }