From 21f672df742447f418aae352aefb9f40d5df00b4 Mon Sep 17 00:00:00 2001 From: Robert Morgan Date: Fri, 21 Apr 2023 12:43:34 -0400 Subject: [PATCH] Updated Target RA and Dec to not error when checking NaN values --- GS.Ascom.SkyTelescope/Telescope.cs | 8 ++------ GS.Server/SkyTelescope/SkyServer.cs | 4 ---- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/GS.Ascom.SkyTelescope/Telescope.cs b/GS.Ascom.SkyTelescope/Telescope.cs index 40f21bd..91339cb 100644 --- a/GS.Ascom.SkyTelescope/Telescope.cs +++ b/GS.Ascom.SkyTelescope/Telescope.cs @@ -1447,9 +1447,7 @@ public double TargetDeclination CheckCapability(SkySettings.CanSlew, "TargetDeclination", true); CheckRange(value, -90, 90, "TargetDeclination"); - //var ra = SkyServer.TargetRa; - var ra = TargetRightAscension; - if (double.IsNaN(ra)) ra = RightAscension; + var ra = double.IsNaN(SkyServer.TargetRa) ? RightAscension : TargetRightAscension; var radec = Transforms.CoordTypeToInternal(ra, value); SkyServer.TargetDec = radec.Y; } @@ -1480,9 +1478,7 @@ public double TargetRightAscension CheckCapability(SkySettings.CanSlew, "TargetRightAscension", true); CheckRange(value, 0, 24, "TargetRightAscension"); - //var dec = SkyServer.TargetDec; - var dec = TargetDeclination; - if (double.IsNaN(dec)) dec = Declination; + var dec = double.IsNaN(SkyServer.TargetDec) ? Declination : TargetDeclination; var radec = Transforms.CoordTypeToInternal(value, dec); SkyServer.TargetRa = radec.X; } diff --git a/GS.Server/SkyTelescope/SkyServer.cs b/GS.Server/SkyTelescope/SkyServer.cs index 3eb80a9..c8c75d3 100644 --- a/GS.Server/SkyTelescope/SkyServer.cs +++ b/GS.Server/SkyTelescope/SkyServer.cs @@ -4020,10 +4020,6 @@ private static bool MountConnect() { Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Server, Category = MonitorCategory.Mount, Type = MonitorType.Information, Method = MethodBase.GetCurrentMethod()?.Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"Pec: {pecmsg}" }; MonitorLog.LogToMonitor(monitorItem); - //set Ra Dec targets to current location - _targetRaDec.X = RightAscension; - _targetRaDec.Y = Declination; - return true; }