Added a general try catch to the UnPark method.
This commit is contained in:
@@ -3041,39 +3041,47 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public void Unpark()
|
public void Unpark()
|
||||||
{
|
{
|
||||||
LogMessage("Unpark", "Unparking telescope");
|
try
|
||||||
CheckConnected("Unpark");
|
|
||||||
|
|
||||||
if (!IsUnparkable)
|
|
||||||
throw new InvalidOperationException("Unable to unpark this telescope type");
|
|
||||||
|
|
||||||
if (!AtPark)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
|
||||||
{
|
{
|
||||||
|
LogMessage("Unpark", "Unparking telescope");
|
||||||
|
CheckConnected("Unpark");
|
||||||
|
|
||||||
SharedResourcesWrapper.SendChar("I");
|
if (!IsUnparkable)
|
||||||
//:I# LX200 GPS Only - Causes the telescope to cease current operations and restart at its power on initialization.
|
throw new InvalidOperationException("Unable to unpark this telescope type");
|
||||||
//Returns: X once the handset restart has completed
|
|
||||||
|
|
||||||
BypassHandboxEntryForAutostarII();
|
if (!AtPark)
|
||||||
}
|
return;
|
||||||
else if (SharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC)
|
|
||||||
{
|
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||||
if (SharedResourcesWrapper.RestartTracking)
|
|
||||||
{
|
{
|
||||||
LogMessage("Unpark", "Turning tracking on");
|
|
||||||
Tracking = true;
|
SharedResourcesWrapper.SendChar("I");
|
||||||
LogMessage("Unpark", "Turning tracking on completed");
|
//:I# LX200 GPS Only - Causes the telescope to cease current operations and restart at its power on initialization.
|
||||||
|
//Returns: X once the handset restart has completed
|
||||||
|
|
||||||
|
BypassHandboxEntryForAutostarII();
|
||||||
}
|
}
|
||||||
|
else if (SharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC)
|
||||||
|
{
|
||||||
|
if (SharedResourcesWrapper.RestartTracking)
|
||||||
|
{
|
||||||
|
LogMessage("Unpark", "Turning tracking on");
|
||||||
|
Tracking = true;
|
||||||
|
LogMessage("Unpark", "Turning tracking on completed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SharedResourcesWrapper.SetParked(false, null, false);
|
||||||
|
|
||||||
|
// reset side of pier
|
||||||
|
SideOfPier = PierSide.pierUnknown;
|
||||||
|
LogMessage("Unpark", "Unparking Completed");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogMessage("Unpark", $"Error: {ex.Message}");
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedResourcesWrapper.SetParked(false, null, false);
|
|
||||||
|
|
||||||
// reset side of pier
|
|
||||||
SideOfPier = PierSide.pierUnknown;
|
|
||||||
LogMessage("Unpark", "Unparking Completed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool BypassHandboxEntryForAutostarII()
|
private bool BypassHandboxEntryForAutostarII()
|
||||||
|
|||||||
Reference in New Issue
Block a user