Made sure that the alignment mode is preserved when parked, across sessions.
This commit is contained in:
@@ -131,6 +131,7 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
_testProperties.AlignmentStatus = alignmentStatus.ToCharArray();
|
_testProperties.AlignmentStatus = alignmentStatus.ToCharArray();
|
||||||
|
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.SendChars("GW", false, 3)).Returns(() => new string(_testProperties.AlignmentStatus));
|
_sharedResourcesWrapperMock.Setup(x => x.SendChars("GW", false, 3)).Returns(() => new string(_testProperties.AlignmentStatus));
|
||||||
|
_sharedResourcesWrapperMock.Setup(x => x.SendString("GW", false)).Returns(() => new string(_testProperties.AlignmentStatus));
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("AP", false)).Callback(() => _testProperties.AlignmentStatus[1] = 'T');
|
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("AP", false)).Callback(() => _testProperties.AlignmentStatus[1] = 'T');
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("AL", false)).Callback(() => _testProperties.AlignmentStatus[1] = 'N');
|
_sharedResourcesWrapperMock.Setup(x => x.SendBlind("AL", false)).Callback(() => _testProperties.AlignmentStatus[1] = 'N');
|
||||||
|
|
||||||
@@ -808,9 +809,10 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
[Test]
|
[Test]
|
||||||
public void AlignmentMode_Get_WhenUnknownAlignmentMode_ThrowsException()
|
public void AlignmentMode_Get_WhenUnknownAlignmentMode_ThrowsException()
|
||||||
{
|
{
|
||||||
_testProperties.AlignmentMode = "";
|
|
||||||
ConnectTelescope();
|
ConnectTelescope();
|
||||||
|
|
||||||
|
_testProperties.AlignmentMode = "";
|
||||||
|
|
||||||
Assert.Throws<InvalidValueException>(() =>
|
Assert.Throws<InvalidValueException>(() =>
|
||||||
{
|
{
|
||||||
var actualResult = _telescope.AlignmentMode;
|
var actualResult = _telescope.AlignmentMode;
|
||||||
|
|||||||
@@ -488,6 +488,8 @@ namespace ASCOM.Meade.net
|
|||||||
SendCurrentDateTime("Connect");
|
SendCurrentDateTime("Connect");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SharedResources.AlignmentMode = AlignmentMode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1050,6 +1052,8 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
//:AL# Sets telescope to Land alignment mode
|
//:AL# Sets telescope to Land alignment mode
|
||||||
//Returns: nothing
|
//Returns: nothing
|
||||||
|
|
||||||
|
SharedResources.AlignmentMode = AlignmentMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2805,8 +2809,6 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private AlignmentModes _savedAlignmode;
|
|
||||||
|
|
||||||
public bool Tracking
|
public bool Tracking
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -2833,12 +2835,12 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
_savedAlignmode = AlignmentMode;
|
SharedResources.AlignmentMode = AlignmentMode;
|
||||||
SharedResourcesWrapper.SendBlind("AL");
|
SharedResourcesWrapper.SendBlind("AL");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AlignmentMode = _savedAlignmode;
|
AlignmentMode = SharedResources.AlignmentMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -567,23 +567,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public static void Lock(Action action)
|
|
||||||
{
|
|
||||||
lock (LockObject)
|
|
||||||
{
|
|
||||||
action();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static T Lock<T>(Func<T> func)
|
|
||||||
{
|
|
||||||
lock (LockObject)
|
|
||||||
{
|
|
||||||
return func();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Skeleton of a hardware class, all this does is hold a count of the connections,
|
/// Skeleton of a hardware class, all this does is hold a count of the connections,
|
||||||
/// in reality extra code will be needed to handle the hardware in some way
|
/// in reality extra code will be needed to handle the hardware in some way
|
||||||
@@ -611,7 +595,7 @@ namespace ASCOM.Meade.net
|
|||||||
get => _restartTracking;
|
get => _restartTracking;
|
||||||
private set => _restartTracking.Set(value);
|
private set => _restartTracking.Set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ParkedPosition _parkedPosition;
|
private static ParkedPosition _parkedPosition;
|
||||||
public static ParkedPosition ParkedPosition
|
public static ParkedPosition ParkedPosition
|
||||||
{
|
{
|
||||||
@@ -626,6 +610,13 @@ namespace ASCOM.Meade.net
|
|||||||
private set => _isParked.Set(value);
|
private set => _isParked.Set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<AlignmentModes> _alignmentMode = AlignmentModes.algAltAz;
|
||||||
|
public static AlignmentModes AlignmentMode
|
||||||
|
{
|
||||||
|
get => _alignmentMode;
|
||||||
|
set => _alignmentMode.Set(value);
|
||||||
|
}
|
||||||
|
|
||||||
private static readonly ThreadSafeValue<PierSide> _sideOfPier = PierSide.pierUnknown;
|
private static readonly ThreadSafeValue<PierSide> _sideOfPier = PierSide.pierUnknown;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start with <see cref="PierSide.pierUnknown"/>.
|
/// Start with <see cref="PierSide.pierUnknown"/>.
|
||||||
|
|||||||
Reference in New Issue
Block a user