mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 19:39:43 +08:00
修改了电机运动判断函数,添加了尝试机制。其他小bug/同步等修改。测试版本号:beta 1.0
This commit is contained in:
@ -21,6 +21,7 @@ include_directories("source/Thread")
|
|||||||
include_directories("source/LinearShutter")
|
include_directories("source/LinearShutter")
|
||||||
include_directories("source/OSIF/include")
|
include_directories("source/OSIF/include")
|
||||||
include_directories("source/Misc_Detector")
|
include_directories("source/Misc_Detector")
|
||||||
|
include_directories("source/Upload")
|
||||||
|
|
||||||
link_directories("source/OSIF/DLib")
|
link_directories("source/OSIF/DLib")
|
||||||
|
|
||||||
|
2
main.cpp
2
main.cpp
@ -36,7 +36,7 @@ int main(int argc, char *argv[])
|
|||||||
MEContext m_struMEC;
|
MEContext m_struMEC;
|
||||||
HumitureDeviceInfo m_struHumitureDI;
|
HumitureDeviceInfo m_struHumitureDI;
|
||||||
//////////////////////////////////////////////////////////////////////////logger
|
//////////////////////////////////////////////////////////////////////////logger
|
||||||
//QT_LOG::ZZ_InitLogger(QCoreApplication::applicationDirPath() + "/Log/");
|
QT_LOG::ZZ_InitLogger("/home/data/Log/");
|
||||||
|
|
||||||
|
|
||||||
//m_test123;
|
//m_test123;
|
||||||
|
@ -86,6 +86,7 @@ bool DataFileProcessor::WriteEnvironmentInfo()
|
|||||||
qfData.write("EnvironmentalContext,");
|
qfData.write("EnvironmentalContext,");
|
||||||
qfData.write("DEV_SN,");
|
qfData.write("DEV_SN,");
|
||||||
qfData.write(m_struEC.qstrDEV_SN.toLatin1());
|
qfData.write(m_struEC.qstrDEV_SN.toLatin1());
|
||||||
|
qfData.write(",");
|
||||||
qfData.write("CaseHumidity,");
|
qfData.write("CaseHumidity,");
|
||||||
qfData.write(m_struEC.qstrCaseHumidity.toLatin1());
|
qfData.write(m_struEC.qstrCaseHumidity.toLatin1());
|
||||||
qfData.write(",");
|
qfData.write(",");
|
||||||
|
@ -80,22 +80,65 @@ void CVSMD12XControl::ILMES_SetPosition(int *piPositionInPulse, size_t szSize)
|
|||||||
|
|
||||||
bool CVSMD12XControl::ILMES_MoveToPos(int iPositionIndex)
|
bool CVSMD12XControl::ILMES_MoveToPos(int iPositionIndex)
|
||||||
{
|
{
|
||||||
|
bool bFlagFailed = true;
|
||||||
bool bRes = false;
|
bool bRes = false;
|
||||||
bRes = CVSMD12XControl::StartBackZero();
|
int iCount = 0;
|
||||||
if (!bRes)
|
|
||||||
|
for (int i=0;i<3;i++)
|
||||||
|
{
|
||||||
|
if (CVSMD12XControl::StartBackZero())
|
||||||
|
{
|
||||||
|
bFlagFailed = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
while (!bRes)
|
||||||
|
{
|
||||||
|
iCount++;
|
||||||
|
bRes = StopBackZero();
|
||||||
|
if (iCount>10)
|
||||||
|
{
|
||||||
|
qDebug() << "StopBackZero Err.Give up...";
|
||||||
|
bRes = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bFlagFailed)
|
||||||
{
|
{
|
||||||
qDebug() << "StartBackZero Err";
|
qDebug() << "StartBackZero Err";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bRes = CVSMD12XControl::MoveTo(m_piPositionInPulses[iPositionIndex]);
|
bFlagFailed = true;
|
||||||
if (!bRes)
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
if (MoveTo(m_piPositionInPulses[iPositionIndex]))
|
||||||
|
{
|
||||||
|
bFlagFailed = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bFlagFailed)
|
||||||
{
|
{
|
||||||
qDebug() << "MoveTo Err";
|
qDebug() << "MoveTo Err";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return bRes;
|
return true;
|
||||||
|
|
||||||
|
// bool bRes = false;
|
||||||
|
// bRes = CVSMD12XControl::StartBackZero();
|
||||||
|
// if (!bRes)
|
||||||
|
// {
|
||||||
|
// qDebug() << "StartBackZero Err";
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// bRes = CVSMD12XControl::MoveTo(m_piPositionInPulses[iPositionIndex]);
|
||||||
|
// if (!bRes)
|
||||||
|
// {
|
||||||
|
// qDebug() << "MoveTo Err";
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
// return bRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVSMD12XControl::SetProtocolType(int iProtocolType /*= 0*/)
|
void CVSMD12XControl::SetProtocolType(int iProtocolType /*= 0*/)
|
||||||
@ -306,20 +349,20 @@ bool CVSMD12XControl::MoveTo(int iAbsPulse)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bFlagIsStopped = false;
|
// bool bFlagIsStopped = false;
|
||||||
while (!bFlagIsStopped)
|
// while (!bFlagIsStopped)
|
||||||
{
|
// {
|
||||||
QThread::msleep(200);
|
// QThread::msleep(200);
|
||||||
//Delay_MSec(200);
|
// //Delay_MSec(200);
|
||||||
GetStatus(m_stuMSInfo);
|
// GetStatus(m_stuMSInfo);
|
||||||
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
// ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
||||||
ucFlag = ucFlag & 0x10;
|
// ucFlag = ucFlag & 0x10;
|
||||||
if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
// if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
||||||
{
|
// {
|
||||||
bFlagIsStopped = true;
|
// bFlagIsStopped = true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return true;
|
return IsMotionFinished();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -382,20 +425,21 @@ bool CVSMD12XControl::StartBackZero()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bFlagIsStopped = false;
|
return IsMotionFinished();
|
||||||
while (!bFlagIsStopped)
|
// bool bFlagIsStopped = false;
|
||||||
{
|
// while (!bFlagIsStopped)
|
||||||
QThread::msleep(200);
|
// {
|
||||||
//Delay_MSec(200);
|
// QThread::msleep(200);
|
||||||
GetStatus(m_stuMSInfo);
|
// //Delay_MSec(200);
|
||||||
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
// GetStatus(m_stuMSInfo);
|
||||||
ucFlag = ucFlag & 0x10;
|
// ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
||||||
if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
// ucFlag = ucFlag & 0x10;
|
||||||
{
|
// if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
||||||
bFlagIsStopped = true;
|
// {
|
||||||
}
|
// bFlagIsStopped = true;
|
||||||
}
|
// }
|
||||||
return true;
|
// }
|
||||||
|
// return true;
|
||||||
// return ParseReturnedString(strRecv, -1);
|
// return ParseReturnedString(strRecv, -1);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1374,6 +1418,50 @@ char* CVSMD12XControl::VSMD_Split(char* cStr, char cSplit)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CVSMD12XControl::IsMotionFinished()
|
||||||
|
{
|
||||||
|
//true means stopped
|
||||||
|
//false means unknown status
|
||||||
|
int iCountTotal = 0;
|
||||||
|
int iCountStopped = 0;
|
||||||
|
bool bFlagIsStopped = false;
|
||||||
|
|
||||||
|
while (!bFlagIsStopped)
|
||||||
|
{
|
||||||
|
iCountTotal++;
|
||||||
|
QThread::msleep(200);
|
||||||
|
//Delay_MSec(200);
|
||||||
|
GetStatus(m_stuMSInfo);
|
||||||
|
ZZ_U8 ucFlag = m_stuMSInfo.uiFlags & 0x000000FF;
|
||||||
|
ucFlag = ucFlag & 0x10;
|
||||||
|
if (m_stuMSInfo.fVelocity == 0)
|
||||||
|
{
|
||||||
|
iCountStopped++;
|
||||||
|
}
|
||||||
|
if (ucFlag == 0x10 && m_stuMSInfo.fVelocity == 0)
|
||||||
|
{
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (iCountStopped>=50)
|
||||||
|
{
|
||||||
|
qDebug() <<"Warning.Motion Err,should be stopped already.checking register and retry...";
|
||||||
|
qDebug() <<"motion status:"<<ucFlag<<"all status:"<<QString::number(m_stuMSInfo.uiFlags,2);
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (iCountTotal>1000)
|
||||||
|
{
|
||||||
|
qDebug() << "Err.Motor Hardware Err,should be stopped already";
|
||||||
|
qDebug() << "motion status:" << ucFlag << "all status:" << QString::number(m_stuMSInfo.uiFlags, 2);
|
||||||
|
bFlagIsStopped = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CVSMD12XControl::Delay_MSec(ZZ_U16 usMS)
|
void CVSMD12XControl::Delay_MSec(ZZ_U16 usMS)
|
||||||
{
|
{
|
||||||
QEventLoop qeLoop;
|
QEventLoop qeLoop;
|
||||||
|
@ -139,7 +139,8 @@ private:
|
|||||||
bool ParseReturnedParam(std::string &strRecv);
|
bool ParseReturnedParam(std::string &strRecv);
|
||||||
void VSMD_BitShift(ZZ_U8* src, unValue* dst);
|
void VSMD_BitShift(ZZ_U8* src, unValue* dst);
|
||||||
char* VSMD_Split(char* cStr, char cSplit);
|
char* VSMD_Split(char* cStr, char cSplit);
|
||||||
|
//////////////////////////////////////////////////////////////////////////sync
|
||||||
|
bool IsMotionFinished();
|
||||||
//////////////////////////////////////////////////////////////////////////qt
|
//////////////////////////////////////////////////////////////////////////qt
|
||||||
void Delay_MSec(ZZ_U16 usMS);
|
void Delay_MSec(ZZ_U16 usMS);
|
||||||
};
|
};
|
||||||
|
@ -107,6 +107,8 @@ int CAbstractFSController::PerformAutoExposure()
|
|||||||
float fPredictedExposureTime;
|
float fPredictedExposureTime;
|
||||||
int iDeviceDepth = (int)m_fsInfo.lDepth;
|
int iDeviceDepth = (int)m_fsInfo.lDepth;
|
||||||
|
|
||||||
|
qDebug() << "MAX---Min" << m_fsInfo.fMaxFactor << "---" << m_fsInfo.fMinFactor;
|
||||||
|
|
||||||
bool bFlagIsOverTrying = false;
|
bool bFlagIsOverTrying = false;
|
||||||
bool bFlagIsLowerMinExposureTime = false;
|
bool bFlagIsLowerMinExposureTime = false;
|
||||||
bool bFlagIsOverMaxExposureTime = false;
|
bool bFlagIsOverMaxExposureTime = false;
|
||||||
@ -163,6 +165,8 @@ int CAbstractFSController::PerformAutoExposure()
|
|||||||
}
|
}
|
||||||
double dTemp = dSum / iCount;
|
double dTemp = dSum / iCount;
|
||||||
|
|
||||||
|
qDebug() << "Avg " << dTemp;
|
||||||
|
|
||||||
if (dTemp >= iDeviceDepth * 0.99)
|
if (dTemp >= iDeviceDepth * 0.99)
|
||||||
{
|
{
|
||||||
bIsValueOverflow = true;
|
bIsValueOverflow = true;
|
||||||
@ -178,6 +182,7 @@ int CAbstractFSController::PerformAutoExposure()
|
|||||||
|
|
||||||
else if (iDeviceDepth * m_fsInfo.fMaxFactor >= dTemp && dTemp >= iDeviceDepth * m_fsInfo.fMinFactor)
|
else if (iDeviceDepth * m_fsInfo.fMaxFactor >= dTemp && dTemp >= iDeviceDepth * m_fsInfo.fMinFactor)
|
||||||
{
|
{
|
||||||
|
qDebug() << "trace bFlagIsAutoExposureOK =1" << iExposureTime;
|
||||||
bFlagIsAutoExposureOK = 1;
|
bFlagIsAutoExposureOK = 1;
|
||||||
}
|
}
|
||||||
else if (dTemp > iDeviceDepth * m_fsInfo.fMaxFactor)
|
else if (dTemp > iDeviceDepth * m_fsInfo.fMaxFactor)
|
||||||
@ -305,7 +310,7 @@ int CAbstractFSController::StartAcquisitionSignal()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//PerformAutoExposure();
|
PerformAutoExposure();
|
||||||
TakeSignalFrame();
|
TakeSignalFrame();
|
||||||
|
|
||||||
qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID;
|
qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID;
|
||||||
|
@ -27,7 +27,7 @@ void Scheduler::Preheating()
|
|||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
QThread::msleep(5000);
|
QThread::msleep(5000);
|
||||||
#else
|
#else
|
||||||
QThread::msleep(1000*60*5);
|
QThread::msleep(10000);//NEED TO CHANGE BEFOR HAND TO CUSTOM
|
||||||
#endif
|
#endif
|
||||||
qDebug() << "Preheating Finished";
|
qDebug() << "Preheating Finished";
|
||||||
}
|
}
|
||||||
|
0
source/Upload/DataFileTransfer.cpp
Normal file
0
source/Upload/DataFileTransfer.cpp
Normal file
3
source/Upload/DataFileTransfer.h
Normal file
3
source/Upload/DataFileTransfer.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "pch.h"
|
||||||
|
#include "ZZ_Types.h"
|
Reference in New Issue
Block a user