From c5cb63c1a94e6c3384bb094dbb1ee1e7960ddf64 Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Mon, 28 Feb 2022 18:05:52 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E4=BA=86=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=9D=E5=85=89=202.=E5=8A=A0=E6=88=90=E4=BA=86Recv=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/CaptureThread/AbstractFSController.cpp | 45 ++++++++++--------- source/FS/ATPControl_Serial_QT.cpp | 10 ++--- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/source/CaptureThread/AbstractFSController.cpp b/source/CaptureThread/AbstractFSController.cpp index 8496078..a16978e 100644 --- a/source/CaptureThread/AbstractFSController.cpp +++ b/source/CaptureThread/AbstractFSController.cpp @@ -181,7 +181,7 @@ int CAbstractFSController::PerformAutoExposure() } double dTemp = dSum / iCount; - qDebug() << "Avg " << dTemp; + qDebug() << "Avg " << dTemp << " Thread ID:" << m_iThreadID; if (dTemp >= iDeviceDepth * 0.99) { @@ -226,33 +226,38 @@ int CAbstractFSController::PerformAutoExposure() dFactor = dTemp / (iDeviceDepth * m_fsInfo.fMaxFactor); iExposureTime = (float)(iExposureTime / dFactor); } - if (/*fExposureTime > 100 || */iExposureTime < m_daDeviceAttr.iMinIntegrationTimeInMS) - { - bFlagIsAutoExposureOK = false; - bFlagIsAutoExposureFailed = true; - bFlagIsLowerMinExposureTime = true; - } + } bIsLastValueOverflow = bIsValueOverflow; fLastExposureTime = fTempExposureTime; - if (iExposureTime > m_daDeviceAttr.iMaxIntegrationTimeInMS - 1) + 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; + break; + } + + if (iExposureTime > m_daDeviceAttr.iMaxIntegrationTimeInMS-1) { bFlagIsAutoExposureOK = false; bFlagIsAutoExposureFailed = true; - float fPredictedExposureTime = m_daDeviceAttr.iMaxIntegrationTimeInMS-1; - 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 30sec"; - qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS-1 << "MS" << " Thread ID:" << m_iThreadID; - } bFlagIsOverMaxExposureTime = true; + //float fPredictedExposureTime = m_daDeviceAttr.iMaxIntegrationTimeInMS-1; + //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 30sec"; + qDebug() << "Warning:PerformAutoExposure exceed max integration time.Will be limited to " << m_daDeviceAttr.iMaxIntegrationTimeInMS-1 << "MS" << " Thread ID:" << m_iThreadID; + //} break; } diff --git a/source/FS/ATPControl_Serial_QT.cpp b/source/FS/ATPControl_Serial_QT.cpp index 1cf3cf2..b75ff5b 100644 --- a/source/FS/ATPControl_Serial_QT.cpp +++ b/source/FS/ATPControl_Serial_QT.cpp @@ -324,7 +324,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData) int iCounter = 0; while (qbData.size() < 4) { - m_pSerialPort->waitForReadyRead(1000); + m_pSerialPort->waitForReadyRead(5000); QByteArray qbTemp = m_pSerialPort->readAll(); qbData.append(qbTemp); @@ -394,7 +394,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData) if (iCounter > 6) { - qDebug() << "Err:RecvData Failed,Not Enough Data.Exit Code:1" << qbData.size(); + qDebug() << "Err:RecvData_ShortLag Failed,Not Enough Data.Exit Code:1" << qbData.size(); return 1; } iCounter++; @@ -402,7 +402,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData) if ((ZZ_U8)qbData[0] != (ZZ_U8)0xaa || (ZZ_U8)qbData[1] != (ZZ_U8)0x55) { - qDebug() << "Err:RecvData Failed,Wrong Header.Exit Code:2" << qbData.size(); + qDebug() << "Err:RecvData_ShortLag Failed,Wrong Header.Exit Code:2" << qbData.size(); return 2; } @@ -415,7 +415,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData) if (iCounter > 6) { - qDebug() << "Err:RecvData Failed,Incomplete Data.Exit Code:3" << qbData.size(); + qDebug() << "Err:RecvData_ShortLag Failed,Incomplete Data.Exit Code:3" << qbData.size(); return 3; } iCounter++; @@ -435,7 +435,7 @@ int ZZ_ATPControl_Serial_Qt::RecvData_ShortLag(QByteArray &qbData) ZZ_U8 ucTemp = qbData[qbData.size() - 1]; if ((ZZ_U8)usCheckSum != ucTemp) { - qDebug() << "Err:RecvData Failed,Incorrect Check Sum.Exit Code:4" << "Total Recv:" << qbData.size() << "Check Sum:" << usCheckSum << "Not Equal To" << ucTemp; + qDebug() << "Err:RecvData_ShortLag Failed,Incorrect Check Sum.Exit Code:4" << "Total Recv:" << qbData.size() << "Check Sum:" << usCheckSum << "Not Equal To" << ucTemp; //qbData.clear(); //return 4; return 0;