Example #1
0
        private void UpdateVariables()
        {
            // 扫描模式
            SCAN_MODE mode = rbtnGalv.Checked ? SCAN_MODE.GALVANOMETER : SCAN_MODE.RESONANT;

            m_config.SetScanMode(mode);
            // 扫描策略
            SCAN_STRATEGY strategy = ((KeyValuePair <SCAN_STRATEGY, string>)cbxScanStrategy.SelectedItem).Key;

            m_config.SetScanStartegy(strategy);
            // 振镜系统
            SCAN_MIRROR_NUM mirrorNum = rbtnThree.Checked ? SCAN_MIRROR_NUM.THREEE : SCAN_MIRROR_NUM.TWO;

            m_config.SetScanMirrorNum(mirrorNum);
            // 采集模式 & 采集数量
            SCAN_ACQUISITION_MODE acquisitionMode = ((KeyValuePair <SCAN_ACQUISITION_MODE, string>)cbxAcquisitionMode.SelectedItem).Key;

            m_config.SetScanAcquisitionMode(acquisitionMode);
            // 采集模式数量
            int acquisitionModeNum = (int)cbxAcquisitionModeNum.SelectedItem;

            m_config.SetScanAcquisitionModeNum(acquisitionModeNum);
            // Dwell Time
            m_config.SetScanDwellTime(double.Parse(cbxDwellTime.SelectedItem.ToString()));
            // 扫描像素
            int scanPixels = ((KeyValuePair <int, string>)cbxScanPixels.SelectedItem).Key;

            m_config.SetScanXPoints(scanPixels);
            m_config.SetScanYPoints(scanPixels);
            // 激光[通道]开关状态
            LASER_CHAN_SWITCH status = chbx405.Checked ? LASER_CHAN_SWITCH.ON : LASER_CHAN_SWITCH.OFF;

            m_config.SetLaserSwitch(CHAN_ID.WAVELENGTH_405_NM, status);
            status = chbx488.Checked ? LASER_CHAN_SWITCH.ON : LASER_CHAN_SWITCH.OFF;
            m_config.SetLaserSwitch(CHAN_ID.WAVELENGTH_488_NM, status);
            status = chbx561.Checked ? LASER_CHAN_SWITCH.ON : LASER_CHAN_SWITCH.OFF;
            m_config.SetLaserSwitch(CHAN_ID.WAVELENGTH_561_NM, status);
            status = chbx640.Checked ? LASER_CHAN_SWITCH.ON : LASER_CHAN_SWITCH.OFF;
            m_config.SetLaserSwitch(CHAN_ID.WAVELENGTH_640_NM, status);

            m_params.Calculate();
        }
Example #2
0
        private void cbxAcquisitionMode_SelectedIndexChanged(object sender, EventArgs e)
        {
            SCAN_ACQUISITION_MODE acquisitionMode = ((KeyValuePair <SCAN_ACQUISITION_MODE, string>)cbxAcquisitionMode.SelectedItem).Key;

            if (m_config.GetScanAcquisitionMode() == acquisitionMode)
            {
                return;
            }

            this.Cursor = System.Windows.Forms.Cursors.WaitCursor;

            // if task is not running, just update config
            if (m_scheduler.TaskScanning() == false)
            {
                m_config.SetScanAcquisitionMode(acquisitionMode);
                m_scheduler.ConfigScanTask(m_scheduler.GetScanningTask());
                // UpdateControlers();

                this.Cursor = System.Windows.Forms.Cursors.Default;
                return;
            }

            // if task is already running, stop first
            m_scheduler.StopScanTask(m_scheduler.GetScanningTask());
            // update config
            m_config.SetScanAcquisitionMode(acquisitionMode);
            // create & start task
            m_scheduler.CreateScanTask(0, "实时扫描", out ScanTask scanTask);
            API_RETURN_CODE code = m_scheduler.StartScanTask(scanTask);

            // UpdateControlers();
            this.Cursor = System.Windows.Forms.Cursors.Default;

            if (code != API_RETURN_CODE.API_SUCCESS)
            {
                MessageBox.Show(string.Format("启动扫描任务失败,失败码: [0x{0}][{1}].", ((int)code).ToString("X"), code));
            }
        }
Example #3
0
 public API_RETURN_CODE SetScanAcquisitionMode(SCAN_ACQUISITION_MODE acquisitionMode)
 {
     Logger.Info(string.Format("set scan acquisition mode: [{0}].", acquisitionMode));
     m_scan.AcquisitionMode = acquisitionMode;
     return(API_RETURN_CODE.API_SUCCESS);
 }