Refactored code
Added support for setting the guide rate on the RCX400
This commit is contained in:
@@ -965,24 +965,16 @@ namespace Meade.net.Telescope.UnitTests
|
||||
Assert.That(exception.Message, Is.EqualTo("Not connected to telescope when trying to execute: CanSetGuideRates Get"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanSetGuideRates_Get_WhenConnectedToAutostar_ThenReturnsFalse()
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_31Ee, false)]
|
||||
[TestCase(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G, true )]
|
||||
[TestCase(TelescopeList.RCX400, TelescopeList.RCX400_22I, true)]
|
||||
public void CanSetGuideRates_Get_WhenConnectedToTelescope_ThenReturnsExpectedValue( string productName, string firmware, bool expectedResult)
|
||||
{
|
||||
ConnectTelescope();
|
||||
ConnectTelescope(productName, firmware);
|
||||
|
||||
var result = _telescope.CanSetGuideRates;
|
||||
|
||||
Assert.That(result, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanSetGuideRates_Get_WhenConnectedToLX200GPS_ThenReturnsTrue()
|
||||
{
|
||||
ConnectTelescope(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G);
|
||||
|
||||
var result = _telescope.CanSetGuideRates;
|
||||
|
||||
Assert.That(result, Is.True);
|
||||
Assert.That(result, Is.EqualTo(expectedResult));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -1195,6 +1187,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
}
|
||||
|
||||
[TestCase(TelescopeList.LX200GPS, TelescopeList.LX200GPS_42G, true)]
|
||||
[TestCase(TelescopeList.RCX400, TelescopeList.RCX400_22I, true)]
|
||||
[TestCase(TelescopeList.Autostar497, TelescopeList.Autostar497_43Eg, false)]
|
||||
public void CanUnpark_Get_ReturnsExpectedValue(string productVersion, string firmware, bool expectedResult)
|
||||
{
|
||||
|
||||
@@ -579,33 +579,38 @@ namespace ASCOM.Meade.net
|
||||
LogMessage("SendTimeTimeToHandbox", $"SendDateTime: {_profileProperties.SendDateTime}");
|
||||
if (_profileProperties.SendDateTime)
|
||||
{
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
case TelescopeList.LX200GPS:
|
||||
case TelescopeList.RCX400:
|
||||
{
|
||||
LogMessage("SendTimeTimeToHandbox",
|
||||
$"LX200GPS Detecting if daylight savings message on screen: {_profileProperties.SendDateTime}");
|
||||
$"{SharedResourcesWrapper.ProductName} Detecting if daylight savings message on screen: {_profileProperties.SendDateTime}");
|
||||
var displayText = Action("Handbox", "readdisplay");
|
||||
LogMessage("SendTimeTimeToHandbox", $"Current Handset display: {displayText}");
|
||||
if (displayText.Contains("Daylight"))
|
||||
{
|
||||
LogMessage("SendTimeTimeToHandbox",
|
||||
$"LX200GPS Setting Date time and bypassing settings screens: {_profileProperties.SendDateTime}");
|
||||
$"{SharedResourcesWrapper.ProductName} Setting Date time and bypassing settings screens: {_profileProperties.SendDateTime}");
|
||||
BypassHandboxEntryForAutostarII();
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("SendTimeTimeToHandbox",
|
||||
$"LX200GPS Sending current date and time: {_profileProperties.SendDateTime}");
|
||||
$"{SharedResourcesWrapper.ProductName} Sending current date and time: {_profileProperties.SendDateTime}");
|
||||
SendCurrentDateTime();
|
||||
LogMessage("SendTimeTimeToHandbox",
|
||||
$"LX200GPS Attempting manual bypass of prompts: {_profileProperties.SendDateTime}");
|
||||
$"{SharedResourcesWrapper.ProductName} Attempting manual bypass of prompts: {_profileProperties.SendDateTime}");
|
||||
ApplySkipAutoStarPrompts();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage("Connected Set", "Autostar Attempting manual bypass of prompts");
|
||||
default:
|
||||
LogMessage("Connected Set", $"{SharedResourcesWrapper.ProductName} Attempting manual bypass of prompts");
|
||||
ApplySkipAutoStarPrompts();
|
||||
SendCurrentDateTime();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -647,7 +652,10 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private void ApplySkipAutoStarPrompts()
|
||||
{
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS || SharedResourcesWrapper.ProductName == TelescopeList.RCX400)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
case TelescopeList.LX200GPS:
|
||||
case TelescopeList.RCX400:
|
||||
{
|
||||
var displayText = Action("Handbox", "readdisplay");
|
||||
|
||||
@@ -659,8 +667,10 @@ namespace ASCOM.Meade.net
|
||||
_utilities.WaitForMilliseconds(2000);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (SharedResourcesWrapper.ProductName == TelescopeList.Autostar497)
|
||||
default:
|
||||
{
|
||||
var i = 10;
|
||||
while (i > 0)
|
||||
@@ -676,6 +686,9 @@ namespace ASCOM.Meade.net
|
||||
_utilities.WaitForMilliseconds(500);
|
||||
i--;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -707,26 +720,20 @@ namespace ASCOM.Meade.net
|
||||
return false;
|
||||
case "pulse guiding":
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.Autostar497)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
case TelescopeList.Autostar497:
|
||||
return FirmwareIsGreaterThan(TelescopeList.Autostar497_31Ee);
|
||||
}
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
{
|
||||
case TelescopeList.LX200GPS:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.RCX400)
|
||||
{
|
||||
case TelescopeList.RCX400:
|
||||
return FirmwareIsGreaterThan(TelescopeList.RCX400_22I);
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogMessage("IsNewPulseGuidingSupported", $"Error: {ex.Message}");
|
||||
@@ -746,13 +753,15 @@ namespace ASCOM.Meade.net
|
||||
|
||||
private bool IsGuideRateSettingSupported()
|
||||
{
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
case TelescopeList.LX200GPS:
|
||||
case TelescopeList.RCX400:
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsGwCommandSupported()
|
||||
{
|
||||
@@ -1230,15 +1239,17 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
CheckConnected("Altitude Get");
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
case TelescopeList.LX200GPS:
|
||||
case TelescopeList.RCX400:
|
||||
return GetRealTelescopeAltitude();
|
||||
}
|
||||
|
||||
default:
|
||||
var altAz = CalcAltAzFromTelescopeEqData();
|
||||
LogMessage("Altitude", $"{altAz.Altitude}");
|
||||
return altAz.Altitude;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogMessage("Altitude Get", $"Error: {ex.Message}");
|
||||
@@ -1394,15 +1405,17 @@ namespace ASCOM.Meade.net
|
||||
{
|
||||
CheckConnected("Azimuth Get");
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
case TelescopeList.LX200GPS:
|
||||
case TelescopeList.RCX400:
|
||||
return GetRealTelescopeAzimuth();
|
||||
}
|
||||
|
||||
default:
|
||||
var altAz = CalcAltAzFromTelescopeEqData();
|
||||
LogMessage("Azimuth Get", $"{altAz.Azimuth}");
|
||||
return altAz.Azimuth;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogMessage("Azimuth Get", $"Error: {ex.Message}");
|
||||
@@ -1754,6 +1767,7 @@ namespace ASCOM.Meade.net
|
||||
var unParkableScopes = new List<string>
|
||||
{
|
||||
TelescopeList.LX200GPS,
|
||||
TelescopeList.RCX400,
|
||||
TelescopeList.LX200CLASSIC
|
||||
};
|
||||
|
||||
@@ -3812,16 +3826,17 @@ namespace ASCOM.Meade.net
|
||||
if (!AtPark)
|
||||
return;
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
switch (SharedResourcesWrapper.ProductName)
|
||||
{
|
||||
|
||||
case TelescopeList.RCX400:
|
||||
case TelescopeList.LX200GPS:
|
||||
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
|
||||
|
||||
BypassHandboxEntryForAutostarII();
|
||||
}
|
||||
else if (SharedResourcesWrapper.ProductName == TelescopeList.LX200CLASSIC)
|
||||
break;
|
||||
case TelescopeList.LX200CLASSIC:
|
||||
{
|
||||
if (SharedResourcesWrapper.RestartTracking)
|
||||
{
|
||||
@@ -3829,6 +3844,9 @@ namespace ASCOM.Meade.net
|
||||
Tracking = true;
|
||||
LogMessage("Unpark", "Turning tracking on completed");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SharedResourcesWrapper.SetParked(false, null, false);
|
||||
|
||||
Reference in New Issue
Block a user