Merged in develop (pull request #24)

Made alteration to IsSlewing response when the LX200 returns a buffer of rubbish.
This commit is contained in:
2021-02-10 10:24:54 +00:00
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, "", "||||||||", 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", true)] [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, "|", 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)
+15 -19
View File
@@ -1167,6 +1167,7 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
//todo make this return false for non LX-200 GPS telescopes
LogMessage("CanUnpark", "Get - " + true); LogMessage("CanUnpark", "Get - " + true);
return true; return true;
} }
@@ -1995,20 +1996,20 @@ namespace ASCOM.Meade.net
//LX200's a string of bar characters indicating the distance. //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. //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 try
{ {
//if (string.IsNullOrEmpty(result)) if (string.IsNullOrWhiteSpace(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);
@@ -2030,7 +2031,7 @@ namespace ASCOM.Meade.net
} }
finally finally
{ {
LogMessage("IsSlewingToTarget", $"Result = {isSlewing}"); LogMessage("IsSlewingToTarget", $"IsSlewing = {isSlewing} : result = {result ?? "<null>"}");
} }
} }
@@ -2394,8 +2395,9 @@ namespace ASCOM.Meade.net
public void Unpark() public void Unpark()
{ {
LogMessage("Unpark", "Parking telescope"); LogMessage("Unpark", "Unparking telescope");
//todo make this return only work for LX-200 GPS telescopes
if (!AtPark) if (!AtPark)
return; 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. //: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 //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 utcCorrection = GetUtcCorrection();
var localDateTime = DateTime.UtcNow - utcCorrection; var localDateTime = DateTime.UtcNow - utcCorrection;