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:
63
source/Thread/Scheduler.cpp
Normal file
63
source/Thread/Scheduler.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
#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(1000*60*5);
|
||||
#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(3000);
|
||||
}
|
||||
|
||||
int Scheduler::OnTimeCounter()
|
||||
{
|
||||
emit SignalGrabOnce();
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user