From f6556716a54e4661b6c7c121ac4efe0aa20e4463 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 18 Aug 2019 22:43:38 +0100 Subject: [PATCH] Modified the precision toggle to only use the first letter of the response rather than try to detect the entire string --- Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs | 8 ++++---- Meade.net.Telescope/Telescope.cs | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs index 02430a6..6f0f5d0 100644 --- a/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs +++ b/Meade.net.Telescope.UnitTests/TelescopeUnitTests.cs @@ -752,23 +752,23 @@ namespace Meade.net.Telescope.UnitTests _profileProperties.Precision = desiredPresision; var currentPrecision = telescopePrecision; - _sharedResourcesWrapperMock.Setup(x => x.SendString(":P#")).Returns(() => + _sharedResourcesWrapperMock.Setup(x => x.SendChar(":P#")).Returns(() => { currentPrecision = !currentPrecision; switch (currentPrecision) { case true: - return "HIGH PRECISION"; + return "H"; default: - return "LOW PRECISION"; + return "L"; } }); _telescope.Connected = true; Assert.That(currentPrecision, Is.EqualTo(finalPrecision)); - _sharedResourcesWrapperMock.Verify(x => x.SendString(":P#"), Times.AtLeastOnce); + _sharedResourcesWrapperMock.Verify(x => x.SendChar(":P#"), Times.AtLeastOnce); } [Test] diff --git a/Meade.net.Telescope/Telescope.cs b/Meade.net.Telescope/Telescope.cs index 913e9d1..a882d82 100644 --- a/Meade.net.Telescope/Telescope.cs +++ b/Meade.net.Telescope/Telescope.cs @@ -489,17 +489,18 @@ namespace ASCOM.Meade.net private bool TogglePrecision() { - var result = _sharedResourcesWrapper.SendString(":P#"); + LogMessage("TogglePrecision", $"Toggling slewing precision"); + var result = _sharedResourcesWrapper.SendChar(":P#"); //:P# Toggles High Precsion Pointing. When High precision pointing is enabled scope will first allow the operator to center a nearby bright star before moving to the actual target. //Returns: //“HIGH PRECISION” Current setting after this command. //“LOW PRECISION” Current setting after this command. - + LogMessage("TogglePrecision", $"Result: {result}"); bool highPrecision = false; switch (result) { - case "HIGH PRECISION": + case "H": highPrecision = true; break; }