|
|
@@ -25,7 +25,7 @@ namespace OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow
|
|
|
|
|
|
protected CMeasure m_pMsrThread;
|
|
|
|
|
|
- double curbrightness = 0, curcontrast = 0;
|
|
|
+ private bool brightnessContrastAdjustRuning = false;
|
|
|
|
|
|
protected ISemController m_SemHardwareMgr;
|
|
|
protected IScanController m_ScanHardwareMgr;
|
|
|
@@ -180,6 +180,10 @@ namespace OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
+ public void StopBrightnessContrastAdjust()
|
|
|
+ {
|
|
|
+ brightnessContrastAdjustRuning = false;
|
|
|
+ }
|
|
|
public void DoBrightnessContrastAdjust()
|
|
|
{
|
|
|
using (AutoResetSEMControl autoReset = new AutoResetSEMControl(this))
|
|
|
@@ -253,6 +257,7 @@ namespace OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow
|
|
|
var desirebright = m_BrightnessContrastRegulateParam.brightphaseGrayvalue;
|
|
|
|
|
|
SortedDictionary<double, SEMStateObject> BCstatedic =new SortedDictionary<double, SEMStateObject>();
|
|
|
+ brightnessContrastAdjustRuning = true;
|
|
|
bool finishcondition = Math.Abs(dark - desiredark) < 1 && Math.Abs(bright - desirebright) < 1;
|
|
|
while (!finishcondition)
|
|
|
{
|
|
|
@@ -278,18 +283,32 @@ namespace OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow
|
|
|
BCstatedic.Add(varerror, BcsemState);
|
|
|
}
|
|
|
//time out check
|
|
|
- if ((DateTime.Now-starttime).TotalSeconds>60)
|
|
|
+ if ((DateTime.Now-starttime).TotalSeconds>100)
|
|
|
{
|
|
|
log.Warn("Auto BC time out, stop the auto BC!");
|
|
|
+ if (BCstatedic.Count > 0)
|
|
|
+ {
|
|
|
+ var minerror = BCstatedic.Keys.Min();
|
|
|
+ var minstate = BCstatedic[minerror];
|
|
|
+ m_SemHardwareMgr.SetSemBrightness(minstate.brightness);
|
|
|
+ m_SemHardwareMgr.SetSemContrast(minstate.contrast);
|
|
|
+ log.Warn("Auto BC set brightness and contrast to:" + minstate.brightness + " " + minstate.contrast);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ // external stop check
|
|
|
+ if (brightnessContrastAdjustRuning==false)
|
|
|
+ {
|
|
|
+ log.Warn("stop the auto BC!");
|
|
|
|
|
|
- break;
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
// check bse image
|
|
|
- pBSEIamge = m_ScanHardwareMgr.AcquireBSEImage();
|
|
|
+ pBSEIamge = m_ScanHardwareMgr.AcquireBSEImage();
|
|
|
|
|
|
if (pBSEIamge == null)
|
|
|
{
|
|
|
@@ -299,15 +318,7 @@ namespace OTSMeasureApp._1_OTSMeasure.Measure._3_MeasureFlow
|
|
|
ProcessBSEImageToGetTheTwoGrayValue(pBSEIamge, ref bright, ref dark);
|
|
|
log.Info("two gray:" + bright.ToString() + " " + dark.ToString());
|
|
|
finishcondition = Math.Abs(dark - desiredark) < 1 && Math.Abs(bright - desirebright) < 1;
|
|
|
- }
|
|
|
- if (BCstatedic.Count > 0)
|
|
|
- {
|
|
|
- var minerror = BCstatedic.Keys.Min();
|
|
|
- var minstate = BCstatedic[minerror];
|
|
|
- m_SemHardwareMgr.SetSemBrightness(minstate.brightness);
|
|
|
- m_SemHardwareMgr.SetSemContrast(minstate.contrast);
|
|
|
- log.Warn("Auto BC set brightness and contrast to:" + minstate.brightness + " " + minstate.contrast);
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
m_SemHardwareMgr.GetSemContrast(ref m_BrightnessContrastRegulateParam.initialContrast);
|
|
|
m_SemHardwareMgr.GetSemBrightness(ref m_BrightnessContrastRegulateParam.initialBrightness);
|