diff --git a/source/FS/ATPControl_Serial_QT.cpp b/source/FS/ATPControl_Serial_QT.cpp index f2127c5..ce9bb17 100644 --- a/source/FS/ATPControl_Serial_QT.cpp +++ b/source/FS/ATPControl_Serial_QT.cpp @@ -72,6 +72,7 @@ int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumbe GetDeviceInfo(m_diDeviceInfo); GetExposureTime_Init(); + SetAvgTimes(1); std::string::size_type szPostion = m_diDeviceInfo.strSN.find(strDeviceName); if (szPostion == std::string::npos) @@ -255,6 +256,36 @@ int ZZ_ATPControl_Serial_Qt::SetDeviceTemperature(float fTemperature) return 0; } +int ZZ_ATPControl_Serial_Qt::SetAvgTimes(int iTimes /*= 1*/) +{ + QByteArray qbSend, qbRecv; + qbSend.clear(); + qbRecv.clear(); + qbSend.append(SET_AVERAGE_NUMBER); + qbSend.resize(3); + qbSend[1] = 0x00; + qbSend[2] = 0x01; + int iRes = SendCommand(qbSend); + if (iRes != 0) + { + qDebug() << "Err:SetAvgTimes Failed.Exit Code:1"; + return 1; + } + iRes = RecvData(qbRecv); + if (iRes != 0) + { + qDebug() << "Err:SetAvgTimes Failed.Exit Code:2"; + return 2; + } + iRes = ParseData(qbRecv); + if (iRes != 0) + { + qDebug() << "Err:SetAvgTimes Failed.Exit Code:3"; + return 3; + } + return 0; +} + int ZZ_ATPControl_Serial_Qt::GetExposureTime_Init() { QByteArray qbSend, qbRecv; diff --git a/source/FS/ATPControl_Serial_QT.h b/source/FS/ATPControl_Serial_QT.h index 7fa4fde..c6d91c8 100644 --- a/source/FS/ATPControl_Serial_QT.h +++ b/source/FS/ATPControl_Serial_QT.h @@ -62,6 +62,8 @@ public: //×Ô¶¯ÆØ¹â int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float &fPredictedExposureTime); +private: + int SetAvgTimes(int iTimes = 1); #ifdef _DEBUG public: