Added Alt Az coordinates to the connected message.

This commit is contained in:
2022-05-07 14:00:29 +01:00
parent 9866578cab
commit ede7c33302
3 changed files with 69 additions and 48 deletions
+65 -45
View File
@@ -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