Fixed the log message to be returned from IsSlewing with the final state every time without exception.

This commit is contained in:
2021-01-17 18:19:16 +00:00
parent 65afa07125
commit 927d6bce47
+24 -20
View File
@@ -1982,29 +1982,33 @@ namespace ASCOM.Meade.net
//Autostars and Autostar II a string containing one bar until a slew is complete, then a null string is returned.
bool isSlewing = !string.IsNullOrEmpty(result);
try
{
if (!isSlewing)
return false;
if (!isSlewing)
return false;
//classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
byte[] ba = Encoding.Default.GetBytes(result);
//replace fill chars not belonging to a slew bar. Are there others? The bar character is a FF in hex.
var hexString = BitConverter.ToString(ba).Replace("-", "").Replace("20", "");
LogMessage("IsSlewingToTarget", $"Resulthex = {hexString}");
isSlewing = (hexString.Length > 0);
if (!isSlewing)
return isSlewing;
//classic LX200 got RA 0 DE 0 as Target Coordinates. If the RA DE is not 0 at switch on, the telescope will indicate slewing until
//the target coordinates are set and the telescope is slewed to that position.
//a 0 movement will solved that lock if the target coordinates are set to the current coordinates.
if (IsTargetCoordinateInitRequired())
InitTargetCoordinates();
//classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
byte[] ba = Encoding.Default.GetBytes(result);
//replace fill chars not belonging to a slew bar. Are there others? The bar character is a FF in hex.
var hexString = BitConverter.ToString(ba).Replace("-", "").Replace("20", "");
LogMessage("IsSlewingToTarget", $"Resulthex = {hexString}");
isSlewing = (hexString.Length > 0);
if (!isSlewing)
return isSlewing;
LogMessage("IsSlewingToTarget", $"Result = {isSlewing}");
//classic LX200 got RA 0 DE 0 as Target Coordinates. If the RA DE is not 0 at switch on, the telescope will indicate slewing until
//the target coordinates are set and the telescope is slewed to that position.
//a 0 movement will solved that lock if the target coordinates are set to the current coordinates.
if (IsTargetCoordinateInitRequired())
InitTargetCoordinates();
return isSlewing;
}
finally
{
LogMessage("IsSlewingToTarget", $"Result = {isSlewing}");
}
}
public void SyncToAltAz(double azimuth, double altitude)