diff --git a/MeadeAutostar497/AscomClasses/Telescope.cs b/MeadeAutostar497/AscomClasses/Telescope.cs index b584e82..f3a966d 100644 --- a/MeadeAutostar497/AscomClasses/Telescope.cs +++ b/MeadeAutostar497/AscomClasses/Telescope.cs @@ -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 diff --git a/MeadeAutostar497/Controller/ITelescopeController.cs b/MeadeAutostar497/Controller/ITelescopeController.cs index 2e7b7b4..10c792d 100644 --- a/MeadeAutostar497/Controller/ITelescopeController.cs +++ b/MeadeAutostar497/Controller/ITelescopeController.cs @@ -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(); } } \ No newline at end of file diff --git a/MeadeAutostar497/Controller/TelescopeController.cs b/MeadeAutostar497/Controller/TelescopeController.cs index f79bc7a..ed8e5b1 100644 --- a/MeadeAutostar497/Controller/TelescopeController.cs +++ b/MeadeAutostar497/Controller/TelescopeController.cs @@ -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) {