Browse Source

adjust oxford driver

gsp 4 months ago
parent
commit
438c6801ec

+ 1 - 1
OTSIncAMeasureApp/ServiceCenter/OxfordExtender/OxfordSemController.cs

@@ -89,7 +89,7 @@ namespace OTSMeasureApp.ServiceCenter
         public bool GetSemHighTension(ref double a_dKV)
         {
          
-            a_dKV = iExtender.GetSEMVoltage() / 1000;
+            a_dKV = iExtender.GetSEMVoltage() ;
             return true;
         }
 

+ 45 - 9
OxfordExtenderWrapper/ExtenderWrapper.cs

@@ -277,15 +277,15 @@ namespace OxfordExtenderWrapper
 
         private bool m_bXrayDone = false;
         //电压
-        private double m_dHighVoltage;
+        private double m_dHighVoltage=0;
         //放大倍数
-        private double m_dMagnification;
+        private double m_dMagnification=0;
         //工作距离
-        private double m_dWorkingDistance;
+        private double m_dWorkingDistance=0;
         //亮度
-        private double m_dBirghtness;
+        private double m_dBirghtness=0;
         //对比度
-        private double m_dContrast;
+        private double m_dContrast = 0;
         //BeamOn
         private bool m_bBeamOn;
         //FilamentOn
@@ -1020,6 +1020,8 @@ namespace OxfordExtenderWrapper
         //镜筒控制连接或断开时的事件
         private void OnMicroscopeColumnConnected(object sender, EventArgs e)
         {
+
+
             ReadMicroscopeColumn();
         }
 
@@ -1063,14 +1065,23 @@ namespace OxfordExtenderWrapper
             ReadStage();
         }
 
-
+        bool ifMagRead=false;
         public float GetMagnification()
         {
             ReadMicroscopeColumn();
+
+            if (m_dMagnification != 0)
+            {
+                ifMagRead=true;
+            }
             return (float)m_dMagnification;
         }
         public Boolean SetMagnification(float set)
         {
+            if (!ifMagRead)
+            {
+               return false;
+            }
             Dictionary<Column, double> columnDictionary = new Dictionary<Column, double>
             {
                 { Column.Magnification, (double)set }
@@ -1094,15 +1105,23 @@ namespace OxfordExtenderWrapper
             }
             return true;
         }
-
+        bool ifwdread = false;
         //焦距
         public float GetWorkingDistance()
         {
             ReadMicroscopeColumn();
+            if (m_dWorkingDistance != 0)
+            {
+                bool ifwdread = true;
+            }
             return (float)m_dWorkingDistance;
         }
         public Boolean SetWorkingDistance(float set)
         {
+            if (!ifwdread)
+            {
+                return false;
+            }
             Dictionary<Column, double> columnDictionary = new Dictionary<Column, double>
             {
                 { Column.WorkingDistance, (double)set }
@@ -1125,15 +1144,23 @@ namespace OxfordExtenderWrapper
             }
             return true;
         }
-
+        bool ifBrightnessRead = false;
         //亮度
         public float GetBrightness()
         {
             ReadMicroscopeColumn();
+            if (m_dBirghtness != 0)
+            {
+                ifBrightnessRead = true;
+            }
             return (float)m_dBirghtness;
         }
         public Boolean SetBrightness(float set)
         {
+            if (!ifBrightnessRead)
+            {
+                return false;
+            }
             Dictionary<Column, double> columnDictionary = new Dictionary<Column, double>
             {
                 { Column.Brightness, (double)set }
@@ -1157,15 +1184,23 @@ namespace OxfordExtenderWrapper
             }
             return true;
         }
-
+        bool ifContrastRead = false;
         //对比度
         public float GetContrast()
         {
             ReadMicroscopeColumn();
+            if (m_dContrast != 0)
+            {
+                ifContrastRead = true;
+            }
             return (float)m_dContrast;
         }
         public Boolean SetContrast(float set)
         {
+            if (!ifContrastRead)
+            {
+                return false;
+            }
             Dictionary<Column, double> columnDictionary = new Dictionary<Column, double>
             {
                 { Column.Contrast, (double)set }
@@ -1195,6 +1230,7 @@ namespace OxfordExtenderWrapper
         public float GetSEMVoltage()
         {
             ReadMicroscopeColumn();
+            log.Warn(m_dHighVoltage);
             return (float)m_dHighVoltage;
         }
         public Boolean SetSEMVoltage(float set)