1.修改了自动曝光

2.加成了Recv时间
This commit is contained in:
2022-02-28 18:05:52 +08:00
committed by xin
parent 1d309eeea6
commit c5cb63c1a9
2 changed files with 30 additions and 25 deletions

View File

@ -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;
}

View File

@ -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;