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
+23 -19
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. //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); bool isSlewing = !string.IsNullOrEmpty(result);
try
{
if (!isSlewing)
return false;
if (!isSlewing) //classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
return false; 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);
//classic LX200 return bar with 32 chars. FF is contained from left to right when slewing if (!isSlewing)
byte[] ba = Encoding.Default.GetBytes(result); return isSlewing;
//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", ""); //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
LogMessage("IsSlewingToTarget", $"Resulthex = {hexString}"); //the target coordinates are set and the telescope is slewed to that position.
isSlewing = (hexString.Length > 0); //a 0 movement will solved that lock if the target coordinates are set to the current coordinates.
if (IsTargetCoordinateInitRequired())
InitTargetCoordinates();
if (!isSlewing)
return isSlewing; return isSlewing;
}
LogMessage("IsSlewingToTarget", $"Result = {isSlewing}"); finally
{
//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 LogMessage("IsSlewingToTarget", $"Result = {isSlewing}");
//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;
} }
public void SyncToAltAz(double azimuth, double altitude) public void SyncToAltAz(double azimuth, double altitude)