Added a check to ensure that pulse guide commands fail when the scope is slewing or already being moved on the same axes.
This commit is contained in:
@@ -1415,6 +1415,15 @@ namespace ASCOM.Meade.net
|
||||
LogMessage("PulseGuide", $"pulse guide direction {direction} duration {duration}");
|
||||
CheckConnected("PulseGuide");
|
||||
|
||||
if (IsSlewingToTarget())
|
||||
throw new InvalidOperationException("Unable to PulseGuide whilst slewing to target.");
|
||||
|
||||
if (_movingPrimary && (direction == GuideDirections.guideEast || direction == GuideDirections.guideWest))
|
||||
throw new InvalidOperationException("Unable to PulseGuide while moving same axis.");
|
||||
|
||||
if (_movingSecondary && (direction == GuideDirections.guideNorth || direction == GuideDirections.guideSouth))
|
||||
throw new InvalidOperationException("Unable to PulseGuide while moving same axis.");
|
||||
|
||||
var coordinatesBeforeMove = GetTelescopeRaAndDec();
|
||||
|
||||
if (_userNewerPulseGuiding && duration < 10000)
|
||||
@@ -1928,26 +1937,31 @@ namespace ASCOM.Meade.net
|
||||
if (MovingAxis())
|
||||
return true;
|
||||
|
||||
CheckConnected("Slewing Get");
|
||||
|
||||
var result = _sharedResourcesWrapper.SendString("#:D#");
|
||||
//:D# Requests a string of bars indicating the distance to the current target location.
|
||||
//Returns:
|
||||
//LX200's – a string of bar characters indicating the distance.
|
||||
//Autostars and Autostar II – a string containing one bar until a slew is complete, then a null string is returned.
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSlewing = result != string.Empty;
|
||||
|
||||
LogMessage("Slewing Get", $"Result = {isSlewing}");
|
||||
return isSlewing;
|
||||
return IsSlewingToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsSlewingToTarget()
|
||||
{
|
||||
CheckConnected("Slewing Get");
|
||||
|
||||
var result = _sharedResourcesWrapper.SendString("#:D#");
|
||||
//:D# Requests a string of bars indicating the distance to the current target location.
|
||||
//Returns:
|
||||
//LX200's – a string of bar characters indicating the distance.
|
||||
//Autostars and Autostar II – a string containing one bar until a slew is complete, then a null string is returned.
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSlewing = result != string.Empty;
|
||||
|
||||
LogMessage("Slewing Get", $"Result = {isSlewing}");
|
||||
return isSlewing;
|
||||
}
|
||||
|
||||
public void SyncToAltAz(double azimuth, double altitude)
|
||||
{
|
||||
LogMessage("SyncToAltAz", "Not implemented");
|
||||
|
||||
Reference in New Issue
Block a user