Ver código fonte

更新单点测试中的自动对焦等过程

@wang_qi0307 5 anos atrás
pai
commit
0b757f60bd

+ 9 - 2
HOZProject/FormUCMain.cs

@@ -38,6 +38,7 @@ namespace HOZProject
         public FormUCMain()
         {
             InitializeComponent();
+            Control.CheckForIllegalCrossThreadCalls = false;
         } 
         #endregion
 
@@ -790,8 +791,14 @@ namespace HOZProject
                 fShowImage.Content = "焦距:" + f_WD;
                 fShowImage.SetParaInfo();
                 fShowImage.Show();
-                float result = iSEM.GetAutoVideo();
-                if (result > 0)
+                //float result = iSEM.GetAutoFunction();
+                //if (result > 0)
+                //{
+                //    Thread threadImg = new Thread(new ThreadStart(GetAutoWDImage));
+                //    threadImg.Start();
+                //}
+                Boolean result = iSEM.CmdAutoFocusCoarse();
+                if(result)
                 {
                     Thread threadImg = new Thread(new ThreadStart(GetAutoWDImage));
                     threadImg.Start();

Diferenças do arquivo suprimidas por serem muito extensas
+ 434 - 467
HOZProject/FormUnitControl.Designer.cs


+ 82 - 0
HOZProject/FormUnitControl.cs

@@ -704,6 +704,16 @@ namespace HOZProject
         #region 自动对焦1
         private void btnAutoFocus1_Click(object sender, EventArgs e)
         {
+            //抓图1
+            iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
+            if (File.Exists(path + "\\test1.tif"))
+            {
+                FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
+                pictureBox1.Image = Image.FromStream(fileStream);
+                fileStream.Close();
+                fileStream.Dispose();
+            }
+            Thread.Sleep(1000);
             iSEM.CmdAutoFocusCoarse();
             btnAutoFocus1.BackColor = Color.Red;
             st_flag = 1;
@@ -719,6 +729,7 @@ namespace HOZProject
             float ret = 111;
             while(true)
             {
+                Thread.Sleep(1000);
                 ret = iSEM.GetAutoFunction();
                 if(ret==0)
                 {
@@ -752,6 +763,17 @@ namespace HOZProject
                     {
                         btnAutoStig.BackColor = Color.Lime;
                     }
+
+                    //抓图1
+                    iSEM.GrabImage(path + "\\test2.tif", 0, 0, 1024, 768, 0);
+                    if (File.Exists(path + "\\test2.tif"))
+                    {
+                        FileStream fileStream = new FileStream(path + "\\test2.tif", FileMode.Open, FileAccess.Read);
+                        pictureBox2.Image = Image.FromStream(fileStream);
+                        fileStream.Close();
+                        fileStream.Dispose();
+                    }
+
                     break;
                 }
             }
@@ -761,6 +783,16 @@ namespace HOZProject
         #region 自动对焦2
         private void btnAutoFocus2_Click(object sender, EventArgs e)
         {
+            //抓图1
+            iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
+            if (File.Exists(path + "\\test1.tif"))
+            {
+                FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
+                pictureBox1.Image = Image.FromStream(fileStream);
+                fileStream.Close();
+                fileStream.Dispose();
+            }
+            Thread.Sleep(1000);
             iSEM.CmdAutoFocusFine();
             btnAutoFocus2.BackColor = Color.Red;
             st_flag = 2;
@@ -773,6 +805,16 @@ namespace HOZProject
         #region 自动亮度、对比度
         private void btnAutoBrightness_Click(object sender, EventArgs e)
         {
+            //抓图1
+            iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
+            if (File.Exists(path + "\\test1.tif"))
+            {
+                FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
+                pictureBox1.Image = Image.FromStream(fileStream);
+                fileStream.Close();
+                fileStream.Dispose();
+            }
+            Thread.Sleep(1000);
             iSEM.SetAutoVideoBrightness();
             btnAutoBrightness.BackColor = Color.Red;
             st_flag = 3;
@@ -783,6 +825,16 @@ namespace HOZProject
 
         private void btnAutoContrast_Click(object sender, EventArgs e)
         {
+            //抓图1
+            iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
+            if (File.Exists(path + "\\test1.tif"))
+            {
+                FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
+                pictureBox1.Image = Image.FromStream(fileStream);
+                fileStream.Close();
+                fileStream.Dispose();
+            }
+            Thread.Sleep(1000);
             iSEM.SetAutoVideoBrightness();
             btnAutoContrast.BackColor = Color.Red;
             st_flag = 4;
@@ -793,6 +845,16 @@ namespace HOZProject
 
         private void btnAutoBC_Click(object sender, EventArgs e)
         {
+            //抓图1
+            iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
+            if (File.Exists(path + "\\test1.tif"))
+            {
+                FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
+                pictureBox1.Image = Image.FromStream(fileStream);
+                fileStream.Close();
+                fileStream.Dispose();
+            }
+            Thread.Sleep(1000);
             iSEM.SetAutoVideoBrightness();
             btnAutoBrightness.BackColor = Color.Red;
             btnAutoContrast.BackColor = Color.Red;
@@ -817,6 +879,16 @@ namespace HOZProject
         #region 自动消像散
         private void btnAutoStig_Click(object sender, EventArgs e)
         {
+            //抓图1
+            iSEM.GrabImage(path + "\\test1.tif", 0, 0, 1024, 768, 0);
+            if (File.Exists(path + "\\test1.tif"))
+            {
+                FileStream fileStream = new FileStream(path + "\\test1.tif", FileMode.Open, FileAccess.Read);
+                pictureBox1.Image = Image.FromStream(fileStream);
+                fileStream.Close();
+                fileStream.Dispose();
+            }
+            Thread.Sleep(1000);
             iSEM.CmdAutoStig();
             btnAutoStig.BackColor = Color.Red;
             st_flag = 7;
@@ -1064,5 +1136,15 @@ namespace HOZProject
             iSEM.CmdStageAbort();
         }
         #endregion
+
+        private void btnLive_Click(object sender, EventArgs e)
+        {
+            iSEM.ImageLive();
+        }
+
+        private void btnFrozen_Click(object sender, EventArgs e)
+        {
+            iSEM.ImageFrozen();
+        }
     }
 }

+ 2 - 0
SmartSEMControl/HardwareInterface.cs

@@ -100,6 +100,8 @@ namespace SmartSEMControl
 
         //抓图
         Boolean GrabImage(String filename, short xoff, short yoff, short width, short height, short type);
+        //读取图像冻结状态
+        float GetImageFrozen();
         //冻结
         Boolean ImageFrozen();
         //解冻

+ 12 - 0
SmartSEMControl/SmartSEM.cs

@@ -744,6 +744,18 @@ namespace SmartSEMControl
         #endregion
 
         #region 图像解冻
+        public float GetImageFrozen()
+        {
+            float ret = 0;
+            if (ReadParams(DP_FROZEN, ref ret))
+            {
+                return ret;
+            }
+            else
+            {
+                return float.NaN;
+            }
+        }
         public Boolean ImageFrozen()
         {
             return WriteDataParams(DP_FROZEN, (float)1); 

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff