Added support for being able to have ASCOM see a value for guide rate.
This commit is contained in:
@@ -769,10 +769,9 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void GuideRateDeclination_Get_ThenThrowsException()
|
public void GuideRateDeclination_Get_ThenThrowsException()
|
||||||
{
|
{
|
||||||
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.GuideRateDeclination; });
|
var result = _telescope.GuideRateDeclination;
|
||||||
|
|
||||||
Assert.That(excpetion.Property, Is.EqualTo("GuideRateDeclination"));
|
Assert.That(result, Is.EqualTo(0.004178074616551509));
|
||||||
Assert.That(excpetion.AccessorSet, Is.False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -787,10 +786,9 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void GuideRateRightAscension_Get_ThenThrowsException()
|
public void GuideRateRightAscension_Get_ThenThrowsException()
|
||||||
{
|
{
|
||||||
var excpetion = Assert.Throws<PropertyNotImplementedException>(() => { var result = _telescope.GuideRateRightAscension; });
|
var result = _telescope.GuideRateRightAscension;
|
||||||
|
|
||||||
Assert.That(excpetion.Property, Is.EqualTo("GuideRateRightAscension"));
|
Assert.That(result, Is.EqualTo(0.004178074616551509));
|
||||||
Assert.That(excpetion.AccessorSet, Is.False);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@@ -969,7 +967,7 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
var duration = 0;
|
var duration = 0;
|
||||||
ConnectTelescope();
|
ConnectTelescope();
|
||||||
|
|
||||||
_telescope.PulseGuide(direction, 0);
|
_telescope.PulseGuide(direction, duration);
|
||||||
|
|
||||||
string d = string.Empty;
|
string d = string.Empty;
|
||||||
switch (direction)
|
switch (direction)
|
||||||
@@ -1003,7 +1001,43 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => "31Ed");
|
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => "31Ed");
|
||||||
_telescope.Connected = true;
|
_telescope.Connected = true;
|
||||||
|
|
||||||
_telescope.PulseGuide(direction, 0);
|
_telescope.PulseGuide(direction, duration);
|
||||||
|
|
||||||
|
string d = string.Empty;
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case GuideDirections.guideEast:
|
||||||
|
d = "e";
|
||||||
|
break;
|
||||||
|
case GuideDirections.guideWest:
|
||||||
|
d = "w";
|
||||||
|
break;
|
||||||
|
case GuideDirections.guideNorth:
|
||||||
|
d = "n";
|
||||||
|
break;
|
||||||
|
case GuideDirections.guideSouth:
|
||||||
|
d = "s";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind(":RG#"));
|
||||||
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":M{d}#"));
|
||||||
|
_utilMock.Verify(x => x.WaitForMilliseconds(duration), Times.Once);
|
||||||
|
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($":Q{d}#"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(GuideDirections.guideEast)]
|
||||||
|
[TestCase(GuideDirections.guideWest)]
|
||||||
|
[TestCase(GuideDirections.guideNorth)]
|
||||||
|
[TestCase(GuideDirections.guideSouth)]
|
||||||
|
public void PulseGuide_WhenConnectedAndNewerPulseGuidingAvailableButDurationTooLong_ThenSendsOldCommandsAndWaits(GuideDirections direction)
|
||||||
|
{
|
||||||
|
var duration = 10000;
|
||||||
|
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => _sharedResourcesWrapperMock.Object.Autostar497);
|
||||||
|
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => "31Ed");
|
||||||
|
_telescope.Connected = true;
|
||||||
|
|
||||||
|
_telescope.PulseGuide(direction, duration);
|
||||||
|
|
||||||
string d = string.Empty;
|
string d = string.Empty;
|
||||||
switch (direction)
|
switch (direction)
|
||||||
|
|||||||
@@ -97,6 +97,10 @@ namespace ASCOM.Meade.net
|
|||||||
Initialise();
|
Initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private double _guideRate;
|
||||||
|
|
||||||
|
private const double SIDRATE = 0.9972695677; //synodic/solar seconds per sidereal second
|
||||||
|
|
||||||
private void Initialise()
|
private void Initialise()
|
||||||
{
|
{
|
||||||
//todo move the TraceLogger out to a factory class.
|
//todo move the TraceLogger out to a factory class.
|
||||||
@@ -107,6 +111,8 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
IsConnected = false; // Initialise connected to false
|
IsConnected = false; // Initialise connected to false
|
||||||
|
|
||||||
|
_guideRate = 15.0 * (1.0 / 3600.0) / SIDRATE;
|
||||||
|
|
||||||
LogMessage("Telescope", "Completed initialisation");
|
LogMessage("Telescope", "Completed initialisation");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,7 +909,7 @@ namespace ASCOM.Meade.net
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
LogMessage("GuideRateDeclination Get", "Not implemented");
|
LogMessage("GuideRateDeclination Get", "Not implemented");
|
||||||
throw new PropertyNotImplementedException("GuideRateDeclination", false);
|
return _guideRate;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -917,7 +923,7 @@ namespace ASCOM.Meade.net
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
LogMessage("GuideRateRightAscension Get", "Not implemented");
|
LogMessage("GuideRateRightAscension Get", "Not implemented");
|
||||||
throw new PropertyNotImplementedException("GuideRateRightAscension", false);
|
return _guideRate;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
@@ -1075,7 +1081,7 @@ namespace ASCOM.Meade.net
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_userNewerPulseGuiding)
|
if (_userNewerPulseGuiding && duration < 10000)
|
||||||
{
|
{
|
||||||
_sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#");
|
_sharedResourcesWrapper.SendBlind($":Mg{d}{duration:0000}#");
|
||||||
//:MgnDDDD#
|
//:MgnDDDD#
|
||||||
@@ -1086,8 +1092,6 @@ namespace ASCOM.Meade.net
|
|||||||
//passed in the command.These commands support serial port driven guiding.
|
//passed in the command.These commands support serial port driven guiding.
|
||||||
//Returns – Nothing
|
//Returns – Nothing
|
||||||
//LX200 – Not Supported
|
//LX200 – Not Supported
|
||||||
|
|
||||||
//todo implement IsPulseGuiding if WaitForMilliseconds is not needed
|
|
||||||
_utilities.WaitForMilliseconds(duration); //todo figure out if this is really needed
|
_utilities.WaitForMilliseconds(duration); //todo figure out if this is really needed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user