Fixed the defect when one instance of the driver gets parked, the info is shared to the other instances.
This commit is contained in:
@@ -48,9 +48,15 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
|
|
||||||
private TestProperties _testProperties;
|
private TestProperties _testProperties;
|
||||||
|
|
||||||
|
private bool _isParked;
|
||||||
|
private ParkedPosition _parkedPosition;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
|
_isParked = false;
|
||||||
|
_parkedPosition = null;
|
||||||
|
|
||||||
_testProperties = new TestProperties();
|
_testProperties = new TestProperties();
|
||||||
|
|
||||||
_profileProperties = new ProfileProperties
|
_profileProperties = new ProfileProperties
|
||||||
@@ -118,6 +124,14 @@ namespace Meade.net.Telescope.UnitTests
|
|||||||
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => productName);
|
_sharedResourcesWrapperMock.Setup(x => x.ProductName).Returns(() => productName);
|
||||||
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => firmwareVersion);
|
_sharedResourcesWrapperMock.Setup(x => x.FirmwareVersion).Returns(() => firmwareVersion);
|
||||||
|
|
||||||
|
_sharedResourcesWrapperMock.Setup(x => x.SetParked(It.IsAny<bool>(), It.IsAny<ParkedPosition>())).Callback<bool,ParkedPosition>((isParked, parkedPostion) => {
|
||||||
|
_isParked = isParked;
|
||||||
|
_parkedPosition = parkedPostion;
|
||||||
|
});
|
||||||
|
|
||||||
|
_sharedResourcesWrapperMock.SetupGet(x => x.IsParked).Returns(() => _isParked);
|
||||||
|
_sharedResourcesWrapperMock.SetupGet(x => x.ParkedPosition).Returns(() => _parkedPosition);
|
||||||
|
|
||||||
_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 });
|
||||||
|
|||||||
@@ -127,7 +127,6 @@
|
|||||||
<Compile Include="ComparisonResult.cs" />
|
<Compile Include="ComparisonResult.cs" />
|
||||||
<Compile Include="DoubleExtensions.cs" />
|
<Compile Include="DoubleExtensions.cs" />
|
||||||
<Compile Include="IClock.cs" />
|
<Compile Include="IClock.cs" />
|
||||||
<Compile Include="ParkedPosition.cs" />
|
|
||||||
<Compile Include="StringExtensions.cs" />
|
<Compile Include="StringExtensions.cs" />
|
||||||
<Compile Include="Telescope.cs" />
|
<Compile Include="Telescope.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@@ -45,12 +45,15 @@ namespace ASCOM.Meade.net
|
|||||||
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
|
/// The DeviceID is used by ASCOM applications to load the driver at runtime.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
//internal static string driverID = "ASCOM.Meade.net.Telescope";
|
//internal static string driverID = "ASCOM.Meade.net.Telescope";
|
||||||
private static readonly string DriverId = Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ?? throw new System.InvalidOperationException());
|
private static readonly string DriverId =
|
||||||
|
Marshal.GenerateProgIdForType(MethodBase.GetCurrentMethod().DeclaringType ??
|
||||||
|
throw new System.InvalidOperationException());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Private variable to hold an ASCOM Utilities object
|
/// Private variable to hold an ASCOM Utilities object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IUtil _utilities;
|
private readonly IUtil _utilities;
|
||||||
|
|
||||||
private readonly IUtilExtra _utilitiesExtra;
|
private readonly IUtilExtra _utilitiesExtra;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,9 +76,7 @@ namespace ASCOM.Meade.net
|
|||||||
private int _digitsDe = 2;
|
private int _digitsDe = 2;
|
||||||
|
|
||||||
private short _settleTime;
|
private short _settleTime;
|
||||||
|
|
||||||
private ParkedPosition _parkedPosition;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
/// Initializes a new instance of the <see cref="Meade.net"/> class.
|
||||||
/// Must be public for COM registration.
|
/// Must be public for COM registration.
|
||||||
@@ -123,7 +124,9 @@ namespace ASCOM.Meade.net
|
|||||||
sb.AppendLine();
|
sb.AppendLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Telescope( IUtil util, IUtilExtra utilExtra, IAstroUtils astroUtilities, ISharedResourcesWrapper sharedResourcesWrapper, IAstroMaths astroMaths, IClock clock) : base(sharedResourcesWrapper)
|
public Telescope(IUtil util, IUtilExtra utilExtra, IAstroUtils astroUtilities,
|
||||||
|
ISharedResourcesWrapper sharedResourcesWrapper, IAstroMaths astroMaths, IClock clock) : base(
|
||||||
|
sharedResourcesWrapper)
|
||||||
{
|
{
|
||||||
_clock = clock;
|
_clock = clock;
|
||||||
_utilities = util; //Initialise util object
|
_utilities = util; //Initialise util object
|
||||||
@@ -282,6 +285,7 @@ namespace ASCOM.Meade.net
|
|||||||
$"Site {actionParameters} not allowed, must be between 1 and 4");
|
$"Site {actionParameters} not allowed, must be between 1 and 4");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "getname":
|
case "getname":
|
||||||
switch (parames[1])
|
switch (parames[1])
|
||||||
@@ -316,6 +320,7 @@ namespace ASCOM.Meade.net
|
|||||||
$"Site {actionParameters} not allowed, must be between 1 and 4");
|
$"Site {actionParameters} not allowed, must be between 1 and 4");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidValueException(
|
throw new InvalidValueException(
|
||||||
@@ -398,7 +403,8 @@ namespace ASCOM.Meade.net
|
|||||||
var connectionInfo = SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
|
var connectionInfo = SharedResourcesWrapper.Connect("Serial", DriverId, Tl);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", $"Connected to port {ComPort}. Product: {SharedResourcesWrapper.ProductName} Version:{SharedResourcesWrapper.FirmwareVersion}");
|
LogMessage("Connected Set",
|
||||||
|
$"Connected to port {ComPort}. Product: {SharedResourcesWrapper.ProductName} Version:{SharedResourcesWrapper.FirmwareVersion}");
|
||||||
|
|
||||||
_userNewerPulseGuiding = IsNewPulseGuidingSupported();
|
_userNewerPulseGuiding = IsNewPulseGuidingSupported();
|
||||||
_targetDeclination = InvalidParameter;
|
_targetDeclination = InvalidParameter;
|
||||||
@@ -430,19 +436,23 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", $"LX200GPS Detecting if daylight savings message on screen: {SendDateTime}");
|
LogMessage("Connected Set",
|
||||||
|
$"LX200GPS Detecting if daylight savings message on screen: {SendDateTime}");
|
||||||
var displayText = Action("Handbox", "readdisplay");
|
var displayText = Action("Handbox", "readdisplay");
|
||||||
LogMessage("Connected Set", $"Current Handset display: {displayText}");
|
LogMessage("Connected Set", $"Current Handset display: {displayText}");
|
||||||
if (displayText.Contains("Daylight"))
|
if (displayText.Contains("Daylight"))
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", $"LX200GPS Setting Date time and bypassing settings screens: {SendDateTime}");
|
LogMessage("Connected Set",
|
||||||
|
$"LX200GPS Setting Date time and bypassing settings screens: {SendDateTime}");
|
||||||
BypassHandboxEntryForAutostarII();
|
BypassHandboxEntryForAutostarII();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", $"LX200GPS Sending current date and time: {SendDateTime}");
|
LogMessage("Connected Set",
|
||||||
|
$"LX200GPS Sending current date and time: {SendDateTime}");
|
||||||
SendCurrentDateTime("Connect");
|
SendCurrentDateTime("Connect");
|
||||||
LogMessage("Connected Set", $"LX200GPS Attempting manual bypass of prompts: {SendDateTime}");
|
LogMessage("Connected Set",
|
||||||
|
$"LX200GPS Attempting manual bypass of prompts: {SendDateTime}");
|
||||||
ApplySkipAutoStarPrompts("Connect");
|
ApplySkipAutoStarPrompts("Connect");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -457,11 +467,13 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogMessage("Connected Set", $"Skipping first connection telescope adjustments (current connections: {connectionInfo.SameDevice})");
|
LogMessage("Connected Set",
|
||||||
|
$"Skipping first connection telescope adjustments (current connections: {connectionInfo.SameDevice})");
|
||||||
}
|
}
|
||||||
|
|
||||||
var raAndDec = GetTelescopeRaAndDec();
|
var raAndDec = GetTelescopeRaAndDec();
|
||||||
LogMessage("Connected Set", $"Connected OK. Current RA = {_utilitiesExtra.HoursToHMS(raAndDec.RightAscension)} Dec = {_utilitiesExtra.DegreesToDMS(raAndDec.Declination)}");
|
LogMessage("Connected Set",
|
||||||
|
$"Connected OK. Current RA = {_utilitiesExtra.HoursToHMS(raAndDec.RightAscension)} Dec = {_utilitiesExtra.DegreesToDMS(raAndDec.Declination)}");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
@@ -573,6 +585,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,6 +595,7 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -608,7 +622,7 @@ namespace ASCOM.Meade.net
|
|||||||
if (!IsConnected)
|
if (!IsConnected)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(SharedResourcesWrapper.ProductName != TelescopeList.LX200CLASSIC)
|
if (SharedResourcesWrapper.ProductName != TelescopeList.LX200CLASSIC)
|
||||||
{
|
{
|
||||||
_isTargetCoordinateInitRequired = false;
|
_isTargetCoordinateInitRequired = false;
|
||||||
return _isTargetCoordinateInitRequired;
|
return _isTargetCoordinateInitRequired;
|
||||||
@@ -631,9 +645,9 @@ namespace ASCOM.Meade.net
|
|||||||
_isTargetCoordinateInitRequired = false;
|
_isTargetCoordinateInitRequired = false;
|
||||||
return _isTargetCoordinateInitRequired;
|
return _isTargetCoordinateInitRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
//target coordinates are equal current coordinates
|
//target coordinates are equal current coordinates
|
||||||
if((Math.Abs(RightAscension - rightTargetAscension ) <= eps) &&
|
if ((Math.Abs(RightAscension - rightTargetAscension) <= eps) &&
|
||||||
(Math.Abs(Declination - targetDeclination) <= eps))
|
(Math.Abs(Declination - targetDeclination) <= eps))
|
||||||
{
|
{
|
||||||
LogMessage("IsTargetCoordinateInitRequired", "0 diff -> false");
|
LogMessage("IsTargetCoordinateInitRequired", "0 diff -> false");
|
||||||
@@ -699,7 +713,7 @@ namespace ASCOM.Meade.net
|
|||||||
LogMessage("SetLongFormat", $"Get - Azimuth {result}");
|
LogMessage("SetLongFormat", $"Get - Azimuth {result}");
|
||||||
if (IsLongFormat == setLongFormat)
|
if (IsLongFormat == setLongFormat)
|
||||||
LogMessage("SetLongFormat", $"Long coordinate format: {setLongFormat} ");
|
LogMessage("SetLongFormat", $"Long coordinate format: {setLongFormat} ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogMessage("SetLongFormat", $"Long coordinate format: {setLongFormat} ");
|
LogMessage("SetLongFormat", $"Long coordinate format: {setLongFormat} ");
|
||||||
@@ -807,7 +821,8 @@ namespace ASCOM.Meade.net
|
|||||||
//1 - Valid
|
//1 - Valid
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_GetSiteName_Site_out_of_range);
|
throw new ArgumentOutOfRangeException(nameof(site), site,
|
||||||
|
Resources.Telescope_GetSiteName_Site_out_of_range);
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = SharedResourcesWrapper.SendChar(command);
|
var result = SharedResourcesWrapper.SendChar(command);
|
||||||
@@ -825,26 +840,27 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
return SharedResourcesWrapper.SendString("GM");
|
return SharedResourcesWrapper.SendString("GM");
|
||||||
//:GM# Get Site 1 Name
|
//:GM# Get Site 1 Name
|
||||||
//Returns: <string>#
|
//Returns: <string>#
|
||||||
//A ‘#’ terminated string with the name of the requested site.
|
//A ‘#’ terminated string with the name of the requested site.
|
||||||
case 2:
|
case 2:
|
||||||
return SharedResourcesWrapper.SendString("GN");
|
return SharedResourcesWrapper.SendString("GN");
|
||||||
//:GN# Get Site 2 Name
|
//:GN# Get Site 2 Name
|
||||||
//Returns: <string>#
|
//Returns: <string>#
|
||||||
//A ‘#’ terminated string with the name of the requested site.
|
//A ‘#’ terminated string with the name of the requested site.
|
||||||
case 3:
|
case 3:
|
||||||
return SharedResourcesWrapper.SendString("GO");
|
return SharedResourcesWrapper.SendString("GO");
|
||||||
//:GO# Get Site 3 Name
|
//:GO# Get Site 3 Name
|
||||||
//Returns: <string>#
|
//Returns: <string>#
|
||||||
//A ‘#’ terminated string with the name of the requested site.
|
//A ‘#’ terminated string with the name of the requested site.
|
||||||
case 4:
|
case 4:
|
||||||
return SharedResourcesWrapper.SendString("GP");
|
return SharedResourcesWrapper.SendString("GP");
|
||||||
//:GP# Get Site 4 Name
|
//:GP# Get Site 4 Name
|
||||||
//Returns: <string>#
|
//Returns: <string>#
|
||||||
//A ‘#’ terminated string with the name of the requested site.
|
//A ‘#’ terminated string with the name of the requested site.
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException(nameof(site), site, Resources.Telescope_GetSiteName_Site_out_of_range);
|
throw new ArgumentOutOfRangeException(nameof(site), site,
|
||||||
|
Resources.Telescope_GetSiteName_Site_out_of_range);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -882,7 +898,7 @@ namespace ASCOM.Meade.net
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ITelescope Implementation
|
#region ITelescope Implementation
|
||||||
|
|
||||||
public void AbortSlew()
|
public void AbortSlew()
|
||||||
{
|
{
|
||||||
CheckConnected("AbortSlew");
|
CheckConnected("AbortSlew");
|
||||||
@@ -925,13 +941,13 @@ namespace ASCOM.Meade.net
|
|||||||
//todo implement GW Command - Supported in Autostar 43Eg and above
|
//todo implement GW Command - Supported in Autostar 43Eg and above
|
||||||
//if FirmwareIsGreaterThan(TelescopeList.Autostar497_43EG)
|
//if FirmwareIsGreaterThan(TelescopeList.Autostar497_43EG)
|
||||||
//{
|
//{
|
||||||
//var alignmentString = SerialPort.CommandTerminated(":GW#", "#");
|
//var alignmentString = SerialPort.CommandTerminated(":GW#", "#");
|
||||||
//:GW# Get Scope Alignment Status
|
//:GW# Get Scope Alignment Status
|
||||||
//Returns: <mount><tracking><alignment>#
|
//Returns: <mount><tracking><alignment>#
|
||||||
// where:
|
// where:
|
||||||
//mount: A - AzEl mounted, P - Equatorially mounted, G - german mounted equatorial
|
//mount: A - AzEl mounted, P - Equatorially mounted, G - german mounted equatorial
|
||||||
//tracking: T - tracking, N - not tracking
|
//tracking: T - tracking, N - not tracking
|
||||||
//alignment: 0 - needs alignment, 1 - one star aligned, 2 - two star aligned, 3 - three star aligned.
|
//alignment: 0 - needs alignment, 1 - one star aligned, 2 - two star aligned, 3 - three star aligned.
|
||||||
//}
|
//}
|
||||||
|
|
||||||
AlignmentModes alignmentMode;
|
AlignmentModes alignmentMode;
|
||||||
@@ -960,7 +976,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
//todo tidy this up into a better solution that means can :GW#, :AL#, :AA#, & :AP# and checked for Autostar properly
|
//todo tidy this up into a better solution that means can :GW#, :AL#, :AA#, & :AP# and checked for Autostar properly
|
||||||
if (!FirmwareIsGreaterThan(TelescopeList.Autostar497_43Eg))
|
if (!FirmwareIsGreaterThan(TelescopeList.Autostar497_43Eg))
|
||||||
throw new PropertyNotImplementedException("AlignmentMode",true );
|
throw new PropertyNotImplementedException("AlignmentMode", true);
|
||||||
|
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
@@ -994,6 +1010,8 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CheckParked();
|
||||||
|
|
||||||
//firmware bug in 44Eg, :GA# is returning the dec, not the altitude!
|
//firmware bug in 44Eg, :GA# is returning the dec, not the altitude!
|
||||||
var result = SharedResourcesWrapper.SendString("GA");
|
var result = SharedResourcesWrapper.SendString("GA");
|
||||||
//:GA# Get Telescope Altitude
|
//:GA# Get Telescope Altitude
|
||||||
@@ -1006,13 +1024,11 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
catch (ParkedException)
|
catch (ParkedException)
|
||||||
{
|
{
|
||||||
switch (ParkedBehaviour)
|
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||||
{
|
if (parkedPosition != null)
|
||||||
case ParkedBehaviour.NoCoordinates:
|
return parkedPosition.Altitude;
|
||||||
throw;
|
|
||||||
default:
|
throw;
|
||||||
return _parkedPosition.Altitude;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1032,9 +1048,11 @@ namespace ASCOM.Meade.net
|
|||||||
EquatorialCoordinates = GetTelescopeRaAndDec()
|
EquatorialCoordinates = GetTelescopeRaAndDec()
|
||||||
});
|
});
|
||||||
|
|
||||||
double hourAngle = _astroMaths.RightAscensionToHourAngle(altitudeData.UtcDateTime, altitudeData.SiteLongitude,
|
double hourAngle = _astroMaths.RightAscensionToHourAngle(altitudeData.UtcDateTime,
|
||||||
|
altitudeData.SiteLongitude,
|
||||||
altitudeData.EquatorialCoordinates.RightAscension);
|
altitudeData.EquatorialCoordinates.RightAscension);
|
||||||
var altAz = _astroMaths.ConvertEqToHoz(hourAngle, altitudeData.SiteLatitude, altitudeData.EquatorialCoordinates);
|
var altAz = _astroMaths.ConvertEqToHoz(hourAngle, altitudeData.SiteLatitude,
|
||||||
|
altitudeData.EquatorialCoordinates);
|
||||||
return altAz;
|
return altAz;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1073,17 +1091,15 @@ namespace ASCOM.Meade.net
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool _atPark;
|
|
||||||
|
|
||||||
public bool AtPark
|
public bool AtPark
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
LogMessage("AtPark", "Get - " + _atPark);
|
var atPark = SharedResourcesWrapper.IsParked;
|
||||||
return _atPark;
|
LogMessage("AtPark", "Get - " + atPark);
|
||||||
|
return atPark;
|
||||||
}
|
}
|
||||||
private set => _atPark = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IAxisRates AxisRates(TelescopeAxes axis)
|
public IAxisRates AxisRates(TelescopeAxes axis)
|
||||||
@@ -1102,6 +1118,8 @@ namespace ASCOM.Meade.net
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
CheckParked();
|
||||||
|
|
||||||
var result = SharedResourcesWrapper.SendString("GZ");
|
var result = SharedResourcesWrapper.SendString("GZ");
|
||||||
//:GZ# Get telescope azimuth
|
//:GZ# Get telescope azimuth
|
||||||
//Returns: DDD*MM#T or DDD*MM’SS#
|
//Returns: DDD*MM#T or DDD*MM’SS#
|
||||||
@@ -1114,13 +1132,11 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
catch (ParkedException)
|
catch (ParkedException)
|
||||||
{
|
{
|
||||||
switch (ParkedBehaviour)
|
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||||
{
|
if (parkedPosition != null)
|
||||||
case ParkedBehaviour.NoCoordinates:
|
return parkedPosition.Azimuth;
|
||||||
throw;
|
|
||||||
default:
|
throw;
|
||||||
return _parkedPosition.Azimuth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1317,13 +1333,11 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
catch (ParkedException)
|
catch (ParkedException)
|
||||||
{
|
{
|
||||||
switch (ParkedBehaviour)
|
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||||
{
|
if (parkedPosition != null)
|
||||||
case ParkedBehaviour.NoCoordinates:
|
return parkedPosition.Declination;
|
||||||
throw;
|
|
||||||
default:
|
throw;
|
||||||
return _parkedPosition.Declination;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1585,10 +1599,11 @@ namespace ASCOM.Meade.net
|
|||||||
if (AtPark)
|
if (AtPark)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
ParkedPosition parkedPosition;
|
||||||
switch (ParkedBehaviour)
|
switch (ParkedBehaviour)
|
||||||
{
|
{
|
||||||
case ParkedBehaviour.LastGoodPosition:
|
case ParkedBehaviour.LastGoodPosition:
|
||||||
_parkedPosition = new ParkedPosition
|
parkedPosition = new ParkedPosition
|
||||||
{
|
{
|
||||||
Altitude = Altitude,
|
Altitude = Altitude,
|
||||||
Azimuth = Azimuth,
|
Azimuth = Azimuth,
|
||||||
@@ -1602,7 +1617,7 @@ namespace ASCOM.Meade.net
|
|||||||
var longitude = SiteLongitude;
|
var longitude = SiteLongitude;
|
||||||
var raDec = _astroMaths.ConvertHozToEq(utcDateTime, latitude, longitude, ParkedAltAz);
|
var raDec = _astroMaths.ConvertHozToEq(utcDateTime, latitude, longitude, ParkedAltAz);
|
||||||
|
|
||||||
_parkedPosition = new ParkedPosition
|
parkedPosition = new ParkedPosition
|
||||||
{
|
{
|
||||||
Altitude = ParkedAltAz.Altitude,
|
Altitude = ParkedAltAz.Altitude,
|
||||||
Azimuth = ParkedAltAz.Azimuth,
|
Azimuth = ParkedAltAz.Azimuth,
|
||||||
@@ -1610,12 +1625,13 @@ namespace ASCOM.Meade.net
|
|||||||
Declination = raDec.Declination
|
Declination = raDec.Declination
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
parkedPosition = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Setting park to true before sending the park command as the Autostar and Audiostar stop serial communications once the park command has been issued.
|
//Setting park to true before sending the park command as the Autostar and Audiostar stop serial communications once the park command has been issued.
|
||||||
AtPark = true;
|
SharedResourcesWrapper.SetParked(true, parkedPosition);
|
||||||
|
|
||||||
|
|
||||||
SharedResourcesWrapper.SendBlind("hP");
|
SharedResourcesWrapper.SendBlind("hP");
|
||||||
//:hP# Autostar, Autostar II and LX 16”Slew to Park Position
|
//:hP# Autostar, Autostar II and LX 16”Slew to Park Position
|
||||||
//Returns: Nothing
|
//Returns: Nothing
|
||||||
@@ -1764,13 +1780,11 @@ namespace ASCOM.Meade.net
|
|||||||
}
|
}
|
||||||
catch (ParkedException)
|
catch (ParkedException)
|
||||||
{
|
{
|
||||||
switch (ParkedBehaviour)
|
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||||
{
|
if (parkedPosition != null)
|
||||||
case ParkedBehaviour.NoCoordinates:
|
return parkedPosition.RightAscension;
|
||||||
throw;
|
|
||||||
default:
|
throw;
|
||||||
return _parkedPosition.RightAscension;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2698,7 +2712,7 @@ namespace ASCOM.Meade.net
|
|||||||
|
|
||||||
BypassHandboxEntryForAutostarII();
|
BypassHandboxEntryForAutostarII();
|
||||||
|
|
||||||
AtPark = false;
|
SharedResourcesWrapper.SetParked(false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool BypassHandboxEntryForAutostarII()
|
private bool BypassHandboxEntryForAutostarII()
|
||||||
|
|||||||
@@ -141,6 +141,7 @@
|
|||||||
<Compile Include="LocalServer.cs" />
|
<Compile Include="LocalServer.cs" />
|
||||||
<Compile Include="MeadeTelescopeBase.cs" />
|
<Compile Include="MeadeTelescopeBase.cs" />
|
||||||
<Compile Include="ParkedBehaviour.cs" />
|
<Compile Include="ParkedBehaviour.cs" />
|
||||||
|
<Compile Include="ParkedPosition.cs" />
|
||||||
<Compile Include="ProfileFactory.cs" />
|
<Compile Include="ProfileFactory.cs" />
|
||||||
<Compile Include="ProfileProperties.cs" />
|
<Compile Include="ProfileProperties.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
|||||||
@@ -493,5 +493,15 @@ namespace ASCOM.Meade.net
|
|||||||
Count = 0;
|
Count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetParked(bool atPark, ParkedPosition parkedPosition)
|
||||||
|
{
|
||||||
|
IsParked = atPark;
|
||||||
|
ParkedPosition = parkedPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsParked { get; private set; }
|
||||||
|
|
||||||
|
public static ParkedPosition ParkedPosition { get; private set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,10 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
void SetupDialog();
|
void SetupDialog();
|
||||||
void WriteProfile(ProfileProperties profileProperties);
|
void WriteProfile(ProfileProperties profileProperties);
|
||||||
void ReadCharacters(int throwAwayCharacters);
|
void ReadCharacters(int throwAwayCharacters);
|
||||||
|
|
||||||
|
void SetParked(bool atPark, ParkedPosition parkedPosition);
|
||||||
|
bool IsParked { get; }
|
||||||
|
ParkedPosition ParkedPosition { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
public class SharedResourcesWrapper : ISharedResourcesWrapper
|
||||||
@@ -99,5 +103,14 @@ namespace ASCOM.Meade.net.Wrapper
|
|||||||
{
|
{
|
||||||
SharedResources.WriteProfile(profileProperties);
|
SharedResources.WriteProfile(profileProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetParked(bool atPark, ParkedPosition parkedPosition)
|
||||||
|
{
|
||||||
|
SharedResources.SetParked(atPark, parkedPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsParked => SharedResources.IsParked;
|
||||||
|
|
||||||
|
public ParkedPosition ParkedPosition => SharedResources.ParkedPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user