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
@@ -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);
}
+33 -13
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)
{
@@ -1101,6 +1102,17 @@ namespace ASCOM.Meade.net
CheckConnected("Altitude Get");
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
{
return GetRealTelescopeAltitude();
}
var altAz = CalcAltAzFromTelescopeEqData();
LogMessage("Altitude", $"{altAz.Altitude}");
return altAz.Altitude;
}
}
private double GetRealTelescopeAltitude()
{
try
{
@@ -1126,12 +1138,6 @@ namespace ASCOM.Meade.net
}
}
var altAz = CalcAltAzFromTelescopeEqData();
LogMessage("Altitude", $"{altAz.Altitude}");
return altAz.Altitude;
}
}
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
@@ -1211,6 +1226,17 @@ namespace ASCOM.Meade.net
CheckConnected("Azimuth Get");
if (SharedResourcesWrapper.ProductName == TelescopeList.LX200GPS)
{
return GetRealTelescopeAzimuth();
}
var altAz = CalcAltAzFromTelescopeEqData();
LogMessage("Azimuth Get", $"{altAz.Azimuth}");
return altAz.Azimuth;
}
}
private double GetRealTelescopeAzimuth()
{
try
{
@@ -1236,12 +1262,6 @@ namespace ASCOM.Meade.net
}
}
var altAz = CalcAltAzFromTelescopeEqData();
LogMessage("Azimuth Get", $"{altAz.Azimuth}");
return altAz.Azimuth;
}
}
public bool CanFindHome
{
get
+1
View File
@@ -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;