diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 1fc6ad6..0498a75 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -24,7 +24,7 @@ namespace Meade.net.Telescope.UnitTests internal double declination { get; set; } = 45; internal string SiteLatitudeString { get; set; } = "testLatString"; - internal double SiteLatitudeValue { get; set; } = 123.45; + internal double SiteLatitudeValue { get; set; } = 12.45; internal string telescopeDate { get; set; } = "10/15/20"; internal string telescopeTime { get; set; } = "20:15:10"; @@ -1633,6 +1633,28 @@ namespace Meade.net.Telescope.UnitTests Assert.That(_telescope.AtPark, Is.True); } + [Test] + public void Park_WhenLX200NotParked_ThenSendsParkCommand() + { + var alt = 77.55; + var altAsDM = "77*30"; + _utilMock.Setup(x => x.DegreesToDM(alt, "*", "", 2)).Returns(altAsDM); + + var az = 180; + var azAsDM = "180*00"; + _utilMock.Setup(x => x.DegreesToDM(az, "*", "", 2)).Returns(azAsDM); + + _sharedResourcesWrapperMock.Setup(x => x.SendBool("Sa+77*30", false)).Returns(true); + _sharedResourcesWrapperMock.Setup(x => x.SendBool("Sz180*00", false)).Returns(true); + + ConnectTelescope(TelescopeList.LX200CLASSIC); + Assert.That(_telescope.AtPark, Is.False); + + _telescope.Park(); + + Assert.That(_telescope.AtPark, Is.True); + } + [Test] public void Park_WhenParked_ThenDoesNothing() { diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 4d1d24f..b334430 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -2905,8 +2905,8 @@ namespace ASCOM.Meade.net throw new ArgumentOutOfRangeException($"Target Altitude cannot be above 90."); var dms = SharedResourcesWrapper.IsLongFormat - ? _utilities.DegreesToDMS(value, "*", "'", "", _digitsDe) - : _utilities.DegreesToDM(value, "*", "", _digitsDe); + ? _utilities.DegreesToDMS(value, "*", "'", "", 2) + : _utilities.DegreesToDM(value, "*", "", 2); var s = value < 0 ? "-" : "+"; @@ -2945,7 +2945,7 @@ namespace ASCOM.Meade.net if (value >= 360) throw new ArgumentOutOfRangeException($"Target Altitude cannot be above 360."); - var dms = _utilities.DegreesToDM(value, "*", "", _digitsDe); + var dms = _utilities.DegreesToDM(value, "*", "", 2); var command = $"Sz{dms}";