Added Alt Az coordinates to the connected message.
This commit is contained in:
@@ -477,7 +477,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
|
||||
if (expectedConnected)
|
||||
{
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.AtLeastOnce);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}", false), Times.Never);
|
||||
}
|
||||
}
|
||||
@@ -488,7 +488,7 @@ namespace Meade.net.Telescope.UnitTests
|
||||
ConnectTelescope(TelescopeList.LX200GPS, string.Empty);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.Connect("Serial", It.IsAny<string>(), It.IsAny<ITraceLogger>()), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.Once);
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendString("GZ", false), Times.AtLeastOnce);
|
||||
|
||||
_sharedResourcesWrapperMock.Verify(x => x.SendBlind($"Rg{_profileProperties.GuideRateArcSecondsPerSecond:00.0}", false), Times.Once);
|
||||
}
|
||||
|
||||
@@ -503,8 +503,9 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
|
||||
var raAndDec = GetTelescopeRaAndDec();
|
||||
var altAndAz = GetTelescopeAltAz();
|
||||
LogMessage("Connected Set",
|
||||
$"Connected OK. Current RA = {_utilitiesExtra.HoursToHMS(raAndDec.RightAscension)} Dec = {_utilitiesExtra.DegreesToDMS(raAndDec.Declination)}");
|
||||
$"Connected OK. Current RA = {_utilitiesExtra.HoursToHMS(raAndDec.RightAscension)} Dec = {_utilitiesExtra.DegreesToDMS(raAndDec.Declination)} Az={altAndAz.Azimuth} Alt={altAndAz.Altitude}");
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -1102,28 +1103,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
{
|
||||
try
|
||||
{
|
||||
CheckParked();
|
||||
|
||||
//firmware bug in 44Eg, :GA# is returning the dec, not the altitude!
|
||||
var result = SharedResourcesWrapper.SendString("GA");
|
||||
//:GA# Get Telescope Altitude
|
||||
//Returns: sDD* MM# or sDD*MM'SS#
|
||||
//The current scope altitude. The returned format depending on the current precision setting.
|
||||
|
||||
var alt = _utilities.DMSToDegrees(result);
|
||||
LogMessage("Altitude", $"{alt}");
|
||||
return alt;
|
||||
}
|
||||
catch (ParkedException)
|
||||
{
|
||||
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||
if (parkedPosition != null)
|
||||
return parkedPosition.Altitude;
|
||||
|
||||
throw;
|
||||
}
|
||||
return GetRealTelescopeAltitude();
|
||||
}
|
||||
|
||||
var altAz = CalcAltAzFromTelescopeEqData();
|
||||
@@ -1132,6 +1112,32 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
}
|
||||
|
||||
private double GetRealTelescopeAltitude()
|
||||
{
|
||||
try
|
||||
{
|
||||
CheckParked();
|
||||
|
||||
//firmware bug in 44Eg, :GA# is returning the dec, not the altitude!
|
||||
var result = SharedResourcesWrapper.SendString("GA");
|
||||
//:GA# Get Telescope Altitude
|
||||
//Returns: sDD* MM# or sDD*MM'SS#
|
||||
//The current scope altitude. The returned format depending on the current precision setting.
|
||||
|
||||
var alt = _utilities.DMSToDegrees(result);
|
||||
LogMessage("Altitude", $"{alt}");
|
||||
return alt;
|
||||
}
|
||||
catch (ParkedException)
|
||||
{
|
||||
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||
if (parkedPosition != null)
|
||||
return parkedPosition.Altitude;
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private HorizonCoordinates CalcAltAzFromTelescopeEqData()
|
||||
{
|
||||
var altitudeData = new AltitudeData
|
||||
@@ -1159,6 +1165,15 @@ namespace ASCOM.Meade.net
|
||||
};
|
||||
}
|
||||
|
||||
private HorizonCoordinates GetTelescopeAltAz()
|
||||
{
|
||||
return new HorizonCoordinates()
|
||||
{
|
||||
Altitude = GetRealTelescopeAltitude(),
|
||||
Azimuth = GetRealTelescopeAzimuth()
|
||||
};
|
||||
}
|
||||
|
||||
public double ApertureArea
|
||||
{
|
||||
get
|
||||
@@ -1212,28 +1227,7 @@ namespace ASCOM.Meade.net
|
||||
|
||||
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
|
||||
{
|
||||
try
|
||||
{
|
||||
CheckParked();
|
||||
|
||||
var result = SharedResourcesWrapper.SendString("GZ");
|
||||
//:GZ# Get telescope azimuth
|
||||
//Returns: DDD*MM#T or DDD*MM'SS#
|
||||
//The current telescope Azimuth depending on the selected precision.
|
||||
|
||||
double az = _utilities.DMSToDegrees(result);
|
||||
|
||||
LogMessage("Azimuth Get", $"{az}");
|
||||
return az;
|
||||
}
|
||||
catch (ParkedException)
|
||||
{
|
||||
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||
if (parkedPosition != null)
|
||||
return parkedPosition.Azimuth;
|
||||
|
||||
throw;
|
||||
}
|
||||
return GetRealTelescopeAzimuth();
|
||||
}
|
||||
|
||||
var altAz = CalcAltAzFromTelescopeEqData();
|
||||
@@ -1242,6 +1236,32 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
}
|
||||
|
||||
private double GetRealTelescopeAzimuth()
|
||||
{
|
||||
try
|
||||
{
|
||||
CheckParked();
|
||||
|
||||
var result = SharedResourcesWrapper.SendString("GZ");
|
||||
//:GZ# Get telescope azimuth
|
||||
//Returns: DDD*MM#T or DDD*MM'SS#
|
||||
//The current telescope Azimuth depending on the selected precision.
|
||||
|
||||
double az = _utilities.DMSToDegrees(result);
|
||||
|
||||
LogMessage("Azimuth Get", $"{az}");
|
||||
return az;
|
||||
}
|
||||
catch (ParkedException)
|
||||
{
|
||||
var parkedPosition = SharedResourcesWrapper.ParkedPosition;
|
||||
if (parkedPosition != null)
|
||||
return parkedPosition.Azimuth;
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanFindHome
|
||||
{
|
||||
get
|
||||
|
||||
@@ -390,6 +390,7 @@ namespace ASCOM.Meade.net
|
||||
SharedSerial.StopBits = (SerialStopBits)Enum.Parse(typeof(SerialStopBits), profileProperties.StopBits);
|
||||
SharedSerial.Parity = (SerialParity)Enum.Parse(typeof(SerialParity), profileProperties.Parity);
|
||||
SharedSerial.Handshake = (SerialHandshake)Enum.Parse(typeof(SerialHandshake), profileProperties.Handshake);
|
||||
SharedSerial.ReceiveTimeout = 5; //5 second timeout;
|
||||
SharedSerial.Speed = SerialSpeed.ps9600;
|
||||
|
||||
var wantedSpeed = (SerialSpeed)profileProperties.Speed;
|
||||
@@ -454,7 +455,7 @@ namespace ASCOM.Meade.net
|
||||
}
|
||||
}
|
||||
SharedSerial.Connected = true;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
ProductName = SendString("GVP");
|
||||
|
||||
Reference in New Issue
Block a user