Example #1
0
        private int GetStepSize(FocuserStepSize stepSize)
        {
            int step = 0;
            if (stepSize == FocuserStepSize.Large)
            {
                if (m_LargeStepSize == -1)
                    step = (int) m_MaxIncrement/10;
                else
                    step = m_LargeStepSize;
            }
            else if (stepSize == FocuserStepSize.Small)
            {
                if (m_SmallStepSize == -1)
                    step = (int)(m_MaxIncrement / (10 * LARGE_TO_SMALL_STEP_FACTOR));
                else
                    step = m_SmallStepSize;
            }
            else if (stepSize == FocuserStepSize.Smallest)
            {
                if (m_SmallestStepSize == -1)
                    step = (int)(m_MaxIncrement / (10 * SMALL_TO_SMALLEST_STEP_FACTOR));
                else
                    step = m_SmallestStepSize;
            }
            else
                throw new ArgumentOutOfRangeException();

            return step;
        }
Example #2
0
        public void FocuserMoveOut(FocuserStepSize stepSize, CallType callType = CallType.Async, Guid? clientId = null, CallbackAction callback = null, Control callbackUIControl = null)
        {
            IsolatedAction((x) =>
            {
                try
                {
                    if (m_ConnectedFocuser != null && m_ConnectedFocuser.Connected)
                    {
                        AssertFocuserEngagement(clientId);

                        m_ConnectedFocuser.MoveOut(x);

                        FocuserPosition position = m_ConnectedFocuser.GetCurrentPosition();

                        OnFocuserPosition(position);

                        return position;
                    }

                    return null;
                }
                catch (Exception ex)
                {
                    OnFocuserErrored();
                    Trace.WriteLine(ex.GetFullStackTrace());

                    return ex;
                }
            },
            stepSize, callType, callback, callbackUIControl);
        }
Example #3
0
        public void MoveOut(FocuserStepSize stepSize)
        {
            if (EnsureFocuserFeaturesKnown())
            {
                if (!m_IsAbsolute)
                {
                    int step = GetStepSize(stepSize);

                    m_IsolatedFocuser.Move(step);

                    m_CurrentPosition += step;
                }
                else
                {
                    // Absolute position focuser are currently not supported
                }
            }
        }