mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 03:49:42 +08:00
Merge remote-tracking branch 'origin/TC' into renlixin
This commit is contained in:
@ -1,11 +1,12 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
//ATP?<EFBFBD><EFBFBD>?<EFBFBD><EFBFBD><EFBFBD><EFBFBD>??????<3F><>???<EFBFBD><EFBFBD>
|
//ATP<54><50><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
#pragma once
|
#pragma once
|
||||||
//#include "pch.h"
|
//#include "pch.h"
|
||||||
#include "ZZ_Types.h"
|
#include "ZZ_Types.h"
|
||||||
#include "ZZ_Math.h"
|
#include "ZZ_Math.h"
|
||||||
#include <QSerialPort>
|
#include <QSerialPort>
|
||||||
|
#include <QtEndian>
|
||||||
#include "IrisFiberSpectrometerBase.h"
|
#include "IrisFiberSpectrometerBase.h"
|
||||||
|
|
||||||
using namespace ZZ_MISCDEF;
|
using namespace ZZ_MISCDEF;
|
||||||
@ -14,53 +15,55 @@ using namespace ZZ_MISCDEF::IRIS::FS;
|
|||||||
|
|
||||||
class ZZ_ATPControl_Serial_Qt :public CIrisFSBase
|
class ZZ_ATPControl_Serial_Qt :public CIrisFSBase
|
||||||
{
|
{
|
||||||
//Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ZZ_ATPControl_Serial_Qt();
|
ZZ_ATPControl_Serial_Qt(QObject* parent = nullptr);
|
||||||
virtual ~ZZ_ATPControl_Serial_Qt();
|
virtual ~ZZ_ATPControl_Serial_Qt();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//?<3F><>???<3F><>????
|
//do not call
|
||||||
|
//int ReInit();
|
||||||
|
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD>
|
||||||
//int SetBaudRate(int iBaud);
|
//int SetBaudRate(int iBaud);
|
||||||
//???????<EFBFBD><EFBFBD><EFBFBD><EFBFBD>?
|
//<2F><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>豸
|
||||||
int Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName);
|
int Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName);
|
||||||
int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName);
|
|
||||||
//??<3F><>??<3F><><EFBFBD><EFBFBD>?
|
//<EFBFBD>ر<EFBFBD><EFBFBD>豸
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
//???????????? ?????<3F><>???<3F><><EFBFBD><EFBFBD>???????
|
//<EFBFBD><EFBFBD><EFBFBD>β<EFBFBD><EFBFBD>Բɼ<EFBFBD> <20><><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int SingleShot(int& iPixels);
|
int SingleShot(int& iPixels);
|
||||||
|
|
||||||
//????????????
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<EFBFBD>
|
||||||
int SingleShot(DataFrame& dfData);
|
int SingleShot(DataFrame& dfData);
|
||||||
|
|
||||||
//????<EFBFBD><EFBFBD>?<EFBFBD><EFBFBD>??<3F><>????
|
//<EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>
|
||||||
//int SingleShotDark(ATPDataFrame &dfData);
|
//int SingleShotDark(ATPDataFrame &dfData);
|
||||||
|
|
||||||
//int SingleShotDeducted(ATPDataFrame &dfData);
|
//int SingleShotDeducted(ATPDataFrame &dfData);
|
||||||
//?<EFBFBD><EFBFBD>???????<3F><>??
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
||||||
int SetExposureTime(int iExposureTimeInMS);
|
int SetExposureTime(int iExposureTimeInMS);
|
||||||
|
|
||||||
//?????????<3F><>???<3F><>??
|
//<EFBFBD><EFBFBD>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int GetExposureTime(int& iExposureTimeInMS);
|
int GetExposureTime(int& iExposureTimeInMS);
|
||||||
|
|
||||||
//int GetWaveLength(float *pfWaveLength);
|
//int GetWaveLength(float *pfWaveLength);
|
||||||
|
|
||||||
//?????<3F><><EFBFBD><EFBFBD>?????
|
//<EFBFBD><EFBFBD>ȡ<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
||||||
int GetDeviceInfo(DeviceInfo& Info);
|
int GetDeviceInfo(DeviceInfo& Info);
|
||||||
|
|
||||||
//?????<3F><><EFBFBD><EFBFBD>????<3F><>????
|
//<EFBFBD><EFBFBD>ȡ<EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int GetDeviceAttribute(DeviceAttribute& Attr);
|
int GetDeviceAttribute(DeviceAttribute& Attr);
|
||||||
|
|
||||||
//int GetDeviceListInfo(); //use type name to enum
|
//int GetDeviceListInfo(); //use type name to enum
|
||||||
|
|
||||||
//?<EFBFBD><EFBFBD>??????
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
||||||
int SetDeviceTemperature(float fTemperature);
|
int SetDeviceTemperature(float fTemperature);
|
||||||
|
|
||||||
//????????
|
//<EFBFBD><EFBFBD>ȡ<EFBFBD>¶<EFBFBD>
|
||||||
int GetDeviceTemperature(float& fTemperature);
|
int GetDeviceTemperature(float& fTemperature);
|
||||||
|
|
||||||
//<2F><>???????
|
//<2F>Զ<EFBFBD><EFBFBD>ع<EFBFBD>
|
||||||
int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float& fPredictedExposureTime);
|
int PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float& fPredictedExposureTime);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
@ -76,12 +79,19 @@ private:
|
|||||||
DeviceInfo m_diDeviceInfo;
|
DeviceInfo m_diDeviceInfo;
|
||||||
DeviceAttribute m_daDeviceAttr;
|
DeviceAttribute m_daDeviceAttr;
|
||||||
|
|
||||||
|
//Attr
|
||||||
|
int m_iExposureTime;
|
||||||
//////////////////////////////////////////////////////////////////////////shutter control stub code s
|
//////////////////////////////////////////////////////////////////////////shutter control stub code s
|
||||||
//int SetExtShutter(int iShutterUP0, int iShutterDOWN1,int iShutterDOWN2,int iShutterDOWN3); //0:close 1:open
|
//int SetExtShutter(int iShutterUP0, int iShutterDOWN1,int iShutterDOWN2,int iShutterDOWN3); //0:close 1:open
|
||||||
//////////////////////////////////////////////////////////////////////////shutter control stub code e
|
//////////////////////////////////////////////////////////////////////////shutter control stub code e
|
||||||
|
int GetExposureTime_Init();
|
||||||
int SendCommand(QByteArray qbCommand);
|
int SendCommand(QByteArray qbCommand);
|
||||||
int RecvData(QByteArray& qbData);
|
int RecvData(QByteArray& qbData);
|
||||||
int ParseData(QByteArray& qbData);
|
int ParseData(QByteArray& qbData);
|
||||||
|
public slots:
|
||||||
|
int Init_Self();
|
||||||
|
signals:
|
||||||
|
void SignalInit_Self();
|
||||||
//private slots :
|
//private slots :
|
||||||
//void ReadMessage();
|
//void ReadMessage();
|
||||||
};
|
};
|
@ -1,10 +1,11 @@
|
|||||||
|
#include "QObject"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "ZZ_Types.h"
|
#include "ZZ_Types.h"
|
||||||
#pragma once
|
#pragma once
|
||||||
using namespace ZZ_MISCDEF;
|
using namespace ZZ_MISCDEF;
|
||||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||||
|
|
||||||
class CIrisFSBase
|
class CIrisFSBase:public QObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//CIrisFSBase();
|
//CIrisFSBase();
|
||||||
|
@ -3,12 +3,11 @@
|
|||||||
//#include "ZZ_Math_HDRONLY.h"
|
//#include "ZZ_Math_HDRONLY.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
ZZ_ATPControl_Serial_Qt::ZZ_ATPControl_Serial_Qt(QObject* parent /*= nullptr*/)
|
||||||
ZZ_ATPControl_Serial_Qt::ZZ_ATPControl_Serial_Qt()
|
|
||||||
{
|
{
|
||||||
m_pSerialPort = new QSerialPort;
|
m_pSerialPort = new QSerialPort;
|
||||||
//connect(m_pSerialPort, &QSerialPort::readyRead, this, &ZZ_ATPControl_Serial_Qt::ReadMessage);
|
|
||||||
m_iBaudRate = 115200;
|
m_iBaudRate = 115200;
|
||||||
|
//emit SignalInit_Self();
|
||||||
}
|
}
|
||||||
|
|
||||||
ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
||||||
@ -20,6 +19,19 @@ ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int ZZ_ATPControl_Serial_Qt::ReInit()
|
||||||
|
// {
|
||||||
|
// m_pSerialPort->close();
|
||||||
|
// delete m_pSerialPort;
|
||||||
|
//
|
||||||
|
// m_pSerialPort = new QSerialPort;
|
||||||
|
//
|
||||||
|
// m_pSerialPort->setPortName("COM7");
|
||||||
|
// m_pSerialPort->setReadBufferSize(512);
|
||||||
|
// bool bRes = m_pSerialPort->setBaudRate(m_iBaudRate);
|
||||||
|
// bRes = m_pSerialPort->open(QIODevice::ReadWrite);
|
||||||
|
// }
|
||||||
|
|
||||||
// int ZZ_ATPControl_Serial_Qt::SetBaudRate(int iBaud)
|
// int ZZ_ATPControl_Serial_Qt::SetBaudRate(int iBaud)
|
||||||
// {
|
// {
|
||||||
// m_iBaudRate = iBaud;
|
// m_iBaudRate = iBaud;
|
||||||
@ -29,6 +41,9 @@ ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
|||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName)
|
int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumber, std::string strDeviceName)
|
||||||
{
|
{
|
||||||
|
//connect(this, &ZZ_ATPControl_Serial_Qt::SignalInit_Self, this, &ZZ_ATPControl_Serial_Qt::Init_Self);
|
||||||
|
//emit SignalInit_Self();
|
||||||
|
|
||||||
QString qstrPortName = QString::fromStdString(ucPortNumber);
|
QString qstrPortName = QString::fromStdString(ucPortNumber);
|
||||||
|
|
||||||
m_pSerialPort->setPortName(qstrPortName);
|
m_pSerialPort->setPortName(qstrPortName);
|
||||||
@ -49,6 +64,26 @@ int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, std::string ucPortNumbe
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// int testi;
|
||||||
|
// GetDeviceAttribute(m_daDeviceAttr);
|
||||||
|
// GetExposureTime(testi);
|
||||||
|
// SetExposureTime(10000);
|
||||||
|
// DataFrame test;
|
||||||
|
// SingleShot(test);
|
||||||
|
|
||||||
|
GetDeviceInfo(m_diDeviceInfo);
|
||||||
|
GetExposureTime_Init();
|
||||||
|
|
||||||
|
std::string::size_type szPostion = m_diDeviceInfo.strSN.find(strDeviceName);
|
||||||
|
if (szPostion == std::string::npos)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:FS serial number not match.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +91,6 @@ void ZZ_ATPControl_Serial_Qt::Close()
|
|||||||
{
|
{
|
||||||
m_pSerialPort->close();
|
m_pSerialPort->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::GetDeviceInfo(DeviceInfo& Info)
|
int ZZ_ATPControl_Serial_Qt::GetDeviceInfo(DeviceInfo& Info)
|
||||||
{
|
{
|
||||||
QByteArray qbSend, qbRecv;
|
QByteArray qbSend, qbRecv;
|
||||||
@ -218,6 +252,38 @@ int ZZ_ATPControl_Serial_Qt::SetDeviceTemperature(float fTemperature)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::GetExposureTime_Init()
|
||||||
|
{
|
||||||
|
QByteArray qbSend, qbRecv;
|
||||||
|
qbSend.clear();
|
||||||
|
qbRecv.clear();
|
||||||
|
qbSend.append(GET_INTEGRATION_TIME);
|
||||||
|
qbSend.resize(3);
|
||||||
|
qbSend[1] = 0x00;
|
||||||
|
qbSend[2] = 0x01;
|
||||||
|
int iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetExposureTime Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetExposureTime Failed.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetExposureTime Failed.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_iExposureTime = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::SendCommand(QByteArray qbCommand)
|
int ZZ_ATPControl_Serial_Qt::SendCommand(QByteArray qbCommand)
|
||||||
{
|
{
|
||||||
int iSize = qbCommand.size() + 3;
|
int iSize = qbCommand.size() + 3;
|
||||||
@ -255,11 +321,11 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
|||||||
int iCounter = 0;
|
int iCounter = 0;
|
||||||
while (qbData.size() < 4)
|
while (qbData.size() < 4)
|
||||||
{
|
{
|
||||||
m_pSerialPort->waitForReadyRead(5000);
|
m_pSerialPort->waitForReadyRead(1000);
|
||||||
QByteArray qbTemp = m_pSerialPort->readAll();
|
QByteArray qbTemp = m_pSerialPort->readAll();
|
||||||
qbData.append(qbTemp);
|
qbData.append(qbTemp);
|
||||||
|
|
||||||
if (iCounter > 20)
|
if (iCounter > 150)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:RecvData Failed,Not Enough Data.Exit Code:1" << qbData.size();
|
qDebug() << "Err:RecvData Failed,Not Enough Data.Exit Code:1" << qbData.size();
|
||||||
return 1;
|
return 1;
|
||||||
@ -267,7 +333,6 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
|||||||
iCounter++;
|
iCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
if ((ZZ_U8)qbData[0] != (ZZ_U8)0xaa || (ZZ_U8)qbData[1] != (ZZ_U8)0x55)
|
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 Failed,Wrong Header.Exit Code:2" << qbData.size();
|
||||||
@ -278,10 +343,10 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
|||||||
int iLength = qbData[2] * 256 + qbData[3] + 2;
|
int iLength = qbData[2] * 256 + qbData[3] + 2;
|
||||||
while (qbData.size() < iLength)
|
while (qbData.size() < iLength)
|
||||||
{
|
{
|
||||||
m_pSerialPort->waitForReadyRead(50);
|
m_pSerialPort->waitForReadyRead(5000);
|
||||||
qbData.append(m_pSerialPort->readAll());
|
qbData.append(m_pSerialPort->readAll());
|
||||||
|
|
||||||
if (iCounter > 100)
|
if (iCounter > 200)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:RecvData Failed,Incomplete Data.Exit Code:3" << qbData.size();
|
qDebug() << "Err:RecvData Failed,Incomplete Data.Exit Code:3" << qbData.size();
|
||||||
return 3;
|
return 3;
|
||||||
@ -303,9 +368,10 @@ int ZZ_ATPControl_Serial_Qt::RecvData(QByteArray &qbData)
|
|||||||
ZZ_U8 ucTemp = qbData[qbData.size() - 1];
|
ZZ_U8 ucTemp = qbData[qbData.size() - 1];
|
||||||
if ((ZZ_U8)usCheckSum != ucTemp)
|
if ((ZZ_U8)usCheckSum != ucTemp)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:RecvData Failed,Incorrect Check Sum.Exit Code:4" << qbData.size();
|
qDebug() << "Err:RecvData Failed,Incorrect Check Sum.Exit Code:4" << "Total Recv:" << qbData.size() << "Check Sum:" << usCheckSum << "Not Equal To" << ucTemp;
|
||||||
qbData.clear();
|
//qbData.clear();
|
||||||
return 4;
|
//return 4;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -323,6 +389,12 @@ int ZZ_ATPControl_Serial_Qt::ParseData(QByteArray &qbData)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZZ_ATPControl_Serial_Qt::Init_Self()
|
||||||
|
{
|
||||||
|
m_pSerialPort = new QSerialPort;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float& fPredictedExposureTime)
|
int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fMaxScaleFactor, float& fPredictedExposureTime)
|
||||||
{
|
{
|
||||||
using namespace ZZ_MATH;
|
using namespace ZZ_MATH;
|
||||||
@ -468,15 +540,33 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
|||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
||||||
{
|
{
|
||||||
|
m_iExposureTime = iExposureTimeInMS;
|
||||||
|
|
||||||
QByteArray qbExposureTime, qbRecv;
|
QByteArray qbExposureTime, qbRecv;
|
||||||
qbExposureTime.append(SET_INTEGRATION_TIME);
|
//qbExposureTime.append(SET_INTEGRATION_TIME);
|
||||||
qbExposureTime.resize(3);
|
qbExposureTime.resize(3);
|
||||||
|
qbExposureTime[0] = SET_INTEGRATION_TIME;
|
||||||
qbExposureTime[1] = iExposureTimeInMS >> 8;
|
qbExposureTime[1] = iExposureTimeInMS >> 8;
|
||||||
qbExposureTime[2] = iExposureTimeInMS & 0xFF;
|
qbExposureTime[2] = iExposureTimeInMS & 0xFF;
|
||||||
|
|
||||||
SendCommand(qbExposureTime);
|
int iRes = SendCommand(qbExposureTime);
|
||||||
RecvData(qbRecv);
|
if (iRes != 0)
|
||||||
ParseData(qbRecv);
|
{
|
||||||
|
qDebug() << "Err:SetExposureTime Failed.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SetExposureTime Failed.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SetExposureTime Failed.Exit Code:4";
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ZZ_U8)qbRecv[0] != 0)
|
if ((ZZ_U8)qbRecv[0] != 0)
|
||||||
{
|
{
|
||||||
@ -489,16 +579,34 @@ int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
|||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::GetExposureTime(int& iExposureTimeInMS)
|
int ZZ_ATPControl_Serial_Qt::GetExposureTime(int& iExposureTimeInMS)
|
||||||
{
|
{
|
||||||
QByteArray qbSend, qbRecv;
|
// QByteArray qbSend, qbRecv;
|
||||||
qbSend.clear();
|
// qbSend.clear();
|
||||||
qbRecv.clear();
|
// qbRecv.clear();
|
||||||
qbSend.append(GET_INTEGRATION_TIME);
|
// qbSend.append(GET_INTEGRATION_TIME);
|
||||||
qbSend.resize(3);
|
// qbSend.resize(3);
|
||||||
qbSend[1] = 0x00;
|
// qbSend[1] = 0x00;
|
||||||
qbSend[2] = 0x01;
|
// qbSend[2] = 0x01;
|
||||||
SendCommand(qbSend);
|
// int iRes = SendCommand(qbSend);
|
||||||
RecvData(qbRecv);
|
// if (iRes != 0)
|
||||||
ParseData(qbRecv);
|
// {
|
||||||
|
// qDebug() << "Err:GetExposureTime Failed.Exit Code:1";
|
||||||
|
// return 1;
|
||||||
|
// }
|
||||||
|
// iRes = RecvData(qbRecv);
|
||||||
|
// if (iRes != 0)
|
||||||
|
// {
|
||||||
|
// qDebug() << "Err:GetExposureTime Failed.Exit Code:2";
|
||||||
|
// return 2;
|
||||||
|
// }
|
||||||
|
// iRes = ParseData(qbRecv);
|
||||||
|
// if (iRes != 0)
|
||||||
|
// {
|
||||||
|
// qDebug() << "Err:GetExposureTime Failed.Exit Code:3";
|
||||||
|
// return 3;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// iExposureTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||||
|
iExposureTimeInMS = m_iExposureTime;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -510,11 +618,28 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
|||||||
qbRecv.clear();
|
qbRecv.clear();
|
||||||
qbSend.append(SYNC_GET_DATA);
|
qbSend.append(SYNC_GET_DATA);
|
||||||
qbSend.resize(3);
|
qbSend.resize(3);
|
||||||
qbSend[1] = 0x00;
|
// qbSend[1] = 0x00;
|
||||||
qbSend[2] = 0x01;
|
// qbSend[2] = 0x01;
|
||||||
SendCommand(qbSend);
|
qbSend[1] = m_iExposureTime >> 8;;
|
||||||
RecvData(qbRecv);
|
qbSend[2] = m_iExposureTime & 0xFF;
|
||||||
ParseData(qbRecv);
|
int iRes = SendCommand(qbSend);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShot Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShot Failed.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShot Failed.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
ZZ_U16 usData[4096] = { 0 };
|
ZZ_U16 usData[4096] = { 0 };
|
||||||
|
|
||||||
@ -528,10 +653,16 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
|||||||
//int aaa = qbRecv.size();
|
//int aaa = qbRecv.size();
|
||||||
int iDataSizeInPixel = (qbRecv.size() - 1) / 2;
|
int iDataSizeInPixel = (qbRecv.size() - 1) / 2;
|
||||||
memcpy(usData, qbRecv.data() + 1, iDataSizeInPixel * 2);
|
memcpy(usData, qbRecv.data() + 1, iDataSizeInPixel * 2);
|
||||||
for (int i=0;i< iDataSizeInPixel;i++)
|
for (size_t i = 0; i < iDataSizeInPixel; i++)
|
||||||
{
|
{
|
||||||
dfData.lData[i] = usData[i];
|
dfData.lData[i] = qToBigEndian(usData[i]);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// for (int i = 0; i < iDataSizeInPixel; i++)
|
||||||
|
// {
|
||||||
|
// dfData.lData[i] = usData[i];
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -546,14 +677,29 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(int &iPixels)
|
|||||||
qbSend.resize(3);
|
qbSend.resize(3);
|
||||||
qbSend[1] = 0x00;
|
qbSend[1] = 0x00;
|
||||||
qbSend[2] = 0x01;
|
qbSend[2] = 0x01;
|
||||||
SendCommand(qbSend);
|
int iRes = SendCommand(qbSend);
|
||||||
RecvData(qbRecv);
|
if (iRes != 0)
|
||||||
ParseData(qbRecv);
|
{
|
||||||
|
qDebug() << "Err:SingleShotP Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShotP Failed.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:SingleShot Failed.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ZZ_U8)qbRecv[0] != 0)
|
if ((ZZ_U8)qbRecv[0] != 0)
|
||||||
{
|
{
|
||||||
qDebug() << "Err:SingleShot Failed.Exit Code:1";
|
qDebug() << "Err:SingleShotP Failed.Exit Code:4";
|
||||||
return 1;
|
return 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -572,6 +718,8 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(int &iPixels)
|
|||||||
|
|
||||||
int ZZ_ATPControl_Serial_Qt::GetDeviceTemperature(float& fTemperature)
|
int ZZ_ATPControl_Serial_Qt::GetDeviceTemperature(float& fTemperature)
|
||||||
{
|
{
|
||||||
|
fTemperature = 0;
|
||||||
|
|
||||||
QByteArray qbSend, qbRecv;
|
QByteArray qbSend, qbRecv;
|
||||||
qbSend.clear();
|
qbSend.clear();
|
||||||
qbRecv.clear();
|
qbRecv.clear();
|
||||||
@ -579,9 +727,28 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceTemperature(float &fTemperature)
|
|||||||
qbSend.resize(3);
|
qbSend.resize(3);
|
||||||
qbSend[1] = 0x00;
|
qbSend[1] = 0x00;
|
||||||
qbSend[2] = 0x01;
|
qbSend[2] = 0x01;
|
||||||
SendCommand(qbSend);
|
int iRes = SendCommand(qbSend);
|
||||||
RecvData(qbRecv);
|
if (iRes != 0)
|
||||||
ParseData(qbRecv);
|
{
|
||||||
|
qDebug() << "Err:GetDeviceTemperature Failed.Exit Code:1";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iRes = RecvData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceTemperature Failed.Exit Code:2";
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
iRes = ParseData(qbRecv);
|
||||||
|
if (iRes != 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Err:GetDeviceTemperature Failed.Exit Code:3";
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString qstrTemp = qbRecv.data();
|
||||||
|
fTemperature = qstrTemp.toFloat();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
//<2F>Զ<EFBFBD><D4B6>ع<EFBFBD>
|
||||||
logout("<br><b style=\"color:red\">AutoExpose!</b>");
|
logout("<br><b style=\"color:red\">AutoExpose!</b>");
|
||||||
// m_FiberSpectrometer->autoExpose();
|
m_FiberSpectrometer->autoExpose();
|
||||||
|
|
||||||
|
|
||||||
//<2F><><EFBFBD><EFBFBD>sleep<65><70><EFBFBD>ȴ<EFBFBD><C8B4>رտ<D8B1><D5BF><EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>sleep<65><70><EFBFBD>ȴ<EFBFBD><C8B4>رտ<D8B1><D5BF><EFBFBD>
|
||||||
|
@ -29,3 +29,5 @@ cd ../
|
|||||||
cd ../../
|
cd ../../
|
||||||
cp -r ./html/* /var/www/html
|
cp -r ./html/* /var/www/html
|
||||||
chmod +x /var/www/html/php/*.sh
|
chmod +x /var/www/html/php/*.sh
|
||||||
|
|
||||||
|
#tc
|
||||||
|
Reference in New Issue
Block a user