Made alteration to IsSlewing response when the LX200 returns a buffer of rubbish.

This commit is contained in:
2021-02-09 21:57:42 +00:00
parent 1616ddbc21
commit 14b5651795
2 changed files with 17 additions and 21 deletions
@@ -2313,8 +2313,8 @@ namespace Meade.net.Telescope.UnitTests
[TestCase(TelescopeList.LX200CLASSIC,"","|", true)]
[TestCase(TelescopeList.LX200CLASSIC, "", "||||||||", true)]
[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, "", "\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff\x00ff \x00ff\x00ff\x00ff\x00ff\x00ff\x00ff", true)]
[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.Autostar497, TelescopeList.Autostar497_43Eg, "|", true)]
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, "", false)]
public void Slewing_WhenTelescopeNotSlewing_ThenReturnsFalse(string productName, string firmwareVersion, string response, bool isSlewing)
+15 -19
View File
@@ -1167,6 +1167,7 @@ namespace ASCOM.Meade.net
{
get
{
//todo make this return false for non LX-200 GPS telescopes
LogMessage("CanUnpark", "Get - " + true);
return true;
}
@@ -1995,20 +1996,20 @@ namespace ASCOM.Meade.net
//LX200's a string of bar characters indicating the distance.
//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 = false;
try
{
//if (string.IsNullOrEmpty(result))
//{
// isSlewing = false;
// return isSlewing;
//}
if (string.IsNullOrWhiteSpace(result))
{
isSlewing = false;
return isSlewing;
}
//if (result.Contains("|"))
//{
// isSlewing = true;
// return isSlewing;
//}
if (result.Contains("|"))
{
isSlewing = true;
return isSlewing;
}
////classic LX200 return bar with 32 chars. FF is contained from left to right when slewing
//byte[] ba = Encoding.Default.GetBytes(result);
@@ -2030,7 +2031,7 @@ namespace ASCOM.Meade.net
}
finally
{
LogMessage("IsSlewingToTarget", $"Result = {isSlewing}");
LogMessage("IsSlewingToTarget", $"IsSlewing = {isSlewing} : result = {result ?? "<null>"}");
}
}
@@ -2394,8 +2395,9 @@ namespace ASCOM.Meade.net
public void Unpark()
{
LogMessage("Unpark", "Parking telescope");
LogMessage("Unpark", "Unparking telescope");
//todo make this return only work for LX-200 GPS telescopes
if (!AtPark)
return;
@@ -2403,12 +2405,6 @@ namespace ASCOM.Meade.net
//: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
//todo implement the
//todo make sure that the telescope has the correct date and time.
//UTCDate = DateTime.UtcNow;
var utcCorrection = GetUtcCorrection();
var localDateTime = DateTime.UtcNow - utcCorrection;