コード例 #1
0
		private void BeginDirectSlew()
		{
			if ( Status.Tracking )
			{
				if ( Capabilities.CanSlewAsync )
				{
					TelescopeManager.BeginSlewToCoordinatesAsync( TargetRightAscension, TargetDeclination );
				}
				else
				{
					TelescopeManager.DoSlewToCoordinates( TargetRightAscension, TargetDeclination, false );
				}
			}
			else
			{
				if ( Capabilities.CanSlewAltAzAsync )
				{
					TelescopeManager.BeginSlewToAltAzAsync( TargetAzimuth, TargetAltitude );
				}
				else
				{
					TelescopeManager.DoSlewToAltAz( TargetAzimuth, TargetAltitude, false );
				}
			}

			_isSlewInProgress = true;			
		}
コード例 #2
0
        private void StartMove(object param)
        {
            MoveDirections direction = (MoveDirections)param;
            JogRate        rate;

            if (IsVariableJog)
            {
                rate = SelectedJogRate;

                // If the telescope has different rates for the secondary (Dec or Altitude) axis, use them.

                if (HasAsymmetricJogRates &&
                    (direction == MoveDirections.Up || direction == MoveDirections.Down ||
                     direction == MoveDirections.North || direction == MoveDirections.South))
                {
                    rate = SelectedSecondaryJogRate;
                }

                try
                {
                    TelescopeManager.StartJogScope(direction, rate);
                    _jogInProgress = true;
                }
                catch (Exception xcp)
                {
                    ShowMessage("Unable to use the requested Jog rate.\r\n\r\n"
                                + xcp.Message, "Unsupported Jog Rate Selected");
                }
            }
        }
コード例 #3
0
        private void ApplyOffsetTrackingRate(DriveRates rate, double raOffset, double decOffset)
        {
            if (!IsConnected)
            {
                return;
            }

            if (Capabilities.CanSetRightAscensionRate)
            {
                TelescopeManager.SetRaOffsetTrackingRate(raOffset);
            }

            if (Capabilities.CanSetDeclinationRate)
            {
                TelescopeManager.SetDecOffsetTrackingRate(decOffset);
            }

            if (rate != Status.TrackingRate)
            {
                TelescopeManager.SetTrackingRate(rate);

                Status.TrackingRate = rate;
                UpdateTrackingRateText();
            }
        }
コード例 #4
0
        private void SetupOK()
        {
            if (!IsTelescopeActive && TelescopeID != TelescopeSetupVm.TelescopeID)
            {
                TelescopeID = TelescopeSetupVm.TelescopeID;
                TelescopeManager.SetTelescopeID(TelescopeID);
            }

            if (!IsDomeActive && DomeID != DomeSetupVm.DomeID)
            {
                DomeID = DomeSetupVm.DomeID;
                DomeManager.SetDomeID(DomeID);
            }

            Globals.DomeLayout = DomeSetupVm.GetLayout();

            if (!IsFocuserActive && FocuserID != FocuserSetupVm.FocuserID)
            {
                FocuserID = FocuserSetupVm.FocuserID;
                FocuserManager.SetFocuserID(FocuserID);
            }

            Globals.SuppressTrayBubble       = SuppressTrayBubble;
            Globals.UseCustomTheme           = UseCustomTheme;
            Globals.FocuserTemperatureOffset = FocuserSetupVm.TemperatureOffset;

            SaveSettings();

            OnRequestClose(true);
        }
コード例 #5
0
        public TelescopeCapabilities(TelescopeManager mgr)
        {
            DeviceManager = mgr;

            CanFindHome              = mgr.CanFindHome;
            CanPark                  = mgr.CanPark;
            CanPulseGuide            = mgr.CanPulseGuide;
            CanSetDeclinationRate    = mgr.CanSetDeclinationRate;
            CanSetGuideRates         = mgr.CanSetGuideRates;
            CanSetPark               = mgr.CanSetPark;
            CanSetPierSide           = mgr.CanSetPierSide;
            CanSetRightAscensionRate = mgr.CanSetRightAscensionRate;
            CanSetTracking           = mgr.CanSetTracking;
            CanSlew                  = mgr.CanSlew;
            CanSlewAltAz             = mgr.CanSlewAltAz;
            CanSlewAltAzAsync        = mgr.CanSlewAltAzAsync;
            CanSlewAsync             = mgr.CanSlewAsync;
            CanSync                  = mgr.CanSync;
            CanSyncAltAz             = mgr.CanSyncAltAz;
            CanUnpark                = mgr.CanUnpark;
            CanMovePrimaryAxis       = mgr.CanMoveAxis(TelescopeAxes.axisPrimary);
            CanMoveSecondaryAxis     = mgr.CanMoveAxis(TelescopeAxes.axisSecondary);
            CanMoveTertiaryAxis      = mgr.CanMoveAxis(TelescopeAxes.axisTertiary);

            PrimaryAxisRates   = AxisRatesToArray(mgr.AxisRates(TelescopeAxes.axisPrimary));
            SecondaryAxisRates = AxisRatesToArray(mgr.AxisRates(TelescopeAxes.axisSecondary));
            TertiaryAxisRates  = AxisRatesToArray(mgr.AxisRates(TelescopeAxes.axisTertiary));
        }
コード例 #6
0
        public DevHubTelescopeStatus(TelescopeManager mgr)
            : base(mgr)
        {
            try
            {
                if (mgr.ParkingState != ParkingStateEnum.ParkInProgress)
                {
                    ParkingState = (AtPark) ? ParkingStateEnum.IsAtPark : ParkingStateEnum.Unparked;
                }

                double sidTime = SiderealTime;
                double ra      = RightAscension;

                if (Double.IsNaN(sidTime) || Double.IsNaN(ra))
                {
                    LocalHourAngle = Double.NaN;
                }
                else
                {
                    LocalHourAngle = CalculateHourAngle(RightAscension);
                }

                IsCounterWeightUp = (mgr.Parameters.AlignmentMode == AlignmentModes.algGermanPolar &&
                                     CalculateCounterWeightUp(SideOfPier, LocalHourAngle));
            }
            catch (Exception)
            {
                IsCounterWeightUp = false;
                ParkingState      = ParkingStateEnum.Unparked;
                LocalHourAngle    = Double.NaN;
            }
        }
コード例 #7
0
        private void ChooseScope()
        {
            string oldID = TelescopeID;
            string newID = TelescopeManager.Choose(oldID);

            if (String.IsNullOrEmpty(newID))
            {
                return;
            }

            // Prevent us from choosing ourselves as our telescope.

            if (newID == Globals.DevHubTelescopeID)
            {
                string msg = Globals.DevHubTelescopeID + " cannot be chosen as the telescope!";
                ShowMessage(msg, "Invalid Telescope Selected");

                return;
            }

            if (newID != oldID)
            {
                TelescopeID = newID;
            }
        }
コード例 #8
0
        public TelescopeParameters(TelescopeManager mgr)
        {
            DeviceManager = mgr;

            AlignmentMode    = mgr.AlignmentMode;
            ApertureArea     = mgr.ApertureArea;
            ApertureDiameter = mgr.ApertureDiameter;
            Description      = mgr.Description;
            DriverInfo       = mgr.DriverInfo;
            DoesRefraction   = mgr.DoesRefraction;
            DriverVersion    = mgr.DriverVersion;
            EquatorialSystem = mgr.EquatorialSystem;
            FocalLength      = mgr.FocalLength;
            InterfaceVersion = mgr.InterfaceVersion;
            SiteElevation    = mgr.SiteElevation;
            SiteLatitude     = mgr.SiteLatitude;
            SiteLongitude    = mgr.SiteLongitude;
            SlewSettleTime   = mgr.SlewSettleTime;

            ArrayList arr = mgr.SupportedActions;

            this.SupportedActions = (string[])arr.ToArray(typeof(string));

            List <TrackingRateItem> temp = new List <TrackingRateItem>();

            ITrackingRates rates = (ITrackingRates)mgr.TrackingRates;

            if (rates != null)
            {
                for (int i = 1; i <= rates.Count; ++i)
                {
                    DriveRates rate = rates[i];
                    string     name = "";

                    switch (rate)
                    {
                    case DriveRates.driveKing:
                        name = "King";
                        break;

                    case DriveRates.driveLunar:
                        name = "Lunar";
                        break;

                    case DriveRates.driveSidereal:
                        name = "Sidereal";
                        break;

                    case DriveRates.driveSolar:
                        name = "Solar";
                        break;
                    }

                    temp.Add(new TrackingRateItem(name, rate));
                }
            }

            TrackingRates = temp.ToArray();
        }
コード例 #9
0
 private void StopMotion(object param)
 {
     if (IsVariableJog && _jogInProgress)
     {
         MoveDirections direction = (param == null) ? MoveDirections.None : (MoveDirections)param;
         TelescopeManager.StopJogScope(direction);
     }
 }
コード例 #10
0
        private void SetParkPosition()
        {
            TelescopeManager.SetParkPosition();

            IMessageBoxService msgSvc = ServiceContainer.Instance.GetService <IMessageBoxService>();

            string text  = "The current telescope position has been remembered as the Park position.";
            string title = "Set ParkPosition";

            msgSvc.Show(text, title, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.None);
        }
コード例 #11
0
        private void DoFixedSlew(object param)
        {
            if (!IsVariableJog)
            {
                MoveDirections direction = (param == null) ? MoveDirections.None : (MoveDirections)param;

                if (direction != MoveDirections.None)
                {
                    TelescopeManager.StartFixedSlew(direction, SelectedSlewAmount.Amount);

                    _isFixedSlewInProgress = true;
                }
            }
        }
コード例 #12
0
        private void StartMove(object param)
        {
            MoveDirections direction = (MoveDirections)param;

            if (IsVariableJog)
            {
                try
                {
                    TelescopeManager.StartJogScope(direction, SelectedJogRate);
                    _jogInProgress = true;
                }
                catch (Exception xcp)
                {
                    ShowMessage("Unable to use the requested Jog rate.\r\n\r\n"
                                + xcp.Message, "Unsupported Jog Rate Selected");
                }
            }
        }
コード例 #13
0
        private static void LoadDeviceSettings()
        {
            TelescopeSettings scopeSettings = TelescopeSettings.FromProfile();

            TelescopeManager.SetTelescopeID(scopeSettings.TelescopeID);

            DomeSettings domeSettings = DomeSettings.FromProfile();

            DomeManager.SetDomeID(domeSettings.DomeID);
            Globals.DomeLayout                  = domeSettings.DomeLayout;
            Globals.DomeAzimuthAdjustment       = domeSettings.AzimuthAdjustment;
            Globals.UsePOTHDomeSlaveCalculation = domeSettings.UsePOTHDomeSlaveCalculation;
            Globals.FindDomeHomeAtStartup       = domeSettings.FindDomeHomeAtStartup;
            FocuserSettings focuserSettings = FocuserSettings.FromProfile();

            FocuserManager.SetFocuserID(focuserSettings.FocuserID);
            Globals.FocuserTemperatureOffset = focuserSettings.TemperatureOffset;
        }
コード例 #14
0
        public AscomTelescopeStatus(TelescopeManager mgr)
        {
            DeviceManager = mgr;

            Altitude = mgr.Altitude;
            AtHome   = mgr.AtHome;

            if (mgr.Parameters.InterfaceVersion > 1)
            {
                AtPark = mgr.AtPark;
            }
            else
            {
                AtPark = false;
            }

            Azimuth                 = mgr.Azimuth;
            Connected               = mgr.Connected;
            Declination             = mgr.Declination;
            DeclinationRate         = mgr.DeclinationRate;
            GuideRateDeclination    = mgr.GuideRateDeclination;
            GuideRateRightAscension = mgr.GuideRateRightAscension;
            IsPulseGuiding          = mgr.IsPulseGuiding;
            RightAscension          = mgr.RightAscension;
            RightAscensionRate      = mgr.RightAscensionRate;
            SideOfPier              = mgr.SideOfPier;
            SiderealTime            = mgr.SiderealTime;
            Slewing                 = mgr.Capabilities.CanSlew ? mgr.Slewing : false;
            TargetDeclination       = mgr.TargetDeclination;
            TargetRightAscension    = mgr.TargetRightAscension;
            Tracking                = mgr.Tracking;
            TrackingRate            = mgr.TrackingRate;

            try
            {
                UTCDate = mgr.UTCDate;
            }
            catch (Exception)
            {
                UTCDate = DateTime.Now.ToUniversalTime();
            }
        }
コード例 #15
0
        private void ChangeParkState()
        {
            ParkingStateEnum newState = (Status.ParkingState == ParkingStateEnum.Unparked) ? ParkingStateEnum.IsAtPark : ParkingStateEnum.Unparked;

            TelescopeManager.SetParkingState(newState);
        }
コード例 #16
0
		private void AbortDirectSlew()
		{
			TelescopeManager.AbortDirectSlew();
		}
コード例 #17
0
 private void ChangeTracking()
 {
     Status.Tracking = _isTracking;
     TelescopeManager.SetTracking(_isTracking);
 }
コード例 #18
0
 private void DoMeridianFlip()
 {
     TelescopeManager.StartMeridianFlip();
 }