Added more logging to DoSlewAsync, Added a retry to the AltAz Slew.
This commit is contained in:
@@ -2204,7 +2204,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
public void SlewToAltAz(double azimuth, double altitude, bool polar)
|
public void SlewToAltAz(double azimuth, double altitude, bool polar)
|
||||||
{
|
{
|
||||||
LogMessage("SlewToAltAz", $"Az=~{azimuth} Alt={altitude}");
|
LogMessage("SlewToAltAz", $"Az=~{azimuth} Alt={altitude} polar={polar}");
|
||||||
CheckConnected("SlewToAltAz");
|
CheckConnected("SlewToAltAz");
|
||||||
CheckParked();
|
CheckParked();
|
||||||
|
|
||||||
@@ -2238,7 +2238,7 @@ namespace ASCOM.Meade.net
|
|||||||
if (azimuth < 0)
|
if (azimuth < 0)
|
||||||
throw new InvalidValueException("Azimuth cannot be less than 0.");
|
throw new InvalidValueException("Azimuth cannot be less than 0.");
|
||||||
|
|
||||||
LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude}");
|
LogMessage("SlewToAltAzAsync", $"Az={azimuth} Alt={altitude} polar={polar}");
|
||||||
|
|
||||||
if (polar)
|
if (polar)
|
||||||
{
|
{
|
||||||
@@ -2325,6 +2325,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
private void DoSlewAsync(bool polar)
|
private void DoSlewAsync(bool polar)
|
||||||
{
|
{
|
||||||
|
LogMessage("DoSlewAsync", "Beginning slew sequence");
|
||||||
CheckConnected("DoSlewAsync");
|
CheckConnected("DoSlewAsync");
|
||||||
CheckParked();
|
CheckParked();
|
||||||
if (Slewing)
|
if (Slewing)
|
||||||
@@ -2336,6 +2337,7 @@ namespace ASCOM.Meade.net
|
|||||||
switch (polar)
|
switch (polar)
|
||||||
{
|
{
|
||||||
case true:
|
case true:
|
||||||
|
LogMessage("DoSlewAsync", "Executing Polar slew");
|
||||||
var response = SharedResourcesWrapper.SendChar("MS");
|
var response = SharedResourcesWrapper.SendChar("MS");
|
||||||
//:MS# Slew to Target Object
|
//:MS# Slew to Target Object
|
||||||
//Returns:
|
//Returns:
|
||||||
@@ -2382,23 +2384,44 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case false:
|
case false:
|
||||||
var maResponse = SharedResourcesWrapper.SendChar("MA");
|
Retry(6, () =>
|
||||||
//:MA# Autostar, LX 16", Autostar II - Slew to target Alt and Az
|
|
||||||
//Returns:
|
|
||||||
//0 - No fault
|
|
||||||
//1 - Fault
|
|
||||||
//LX200 - Not supported
|
|
||||||
|
|
||||||
if (maResponse == "1")
|
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("fault");
|
LogMessage("DoSlewAsync", "Executing Alt Az");
|
||||||
}
|
var maResponse = SharedResourcesWrapper.SendChar("MA");
|
||||||
|
//:MA# Autostar, LX 16", Autostar II - Slew to target Alt and Az
|
||||||
|
//Returns:
|
||||||
|
//0 - No fault
|
||||||
|
//1 - Fault
|
||||||
|
//LX200 - Not supported
|
||||||
|
|
||||||
|
if (maResponse != "0")
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException($"fault ({maResponse})");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
SetSlewingMinEndTime();
|
SetSlewingMinEndTime();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Retry(int i, Action action)
|
||||||
|
{
|
||||||
|
while (i >= 0)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
LogMessage("Retry", $"Attempt failed {i} attempts remaining error: {e.Message}");
|
||||||
|
}
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void SlewToCoordinates(double rightAscension, double declination)
|
public void SlewToCoordinates(double rightAscension, double declination)
|
||||||
{
|
{
|
||||||
LogMessage("SlewToCoordinates", $"Ra={rightAscension}, Dec={declination}");
|
LogMessage("SlewToCoordinates", $"Ra={rightAscension}, Dec={declination}");
|
||||||
|
|||||||
Reference in New Issue
Block a user