From 3f70544ad40df25c552398a80fd91f43221082bc Mon Sep 17 00:00:00 2001 From: zhangzhuo Date: Wed, 2 Mar 2022 13:26:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=9C=A8ATP=E7=B3=BB=E5=88=97=E8=B0=B1?= =?UTF-8?q?=E4=BB=AA=E7=9A=84=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=AD=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86SetAvgTimes=E5=87=BD=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E5=B0=86=E5=B9=B3=E5=9D=87=E9=87=87=E9=9B=86=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=BA1.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/FS/ATPControl_Serial_QT.cpp | 31 ++++++++++++++++++++++++++++++ source/FS/ATPControl_Serial_QT.h | 2 ++ 2 files changed, 33 insertions(+) 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: