public void SyncToTarget() { CheckConnected(); if (Platform.IsTracking) { Platform.SyncToCoordinates(m_mount.TargetRightAscension, m_mount.TargetDeclination); } else { m_mount.SyncToTarget(); } }
public void TestSyncing() { Assert.IsFalse(device.Connected); device.Connected = true; Assert.IsTrue(device.CanSync); Assert.IsFalse(device.CanSyncAltAz); Assert.ThrowsException <ASCOM.MethodNotImplementedException>(() => device.SyncToAltAz(0, 0)); /* * for (int ra = 0; ra < 24 * 60 * 60; ra++) * { * for (int dec = -89 * 60 * 60; dec < 89 * 60 * 60; dec++) * { * double RA = ra / 3600.0; * double DEC = dec / 3600.0; * device.SyncToCoordinates(RA, DEC); * Assert.AreEqual(RA, device.RightAscension); * Assert.AreEqual(DEC, device.Declination); * } * } */ MechanicalPoint p = new MechanicalPoint(); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(0.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(90.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(-0.1, 0)); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(+24.1, 0)); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(0, -91)); Assert.ThrowsException <ASCOM.InvalidValueException>(() => device.SyncToCoordinates(0, +91)); device.SyncToCoordinates(0, 0); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(90.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(0.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.SyncToCoordinates(10, 0); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(10.0, p.RAm); Assert.AreEqual(90.0, p.DECm); Assert.AreEqual(10.0, p.RAsky); Assert.AreEqual(0.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.SyncToCoordinates(14, 0); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(14.0, p.RAm); Assert.AreEqual(90.0, p.DECm); Assert.AreEqual(14.0, p.RAsky); Assert.AreEqual(0.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.SyncToCoordinates(0, 10); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(80.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(10.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.SyncToCoordinates(0, -10); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(100.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(-10.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.SyncToCoordinates(14, -10); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(14.0, p.RAm); Assert.AreEqual(100.0, p.DECm); Assert.AreEqual(14.0, p.RAsky); Assert.AreEqual(-10.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.SyncToCoordinates(0, 0); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(90.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(0.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.TargetRightAscension = 10; device.TargetDeclination = 0; device.SyncToTarget(); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(10.0, p.RAm); Assert.AreEqual(90.0, p.DECm); Assert.AreEqual(10.0, p.RAsky); Assert.AreEqual(0.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.TargetRightAscension = 14; device.TargetDeclination = 0; device.SyncToTarget(); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(14.0, p.RAm); Assert.AreEqual(90.0, p.DECm); Assert.AreEqual(14.0, p.RAsky); Assert.AreEqual(0.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.TargetRightAscension = 0; device.TargetDeclination = 10; device.SyncToTarget(); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(80.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(10.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.TargetRightAscension = 0; device.TargetDeclination = -10; device.SyncToTarget(); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(0.0, p.RAm); Assert.AreEqual(100.0, p.DECm); Assert.AreEqual(0.0, p.RAsky); Assert.AreEqual(-10.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); device.TargetRightAscension = 14; device.TargetDeclination = -10; device.SyncToTarget(); Assert.IsFalse(getCurrentMechanicalPosition(ref p)); Assert.AreEqual(14.0, p.RAm); Assert.AreEqual(100.0, p.DECm); Assert.AreEqual(14.0, p.RAsky); Assert.AreEqual(-10.0, p.DECsky); Assert.AreEqual(MechanicalPoint.PointingStates.POINTING_NORMAL, p.PointingState); }