Modified the puleguide method to make sure that the _isGuiding property is set correctly regardless of the old or new guiding method.
Added log message for when PulseGuide fails with an error for any reason
This commit is contained in:
@@ -47,7 +47,6 @@ namespace ASCOM.Meade.net
|
||||
//internal static string driverID = "ASCOM.Meade.net.Telescope";
|
||||
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException());
|
||||
|
||||
// TODO Change the descriptive string for your driver then remove this line
|
||||
/// <summary>
|
||||
/// Driver description that displays in the ASCOM Chooser.
|
||||
/// </summary>
|
||||
@@ -707,7 +706,6 @@ namespace ASCOM.Meade.net
|
||||
|
||||
public string Description
|
||||
{
|
||||
// TODO customise this device description
|
||||
get
|
||||
{
|
||||
LogMessage("Description Get", DriverDescription);
|
||||
@@ -719,7 +717,6 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO customise this driver description
|
||||
string driverInfo = $"{Description} .net driver. Version: {DriverVersion}";
|
||||
LogMessage("DriverInfo Get", driverInfo);
|
||||
return driverInfo;
|
||||
@@ -1423,15 +1420,21 @@ namespace ASCOM.Meade.net
|
||||
public void PulseGuide(GuideDirections direction, int duration)
|
||||
{
|
||||
LogMessage("PulseGuide", $"pulse guide direction {direction} duration {duration}");
|
||||
try
|
||||
{
|
||||
CheckConnected("PulseGuide");
|
||||
|
||||
if (IsSlewingToTarget())
|
||||
throw new InvalidOperationException("Unable to PulseGuide whilst slewing to target.");
|
||||
|
||||
if (_movingPrimary && (direction == GuideDirections.guideEast || direction == GuideDirections.guideWest))
|
||||
_isGuiding = true;
|
||||
try
|
||||
{
|
||||
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))
|
||||
if (_movingSecondary &&
|
||||
(direction == GuideDirections.guideNorth || direction == GuideDirections.guideSouth))
|
||||
throw new InvalidOperationException("Unable to PulseGuide while moving same axis.");
|
||||
|
||||
var coordinatesBeforeMove = GetTelescopeRaAndDec();
|
||||
@@ -1469,9 +1472,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
else
|
||||
{
|
||||
_isGuiding = true;
|
||||
try
|
||||
{
|
||||
LogMessage("PulseGuide", "Using old pulse guiding technique");
|
||||
switch (direction)
|
||||
{
|
||||
case GuideDirections.guideEast:
|
||||
@@ -1495,17 +1496,27 @@ namespace ASCOM.Meade.net
|
||||
MoveAxis(TelescopeAxes.axisPrimary, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
LogMessage("PulseGuide", "Using old pulse guiding technique complete");
|
||||
}
|
||||
|
||||
var coordinatesAfterMove = GetTelescopeRaAndDec();
|
||||
|
||||
LogMessage("PulseGuide",
|
||||
$"Complete Before RA: {_utilitiesExtra.HoursToHMS(coordinatesBeforeMove.RightAscension)} Dec:{_utilitiesExtra.DegreesToDMS(coordinatesBeforeMove.Declination)}");
|
||||
LogMessage("PulseGuide",
|
||||
$"Complete After RA: {_utilitiesExtra.HoursToHMS(coordinatesAfterMove.RightAscension)} Dec:{_utilitiesExtra.DegreesToDMS(coordinatesAfterMove.Declination)}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isGuiding = false;
|
||||
}
|
||||
}
|
||||
|
||||
var coordinatesAfterMove = GetTelescopeRaAndDec();
|
||||
|
||||
LogMessage("PulseGuide", $"Complete Before RA: {_utilitiesExtra.HoursToHMS(coordinatesBeforeMove.RightAscension)} Dec:{_utilitiesExtra.DegreesToDMS(coordinatesBeforeMove.Declination)}");
|
||||
LogMessage("PulseGuide", $"Complete Before RA: {_utilitiesExtra.HoursToHMS(coordinatesAfterMove.RightAscension)} Dec:{_utilitiesExtra.DegreesToDMS(coordinatesAfterMove.Declination)}");
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogMessage("PulseGuide", $"Error performing pulse guide: {ex.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public double RightAscension
|
||||
|
||||
Reference in New Issue
Block a user