示例#1
0
        /// <summary>
        /// Change focus calibration offset
        /// </summary>
        private void editFocusOffset_ValueChanged(object sender, EventArgs e)
        {
            double input = this.controller.GetReading(this.stage);

            //double pow = this.controller.GetFocalPower(this.stage);
            if (this.stage == RCCMStage.RCCM1)
            {
                double pow = NFOVLensController.PwlInterp(this.controller.NFOV1Calibration, input);
                this.controller.FocusOffset1 = (double)editFocusOffset.Value;
                this.controller.SetFocalPower(pow + this.controller.FocusOffset1, RCCMStage.RCCM1);
            }
            else
            {
                double pow = NFOVLensController.PwlInterp(this.controller.NFOV2Calibration, input);
                this.controller.FocusOffset2 = (double)editFocusOffset.Value;
                this.controller.SetFocalPower(pow + this.controller.FocusOffset2, RCCMStage.RCCM2);
            }
        }
示例#2
0
        /// <summary>
        /// Create a calibration UI form for the specified stage. Saves changes to specified settings object
        /// </summary>
        /// <param name="controller">NFOV lens controller</param>
        /// <param name="stage">Parent stage of NFOV camera to be adjusted</param>
        public LensCalibrationForm(RCCMSystem rccm, RCCMStage stage)
        {
            InitializeComponent();

            this.rccm       = rccm;
            this.controller = this.rccm.LensController;
            this.stage      = stage;

            this.oldCalibration = stage == RCCMStage.RCCM1 ? this.controller.NFOV1Calibration : this.controller.NFOV2Calibration;
            this.calibration    = new SortedList <double, CalibrationPoint>();
            if (this.oldCalibration != null)
            {
                for (int i = 0; i < this.oldCalibration.GetLength(0); i++)
                {
                    this.calibration.Add(this.oldCalibration[i, 0],
                                         new CalibrationPoint(this.oldCalibration[i, 0], this.oldCalibration[i, 1]));
                }
            }

            // Set text box values
            Motor zMotor = this.stage == RCCMStage.RCCM1 ? this.rccm.motors["fine 1 Z"] : this.rccm.motors["fine 2 Z"];

            this.heightEdit.Value     = (decimal)zMotor.GetPos();
            this.focalPowerEdit.Value = (decimal)this.controller.GetFocalPower(this.stage);
            if (this.stage == RCCMStage.RCCM1)
            {
                this.editFocusOffset.Value = (decimal)this.controller.FocusOffset1;
            }
            else
            {
                this.editFocusOffset.Value = (decimal)this.controller.FocusOffset2;
            }
            this.updateListView();

            this.controller.PauseFocusing(this.stage);
        }