Added ability to unpark telescope

Added extra logging information to the "isslewing test"
This commit is contained in:
2020-09-21 23:04:58 +01:00
parent b33d1741c4
commit d0406b32dd
3 changed files with 34 additions and 12 deletions
@@ -947,7 +947,7 @@ namespace Meade.net.Telescope.UnitTests
{ {
var result = _telescope.CanUnpark; var result = _telescope.CanUnpark;
Assert.That(result, Is.False); Assert.That(result, Is.True);
} }
[Test] [Test]
@@ -1581,11 +1581,9 @@ namespace Meade.net.Telescope.UnitTests
} }
[Test] [Test]
public void Unpark_ThenThrowsException() public void Unpark_ThenDoesNotThrowException()
{ {
var excpetion = Assert.Throws<MethodNotImplementedException>(() => { _telescope.Unpark(); }); Assert.DoesNotThrow(() => { _telescope.Unpark(); });
Assert.That(excpetion.Method, Is.EqualTo("Unpark"));
} }
[Test] [Test]
+30 -6
View File
@@ -1073,8 +1073,8 @@ namespace ASCOM.Meade.net
{ {
get get
{ {
LogMessage("CanUnpark", "Get - " + false); LogMessage("CanUnpark", "Get - " + true);
return false; return true;
} }
} }
@@ -1877,7 +1877,7 @@ namespace ASCOM.Meade.net
bool isSlewing = result.Trim() != string.Empty; bool isSlewing = result.Trim() != string.Empty;
LogMessage("Slewing Get", $"Result = {isSlewing}"); LogMessage("Slewing Get", $"Result = {isSlewing} ({result.Trim()}");
return isSlewing; return isSlewing;
} }
@@ -2212,9 +2212,33 @@ namespace ASCOM.Meade.net
public void Unpark() public void Unpark()
{ {
//todo heard a rumour that it's possible to unpark an LX200GPS. LogMessage("Unpark", "Parking telescope");
LogMessage("Unpark", "Not implemented");
throw new MethodNotImplementedException("Unpark"); if (!AtPark)
return;
SharedResourcesWrapper.SendChar(":I#");
//: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;
//localDateTime: HH: mm: ss
SharedResourcesWrapper.SendBlind($":hI{localDateTime:yyMMddhhmmss}#");
//:hIYYMMDDHHMMSS#
//Bypass handbox entry of daylight savings, date and time.Use the values supplied in this command.This feature is
//intended to allow use of the Autostar II from permanent installations where GPS reception is not possible, such as within
//metal domes. This command must be issued while the telescope is waiting at the initial daylight savings prompt.
//Returns: 1 if command was accepted.
AtPark = false;
} }
#endregion #endregion
+1 -1
View File
@@ -83,7 +83,7 @@ namespace ASCOM.Meade.net
/// <param name="args"></param> /// <param name="args"></param>
public static void LogMessage(string identifier, string message, params object[] args) public static void LogMessage(string identifier, string message, params object[] args)
{ {
var msg = String.Format(message, args); var msg = string.Format(message, args);
Tl.LogMessage(identifier, msg); Tl.LogMessage(identifier, msg);
} }