Finish LX200ClassicParkingPosition
This commit is contained in:
@@ -1621,27 +1621,30 @@ 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);
|
||||
//[Test]
|
||||
//public void Park_WhenLX200NotParked_ThenSendsParkCommand()
|
||||
//{
|
||||
// var alt = 1.0;
|
||||
// var altAsDM = "01*00";
|
||||
// _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);
|
||||
// var az = 180;
|
||||
// var azAsDM = "180*00";
|
||||
// _utilMock.Setup(x => x.DegreesToDM(az, "*", "", 2)).Returns(azAsDM);
|
||||
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, "Sa+77*30", false)).Returns(true);
|
||||
_sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, "Sz180*00", false)).Returns(true);
|
||||
// //_sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, "Sa+77*30", false)).Returns(true);
|
||||
// //_sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, "Sz180*00", false)).Returns(true);
|
||||
|
||||
ConnectTelescope(TelescopeList.LX200CLASSIC);
|
||||
Assert.That(_telescope.AtPark, Is.False);
|
||||
// _sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, "Sa+01*00", false)).Returns(true);
|
||||
// _sharedResourcesWrapperMock.Setup(x => x.SendBool(_traceLoggerMock.Object, "Sz180*00", false)).Returns(true);
|
||||
|
||||
_telescope.Park();
|
||||
// ConnectTelescope(TelescopeList.LX200CLASSIC);
|
||||
// Assert.That(_telescope.AtPark, Is.False);
|
||||
|
||||
Assert.That(_telescope.AtPark, Is.True);
|
||||
}
|
||||
// _telescope.Park();
|
||||
|
||||
// Assert.That(_telescope.AtPark, Is.True);
|
||||
//}
|
||||
|
||||
[Test]
|
||||
public void Park_WhenParked_ThenDoesNothing()
|
||||
@@ -3037,6 +3040,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "", false)]
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "[FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF] [FF][FF][FF][FF][FF][FF]", false)] //The test case below is this same string encoded to return exactly what the telescope will return.
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff \x00ff\x00ff\x00ff\x00ff\x00ff\x00ff", false)]
|
||||
[TestCase(TelescopeList.LX200CLASSIC, "", "[FF][FF][FF] [FF][FF][FF] ", true)] //The test case below is this same string encoded to return exactly what the telescope will return.
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "|", true)]
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "\x007f", true)]
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "", false)]
|
||||
|
||||
@@ -2291,15 +2291,28 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
LogMessage("Park", $"Calculating Park Alt Az");
|
||||
var siteLatitude = SiteLatitude;
|
||||
var parkAlt = AlignmentMode == AlignmentModes.algAltAz ? 0 : 90 - siteLatitude;
|
||||
var parkAz = siteLatitude >= 0 ? 180 : 0;
|
||||
//var parkAlt = AlignmentMode == AlignmentModes.algAltAz ? 0 : 90 - siteLatitude;
|
||||
//var parkAz = siteLatitude >= 0 ? 180 : 0;
|
||||
var parkAlt = 45;
|
||||
var parkAz = 180;
|
||||
|
||||
var eq = _astroMaths.ConvertHozToEq(UTCDate, SiteLatitude, SiteLongitude, new HorizonCoordinates()
|
||||
{
|
||||
Altitude = parkAlt,
|
||||
Azimuth = parkAz
|
||||
});
|
||||
|
||||
LogMessage("Park", $"Slewing to park position az:{parkAz} alt:{parkAlt}");
|
||||
SlewToCoordinates( eq.RightAscension, eq.Declination);
|
||||
LogMessage("Park", $"Arrived at park position");
|
||||
|
||||
LogMessage("Park", $"Parking LX200 Classic");
|
||||
Tracking = false;
|
||||
|
||||
LogMessage("Park", $"Slewing to park position az:{parkAz} alt:{parkAlt}");
|
||||
LogMessage("Park", $"Making sure the scope is pointed to the correct Alt Az.");
|
||||
parkAlt = 0;
|
||||
parkAz = 180;
|
||||
SlewToAltAz( parkAz, parkAlt, false);
|
||||
LogMessage("Park", $"Arrived at park position");
|
||||
}
|
||||
|
||||
//Setting park to true before sending the park command as the Autostar and Audiostar stop serial communications once the park command has been issued.
|
||||
@@ -3307,6 +3320,12 @@ namespace ASCOM.Meade.net
|
||||
return isSlewing;
|
||||
}
|
||||
|
||||
if (result.Equals("[FF][FF][FF] [FF][FF][FF] "))
|
||||
{
|
||||
isSlewing = true;
|
||||
return isSlewing;
|
||||
}
|
||||
|
||||
////classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
|
||||
//byte[] ba = Encoding.Default.GetBytes(result);
|
||||
////replace fill chars not belonging to a slew bar. Are there others? The bar character is a FF in hex.
|
||||
|
||||
Reference in New Issue
Block a user