Пример #1
0
        /// <summary>
        /// adds a pulse wait item to a blocking queue for processing
        /// </summary>
        /// <param name="entry"></param>
        public static void AddPulseStatusEntry(PulseStatusEntry entry)
        {
            var add = _pulseBlockingCollection.TryAdd(entry);

            if (add)
            {
                return;
            }
            ResetGuiding(entry.Axis, false);
            var monitorItem = new MonitorEntry
            {
                Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Warning, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"Add Failed: {entry.Axis},{entry.Duration}"
            };

            MonitorLog.LogToMonitor(monitorItem);
        }
Пример #2
0
 /// <summary>
 /// Set pulseguiding to false for an entry
 /// </summary>
 /// <param name="entry"></param>
 private static void ResetGuiding(PulseStatusEntry entry)
 {
     ResetGuiding(entry.Axis, false);
 }
Пример #3
0
        /// <summary>
        /// Process queue items monitor the pulse
        /// </summary>
        /// <param name="entry"></param>
        private static void ProcessPulseStatusQueue(PulseStatusEntry entry)
        {
            try
            {
                if (!SkyServer.Tracking || SkyServer.IsSlewing)
                {
                    ResetGuiding(entry);
                    return;
                }
                entry.ProcessDateTime = HiResDateTime.UtcNow;

                bool pulseRunning;
                switch (SkySettings.Mount)
                {
                case MountType.Simulator:
                    if (entry.Axis == 0)
                    {
                        var statuscmd = new CmdPulseRaRunning(MountQueue.NewId);
                        pulseRunning = Convert.ToBoolean(MountQueue.GetCommandResult(statuscmd).Result);
                    }
                    else
                    {
                        var statuscmd = new CmdPulseDecRunning(MountQueue.NewId);
                        pulseRunning = Convert.ToBoolean(MountQueue.GetCommandResult(statuscmd).Result);
                    }
                    break;

                case MountType.SkyWatcher:
                    if (entry.Axis == 0)
                    {
                        var statussky = new SkyPulseRaRunning(SkyQueue.NewId);
                        pulseRunning = Convert.ToBoolean(SkyQueue.GetCommandResult(statussky).Result);
                    }
                    else
                    {
                        var statussky = new SkyPulseDecRunning(SkyQueue.NewId);
                        pulseRunning = Convert.ToBoolean(SkyQueue.GetCommandResult(statussky).Result);
                    }
                    break;

                default:
                    pulseRunning = false;
                    break;
                }
                ResetGuiding(entry.Axis, pulseRunning);

                var curtime     = HiResDateTime.UtcNow;
                var processtime = (int)(curtime - entry.ProcessDateTime).TotalMilliseconds;
                var alltime     = (int)(curtime - entry.CreateDateTime).TotalMilliseconds;
                var monitorItem = new MonitorEntry
                {
                    Datetime = curtime, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Data, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"Complete,{alltime},{processtime}-{entry.Duration}={processtime - entry.Duration}"
                };
                MonitorLog.LogToMonitor(monitorItem);
            }
            catch (Exception ex)
            {
                ResetGuiding(entry.Axis, false);

                var monitorItem = new MonitorEntry
                {
                    Datetime = HiResDateTime.UtcNow, Device = MonitorDevice.Telescope, Category = MonitorCategory.Mount, Type = MonitorType.Error, Method = MethodBase.GetCurrentMethod().Name, Thread = Thread.CurrentThread.ManagedThreadId, Message = $"{ex.Message}"
                };
                MonitorLog.LogToMonitor(monitorItem);
            }
        }