Moved IsGuiding to SharedResourcesWrapper
This commit is contained in:
@@ -145,6 +145,8 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
_sharedResourcesWrapperMock.SetupGet(x => x.IsParked).Returns(() => _isParked);
|
_sharedResourcesWrapperMock.SetupGet(x => x.IsParked).Returns(() => _isParked);
|
||||||
_sharedResourcesWrapperMock.SetupGet(x => x.ParkedPosition).Returns(() => _parkedPosition);
|
_sharedResourcesWrapperMock.SetupGet(x => x.ParkedPosition).Returns(() => _parkedPosition);
|
||||||
|
|
||||||
|
_sharedResourcesWrapperMock.SetupProperty(x => x.IsGuiding);
|
||||||
|
|
||||||
_astroMathsMock
|
_astroMathsMock
|
||||||
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
|
.Setup(x => x.ConvertHozToEq(It.IsAny<DateTime>(), It.IsAny<double>(), It.IsAny<double>(),
|
||||||
It.IsAny<HorizonCoordinates>())).Returns(() => new EquatorialCoordinates { Declination = _testProperties.declination, RightAscension = _testProperties.rightAscension });
|
It.IsAny<HorizonCoordinates>())).Returns(() => new EquatorialCoordinates { Declination = _testProperties.declination, RightAscension = _testProperties.rightAscension });
|
||||||
|
|||||||
@@ -140,8 +140,6 @@ namespace ASCOM.Meade.net
|
|||||||
Initialise(nameof(Telescope));
|
Initialise(nameof(Telescope));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _isGuiding;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// PUBLIC COM INTERFACE ITelescopeV3 IMPLEMENTATION
|
// PUBLIC COM INTERFACE ITelescopeV3 IMPLEMENTATION
|
||||||
//
|
//
|
||||||
@@ -1607,7 +1605,7 @@ namespace ASCOM.Meade.net
|
|||||||
switch (rate.Compare(0))
|
switch (rate.Compare(0))
|
||||||
{
|
{
|
||||||
case ComparisonResult.Equals:
|
case ComparisonResult.Equals:
|
||||||
if (!_isGuiding)
|
if (!SharedResourcesWrapper.IsGuiding)
|
||||||
{
|
{
|
||||||
SetSlewingMinEndTime();
|
SetSlewingMinEndTime();
|
||||||
}
|
}
|
||||||
@@ -1638,7 +1636,7 @@ namespace ASCOM.Meade.net
|
|||||||
switch (rate.Compare(0))
|
switch (rate.Compare(0))
|
||||||
{
|
{
|
||||||
case ComparisonResult.Equals:
|
case ComparisonResult.Equals:
|
||||||
if (!_isGuiding)
|
if (!SharedResourcesWrapper.IsGuiding)
|
||||||
{
|
{
|
||||||
SetSlewingMinEndTime();
|
SetSlewingMinEndTime();
|
||||||
}
|
}
|
||||||
@@ -1731,7 +1729,7 @@ namespace ASCOM.Meade.net
|
|||||||
if (IsSlewingToTarget())
|
if (IsSlewingToTarget())
|
||||||
throw new InvalidOperationException("Unable to PulseGuide whilst slewing to target.");
|
throw new InvalidOperationException("Unable to PulseGuide whilst slewing to target.");
|
||||||
|
|
||||||
_isGuiding = true;
|
SharedResourcesWrapper.IsGuiding = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (SharedResourcesWrapper.MovingPrimary &&
|
if (SharedResourcesWrapper.MovingPrimary &&
|
||||||
@@ -1814,7 +1812,7 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_isGuiding = false;
|
SharedResourcesWrapper.IsGuiding = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -2306,7 +2304,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
private bool MovingAxis()
|
private bool MovingAxis()
|
||||||
{
|
{
|
||||||
if (_isGuiding)
|
if (SharedResourcesWrapper.IsGuiding)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return SharedResourcesWrapper.MovingPrimary || SharedResourcesWrapper.MovingSecondary;
|
return SharedResourcesWrapper.MovingPrimary || SharedResourcesWrapper.MovingSecondary;
|
||||||
@@ -2358,7 +2356,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
CheckConnected("IsSlewingToTarget");
|
CheckConnected("IsSlewingToTarget");
|
||||||
|
|
||||||
if (_isGuiding)
|
if (SharedResourcesWrapper.IsGuiding)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
|
|||||||
@@ -583,5 +583,12 @@ namespace ASCOM.Meade.net
|
|||||||
get => _isTargetCoordinateInitRequired;
|
get => _isTargetCoordinateInitRequired;
|
||||||
internal set => _isTargetCoordinateInitRequired.Set(value);
|
internal set => _isTargetCoordinateInitRequired.Set(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly ThreadSafeValue<bool> _isGuiding = false;
|
||||||
|
public static bool IsGuiding
|
||||||
|
{
|
||||||
|
get => _isGuiding;
|
||||||
|
internal set => _isGuiding.Set(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,8 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
DateTime EarliestNonSlewingTime { get; set; }
|
DateTime EarliestNonSlewingTime { get; set; }
|
||||||
|
|
||||||
bool IsTargetCoordinateInitRequired { get; set; }
|
bool IsTargetCoordinateInitRequired { get; set; }
|
||||||
|
|
||||||
|
bool IsGuiding { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||||
@@ -189,5 +191,11 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
get => SharedResources.IsTargetCoordinateInitRequired;
|
get => SharedResources.IsTargetCoordinateInitRequired;
|
||||||
set => SharedResources.IsTargetCoordinateInitRequired = value;
|
set => SharedResources.IsTargetCoordinateInitRequired = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsGuiding
|
||||||
|
{
|
||||||
|
get => SharedResources.IsGuiding;
|
||||||
|
set => SharedResources.IsGuiding = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user