diff --git a/source/CaptureThread/AbstractFSController.cpp b/source/CaptureThread/AbstractFSController.cpp index 84e9ba8..78453f8 100644 --- a/source/CaptureThread/AbstractFSController.cpp +++ b/source/CaptureThread/AbstractFSController.cpp @@ -231,13 +231,37 @@ int CAbstractFSController::PerformAutoExposure() bIsLastValueOverflow = bIsValueOverflow; fLastExposureTime = fTempExposureTime; + + if (/*fExposureTime > 100 || */iExposureTime <= m_daDeviceAttr.iMinIntegrationTimeInMS) { bFlagIsAutoExposureOK = false; bFlagIsAutoExposureFailed = true; bFlagIsLowerMinExposureTime = true; - qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID; +// qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " << m_daDeviceAttr.iMinIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID; +// iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime); +// if (iRes != 0) +// { +// qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID; +// return 3; +// } +// else +// { +// qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID; +// } + + iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS); + if (iRes != 0) + { + qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID; + return 3; + } + else + { + qDebug() << "Warning:PerformAutoExposure lower than min integration time.Will be limited to " << m_daDeviceAttr.iMinIntegrationTimeInMS << "MS" << " Thread ID:" << m_iThreadID; + } + break; } @@ -256,21 +280,34 @@ int CAbstractFSController::PerformAutoExposure() //else //{ //qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to 30sec"; - qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS-1 << "MS" << " Thread ID:" << m_iThreadID; //} + + iRes = m_pFSCtrl->SetExposureTime(m_daDeviceAttr.iMaxIntegrationTimeInMS - 1); + if (iRes != 0) + { + qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3" << " Thread ID:" << m_iThreadID; + return 3; + } + else + { + qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS - 1 << "MS" << " Thread ID:" << m_iThreadID; + } + break; } + + iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime); + if (iRes != 0) + { + qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID; + return 3; + } + else + { + qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID; + } } - iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime); - if (iRes != 0) - { - qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4" << " Thread ID:" << m_iThreadID; - return 3; - } - else - { - qDebug() << "Success:PerformAutoExposure. Value" << iExposureTime << " Thread ID:" << m_iThreadID; - } + fPredictedExposureTime = iExposureTime; qDebug() << "--------------------------Stop PerformAutoExposure" << " Thread ID:" << m_iThreadID; //emit SignalAcqFinished(m_iThreadID, 1);