mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 19:49:42 +08:00
调试上传用
This commit is contained in:
74
source/CaptureThread/Scheduler.cpp
Normal file
74
source/CaptureThread/Scheduler.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
#include "Scheduler.h"
|
||||
|
||||
Scheduler::Scheduler(QObject* parent /*= nullptr*/)
|
||||
{
|
||||
m_GrabTimer = new QTimer(this);
|
||||
connect(m_GrabTimer, &QTimer::timeout, this, &Scheduler::OnTimeCounter);
|
||||
connect(this, &Scheduler::SignalSelfStart, this, &Scheduler::StartAsPlanned);
|
||||
}
|
||||
|
||||
Scheduler::~Scheduler()
|
||||
{
|
||||
if (m_GrabTimer != NULL)
|
||||
{
|
||||
m_GrabTimer->stop();
|
||||
delete m_GrabTimer;
|
||||
}
|
||||
}
|
||||
|
||||
void Scheduler::SetAcqTimeParams(AcqTimeSettings struAcqTime)
|
||||
{
|
||||
m_struAcqTime = struAcqTime;
|
||||
}
|
||||
|
||||
void Scheduler::Preheating()
|
||||
{
|
||||
qDebug() << "Start Preheating";
|
||||
#ifdef _DEBUG
|
||||
QThread::msleep(5000);
|
||||
#else
|
||||
QThread::msleep(10000);//NEED TO CHANGE BEFOR HAND TO CUSTOM
|
||||
#endif
|
||||
qDebug() << "Preheating Finished";
|
||||
}
|
||||
|
||||
void Scheduler::SelfStart()
|
||||
{
|
||||
emit SignalSelfStart();
|
||||
}
|
||||
|
||||
void Scheduler::StartAsPlanned()
|
||||
{
|
||||
bool bStopWait = false;
|
||||
QTime qtTime = QTime::currentTime();
|
||||
while (!bStopWait)
|
||||
{
|
||||
QThread::msleep(100);
|
||||
if (m_struAcqTime.qtStartTime <= qtTime && qtTime < m_struAcqTime.qtStopTime)
|
||||
{
|
||||
bStopWait = true;
|
||||
}
|
||||
}
|
||||
|
||||
int iIntervalInMS = m_struAcqTime.qtInterval.hour() * 3600 * 1000 + m_struAcqTime.qtInterval.minute() * 60 * 1000 + m_struAcqTime.qtInterval.second() * 1000;
|
||||
|
||||
m_GrabTimer->start(iIntervalInMS);
|
||||
}
|
||||
|
||||
int Scheduler::OnTimeCounter()
|
||||
{
|
||||
QTime qtTime = QTime::currentTime();
|
||||
if (m_struAcqTime.qtStartTime <= qtTime && qtTime < m_struAcqTime.qtStopTime)
|
||||
{
|
||||
qDebug() << "it's time to work...work work.";
|
||||
emit SignalGrabOnce();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
system("gpio write 1 0");//<2F>豸<EFBFBD>ϵ<EFBFBD>
|
||||
qDebug() << "gpio write 1 0......"<<endl;
|
||||
qDebug() << "Non working time. Idling......";
|
||||
return 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user