Implemented slew to target

This commit is contained in:
2019-05-06 23:10:05 +01:00
parent 56febb46cc
commit cc5eabdfab
3 changed files with 24 additions and 4 deletions
+4 -4
View File
@@ -804,14 +804,14 @@ namespace ASCOM.MeadeAutostar497
public void SlewToTarget()
{
tl.LogMessage("SlewToTarget", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToTarget");
tl.LogMessage("SlewToTarget", "Executing");
_telescopeController.SlewToTarget();
}
public void SlewToTargetAsync()
{
tl.LogMessage("SlewToTargetAsync", "Not implemented");
throw new ASCOM.MethodNotImplementedException("SlewToTargetAsync");
tl.LogMessage("SlewToTargetAsync", "Executing");
_telescopeController.SlewToTargetAsync();
}
public bool Slewing
@@ -28,5 +28,7 @@ namespace ASCOM.MeadeAutostar497.Controller
void SlewToAltAz(double azimuth, double altitude);
void SlewToAltAzAsync(double azimuth, double altitude);
void SyncToTarget();
void SlewToTarget();
void SlewToTargetAsync();
}
}
@@ -633,6 +633,24 @@ namespace ASCOM.MeadeAutostar497.Controller
throw new ASCOM.InvalidOperationException("Unable to perform sync");
}
public void SlewToTarget()
{
SlewToTargetAsync();
while (Slewing)
{
Util.WaitForMilliseconds(200);
}
}
public void SlewToTargetAsync()
{
if (TargetDeclination == INVALID_PARAMETER || TargetRightAscension == INVALID_PARAMETER )
throw new ASCOM.InvalidOperationException("No target selected to slew to.");
DoSlewAsync(true);
}
//todo remove the polar parameter and split method into two.
private void DoSlewAsync( bool polar)
{