public override void Closed()
        {
            base.Closed();
            PhidgetStepperBoard board = Interface as PhidgetStepperBoard;

            if (board != null)
            {
                board.Detach();
            }
        }
        private void SelectedGroupChanged(object sender, SelectionChangedEventArgs e)
        {
            PhidgetStepperBoard board   = Interface as PhidgetStepperBoard;
            PhidgetsStepper     stepper = board.Steppers[MotorListBox.SelectedIndex];

            CalibrationEditor.MaxOutput   = long.MaxValue;
            CalibrationEditor.MinOutput   = long.MinValue;
            CalibrationEditor.Calibration = stepper.Calibration;

            SelectedStepper = stepper;
        }
        protected override void OnInterfaceChanged(HeliosInterface oldInterface, HeliosInterface newInterface)
        {
            PhidgetStepperBoard oldBoard = oldInterface as PhidgetStepperBoard;

            if (oldBoard != null)
            {
                oldBoard.Detach();
            }

            PhidgetStepperBoard newBoard = newInterface as PhidgetStepperBoard;

            if (newBoard != null)
            {
                newBoard.Attach();
            }

            _motorList.Clear();
            for (int i = 0; i < newBoard.MotorCount; i++)
            {
                _motorList.Add("Motor " + i);
            }
        }
Пример #4
0
        public PhidgetsStepper(PhidgetStepperBoard stepperBoard, int motorNumber)
        {
            _motorNum     = motorNumber;
            _stepperBoard = stepperBoard;

            _zero          = new HeliosAction(stepperBoard, "Motor " + _motorNum.ToString(), "zero", "", "Sets the current position as zero.");
            _zero.Execute += Zero_Execute;

            _targetPosition          = new HeliosValue(stepperBoard, new BindingValue(0d), "Motor " + _motorNum.ToString(), "target position", "Sets the raw target position of this stepper.", "", BindingValueUnits.Numeric);
            _targetPosition.Execute += TargetPosition_Execute;

            _value          = new HeliosValue(stepperBoard, new BindingValue(0d), "Motor " + _motorNum.ToString(), "input value", "Sets the input value to be displayed on this stepper.", "Input value will be interpolated with the calibration data and set the target position for the stepper as appropriate.", BindingValueUnits.Numeric);
            _value.Execute += Value_Execute;

            _calibration = new CalibrationPointCollectionLong(-6000d, -376, 6000d, 376);
            _calibration.CalibrationChanged += new EventHandler(_calibration_CalibrationChanged);

            _increment          = new HeliosAction(stepperBoard, "Motor " + _motorNum.ToString(), "increment", "", "Increments the stepper position.", "Number of steps to increment steppers position. If empty or not a number 1 will be used.", BindingValueUnits.Numeric);
            _increment.Execute += IncrementPosition_Execute;

            _decrement          = new HeliosAction(stepperBoard, "Motor " + _motorNum.ToString(), "decrement", "", "Decrements the stepper position.", "Number of steps to decrement steppers position. If empty or not a number 1 will be used.", BindingValueUnits.Numeric);
            _decrement.Execute += DecrementPosition_Execute;
        }