Fixed the last unit test, seems that the special code for the chr(255)'s isn't needed as it's a non empty string, which should indicate that slewing is happening.
This commit is contained in:
@@ -2314,7 +2314,7 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
[TestCase(TelescopeList.LX200CLASSIC, "", "||||||||", true)]
|
[TestCase(TelescopeList.LX200CLASSIC, "", "||||||||", true)]
|
||||||
[TestCase(TelescopeList.LX200CLASSIC, "", "", false)]
|
[TestCase(TelescopeList.LX200CLASSIC, "", "", false)]
|
||||||
//[TestCase(TelescopeList.LX200CLASSIC, "", "[FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF] [FF][FF][FF][FF][FF][FF]", false)] //The test case below is this same string encoded to return exactly what the telescope will return.
|
//[TestCase(TelescopeList.LX200CLASSIC, "", "[FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF][FF] [FF][FF][FF][FF][FF][FF]", false)] //The test case below is this same string encoded to return exactly what the telescope will return.
|
||||||
[TestCase(TelescopeList.LX200CLASSIC, "", "\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff \x00ff\x00ff\x00ff\x00ff\x00ff\x00ff", false)]
|
[TestCase(TelescopeList.LX200CLASSIC, "", "\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff \x00ff\x00ff\x00ff\x00ff\x00ff\x00ff", true)]
|
||||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "|", true)]
|
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "|", true)]
|
||||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "", false)]
|
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "", false)]
|
||||||
public void Slewing_WhenTelescopeNotSlewing_ThenReturnsFalse(string productName, string firmwareVersion, string response, bool isSlewing)
|
public void Slewing_WhenTelescopeNotSlewing_ThenReturnsFalse(string productName, string firmwareVersion, string response, bool isSlewing)
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ namespace ASCOM.Meade.net
|
|||||||
var raAndDec = GetTelescopeRaAndDec();
|
var raAndDec = GetTelescopeRaAndDec();
|
||||||
LogMessage("Connected Set", $"Connected OK. Current RA = {_utilitiesExtra.HoursToHMS(raAndDec.RightAscension)} Dec = {_utilitiesExtra.DegreesToDMS(raAndDec.Declination)}");
|
LogMessage("Connected Set", $"Connected OK. Current RA = {_utilitiesExtra.HoursToHMS(raAndDec.RightAscension)} Dec = {_utilitiesExtra.DegreesToDMS(raAndDec.Declination)}");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
SharedResourcesWrapper.Disconnect("Serial", DriverId);
|
SharedResourcesWrapper.Disconnect("Serial", DriverId);
|
||||||
throw;
|
throw;
|
||||||
@@ -1644,7 +1644,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double SiteElevation
|
public new double SiteElevation
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -1998,33 +1998,33 @@ namespace ASCOM.Meade.net
|
|||||||
bool isSlewing = !string.IsNullOrEmpty(result);
|
bool isSlewing = !string.IsNullOrEmpty(result);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(result))
|
//if (string.IsNullOrEmpty(result))
|
||||||
{
|
//{
|
||||||
isSlewing = false;
|
// isSlewing = false;
|
||||||
return isSlewing;
|
// return isSlewing;
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (result.Contains("|"))
|
//if (result.Contains("|"))
|
||||||
{
|
//{
|
||||||
isSlewing = true;
|
// isSlewing = true;
|
||||||
return isSlewing;
|
// return isSlewing;
|
||||||
}
|
//}
|
||||||
|
|
||||||
//classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
|
////classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
|
||||||
byte[] ba = Encoding.Default.GetBytes(result);
|
//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.
|
////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", "");
|
//var hexString = BitConverter.ToString(ba).Replace("-", "").Replace("20", "");
|
||||||
LogMessage("IsSlewingToTarget", $"Resulthex = {hexString}");
|
//LogMessage("IsSlewingToTarget", $"Resulthex = {hexString}");
|
||||||
isSlewing = (hexString.Length > 0);
|
//isSlewing = (hexString.Length > 0);
|
||||||
|
|
||||||
if (!isSlewing)
|
//if (!isSlewing)
|
||||||
return 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
|
////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.
|
////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.
|
////a 0 movement will solved that lock if the target coordinates are set to the current coordinates.
|
||||||
if (IsTargetCoordinateInitRequired())
|
//if (IsTargetCoordinateInitRequired())
|
||||||
InitTargetCoordinates();
|
// InitTargetCoordinates();
|
||||||
|
|
||||||
return isSlewing;
|
return isSlewing;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user