Adding some experimental support for the LX-200 EMC

This commit is contained in:
2019-09-30 22:10:00 +01:00
parent f33ca49592
commit a61915a3b5
3 changed files with 46 additions and 5 deletions
@@ -349,12 +349,18 @@ namespace Meade.net.Telescope.UnitTests
_telescope.Connected = expectedConnected; _telescope.Connected = expectedConnected;
Assert.That(_telescope.Connected, Is.EqualTo(expectedConnected)); Assert.That(_telescope.Connected, Is.EqualTo(expectedConnected));
}
if (expectedConnected)
{
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
}
}
[Test] [Test]
public void Connected_Set_WhenConnecting_Then_ConnectsToSerialDevice() public void Connected_Set_WhenConnectingLX200GPS_Then_ConnectsToSerialDevice()
{ {
var productName = "LX2001"; var productName = TelescopeList.LX200GPS;
var firmware = string.Empty; var firmware = string.Empty;
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName); _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
@@ -367,6 +373,21 @@ namespace Meade.net.Telescope.UnitTests
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"),Times.Once); _sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"),Times.Once);
} }
[Test]
public void Connected_Set_WhenConnectingToLX200EMC_Then_ConnectsToSerialDevice()
{
var productName = TelescopeList.LX200CLASSIC;
var firmware = string.Empty;
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(firmware);
_telescope.Connected = true;
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>()), Times.Once);
_sharedResourcesWrapperMock.Verify(x => x.SendString(":GZ#"), Times.Never);
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}#"), Times.Never);
}
[Test] [Test]
public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing() public void Connected_Set_SettingTrueWhenTrue_ThenDoesNothing()
@@ -414,6 +435,7 @@ namespace Meade.net.Telescope.UnitTests
[TestCase("Autostar", "43Eg", true)] [TestCase("Autostar", "43Eg", true)]
[TestCase("Autostar II", "", false)] [TestCase("Autostar II", "", false)]
[TestCase("LX2001", "", true)] [TestCase("LX2001", "", true)]
[TestCase(":GVP", "", false)] //LX200 Classic
public void IsNewPulseGuidingSupported_ThenIsSupported_ThenReturnsTrue(string productName, string firmware, bool isSupported) public void IsNewPulseGuidingSupported_ThenIsSupported_ThenReturnsTrue(string productName, string firmware, bool isSupported)
{ {
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName); _sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(productName);
+18 -2
View File
@@ -456,6 +456,15 @@ namespace ASCOM.Meade.net
return false; return false;
} }
private bool IsLongFormatSupported()
{
if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC)
{
return false;
}
return true;
}
private bool IsGuideRateSettingSupported() private bool IsGuideRateSettingSupported()
{ {
if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200GPS) if (_sharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
@@ -472,8 +481,15 @@ namespace ASCOM.Meade.net
return comparison >= 0; return comparison >= 0;
} }
public bool IsLongFormat { get; private set; }
public void SetLongFormat(bool setLongFormat) public void SetLongFormat(bool setLongFormat)
{ {
IsLongFormat = false;
if (!IsLongFormatSupported())
return;
_sharedResourcesWrapper.Lock(() => _sharedResourcesWrapper.Lock(() =>
{ {
var result = _sharedResourcesWrapper.SendString(":GZ#"); var result = _sharedResourcesWrapper.SendString(":GZ#");
@@ -481,9 +497,9 @@ namespace ASCOM.Meade.net
//Returns: DDD*MM# or DDD*MMSS# //Returns: DDD*MM# or DDD*MMSS#
//The current telescope Azimuth depending on the selected precision. //The current telescope Azimuth depending on the selected precision.
bool isLongFormat = result.Length > 6; IsLongFormat = result.Length > 6;
if (isLongFormat != setLongFormat) if (IsLongFormat != setLongFormat)
{ {
_utilities.WaitForMilliseconds(500); _utilities.WaitForMilliseconds(500);
_sharedResourcesWrapper.SendBlind(":U#"); _sharedResourcesWrapper.SendBlind(":U#");
+3
View File
@@ -23,7 +23,10 @@
// ReSharper disable once InconsistentNaming // ReSharper disable once InconsistentNaming
public static readonly string LX200GPS_42G = "4.2G"; public static readonly string LX200GPS_42G = "4.2G";
#endregion
#region LX200EMC
public static readonly string LX200CLASSIC = ":GVP"; //GVP command is not supported!
#endregion #endregion
} }
} }