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/zhangzhuo'
This commit is contained in:
BIN
Data/2021_12_13.7z
Normal file
BIN
Data/2021_12_13.7z
Normal file
Binary file not shown.
6
Data/2021_12_14/beijing_14_51_11.csv
Normal file
6
Data/2021_12_14/beijing_14_51_11.csv
Normal file
File diff suppressed because one or more lines are too long
6
Data/2021_12_14/beijing_14_51_32.csv
Normal file
6
Data/2021_12_14/beijing_14_51_32.csv
Normal file
File diff suppressed because one or more lines are too long
@ -21,7 +21,7 @@ Model=Null
|
||||
Port=COM8
|
||||
Type=1
|
||||
DCID=1
|
||||
TotalPosition=6
|
||||
TotalPosition=2
|
||||
Position0=2000
|
||||
Position1=110000
|
||||
Position2=220000
|
||||
|
30
main.cpp
30
main.cpp
@ -43,18 +43,26 @@ int main(int argc, char *argv[])
|
||||
CMainDataGrabber testDG;
|
||||
QThread* m_pqDataGrabberThreadHolder = new QThread();
|
||||
testDG.moveToThread(m_pqDataGrabberThreadHolder);
|
||||
testDG.SetGrabberFileProcessor(testdp);
|
||||
testDG.SetGrabberParams(testp);
|
||||
testDG.SetTimer(testS);
|
||||
testDG.InitThreadStatus();
|
||||
testDG.InitializeWorkers();
|
||||
testDG.InitLS();
|
||||
testDG.SetupMsgPipelines();
|
||||
testDG.StartWorkers();
|
||||
|
||||
|
||||
|
||||
testDG.SetContext(testp, testdp, testS);
|
||||
testDG.Init_Normal();
|
||||
//testDG.SetGrabberFileProcessor(testdp);
|
||||
//testDG.SetGrabberParams(testp);
|
||||
//testDG.SetTimer(testS);
|
||||
//testDG.InitThreadStatus();
|
||||
//testDG.InitializeWorkers();
|
||||
//testDG.SetupMsgPipelines();
|
||||
//testDG.StartWorkers();
|
||||
m_pqDataGrabberThreadHolder->start();
|
||||
testDG.Init_Self();
|
||||
//testDG.InitThreadStatus();
|
||||
//testDG.InitializeWorkers();
|
||||
//testDG.InitLS();
|
||||
//testDG.SetupMsgPipelines();
|
||||
//testDG.StartWorkers();
|
||||
|
||||
|
||||
|
||||
|
||||
//testDG.StartGrab();
|
||||
|
||||
QThread* m_pqTimerThreadHolder = new QThread();
|
||||
|
@ -41,8 +41,7 @@ bool DataFileProcessor::WriteDataFile()
|
||||
WriteEnvironmentInfo();
|
||||
WriteDeviceInfo();
|
||||
WriteData();
|
||||
bool res = true;
|
||||
return res;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void DataFileProcessor::GenerateFilePath()
|
||||
@ -54,17 +53,21 @@ void DataFileProcessor::GenerateFilePath()
|
||||
m_struEC.qstrUTCDateTime = m_qdtTime.toUTC().toString("yyyy_MM_dd hh:mm:ss");
|
||||
|
||||
m_qstrFullFileName = m_qstrFilePath + qstrAddYMD;
|
||||
m_qstrFilePath= m_qstrFullFileName;
|
||||
QString qstrTemp= m_qstrFullFileName;
|
||||
if (m_struEC.qstrLocation=="")
|
||||
{
|
||||
m_struEC.qstrLocation = "Unknown";
|
||||
}
|
||||
m_qstrFullFileName= m_qstrFullFileName+"/"+m_struEC.qstrLocation + qstrAddHMS+".csv";
|
||||
|
||||
QDir qdirPath(m_qstrFilePath);
|
||||
QDir qdirPath(qstrTemp);
|
||||
if (!qdirPath.exists())
|
||||
{
|
||||
qdirPath.mkdir(m_qstrFilePath);
|
||||
bool bRes = qdirPath.mkdir(qstrTemp);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "DataFileProcessor mkdir Failed.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,8 +78,10 @@ bool DataFileProcessor::WriteEnvironmentInfo()
|
||||
bRes = qfData.open(QFile::WriteOnly|QFile::Text|QFile::Truncate);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "WriteEnvironmentInfo open Failed.";
|
||||
return bRes;
|
||||
}
|
||||
qDebug() << m_qstrFullFileName;
|
||||
//EC
|
||||
qfData.write("EnvironmentalContext,");
|
||||
qfData.write("CaseHumidity,");
|
||||
@ -134,6 +139,11 @@ void DataFileProcessor::WriteDeviceInfo()
|
||||
{
|
||||
QFile qfData(m_qstrFullFileName);
|
||||
bool bRes = qfData.open(QFile::WriteOnly | QFile::Text | QIODevice::Append);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "WriteDeviceInfo open Failed.";
|
||||
return;
|
||||
}
|
||||
QString qstrTemp;
|
||||
|
||||
qfData.write("\n");
|
||||
@ -190,6 +200,11 @@ bool DataFileProcessor::WriteData()
|
||||
{
|
||||
QFile qfData(m_qstrFullFileName);
|
||||
bool bRes = qfData.open(QFile::WriteOnly | QFile::Text | QIODevice::Append);
|
||||
if (!bRes)
|
||||
{
|
||||
qDebug() << "WriteData open Failed.";
|
||||
return 0;
|
||||
}
|
||||
QString qstrTemp;
|
||||
qfData.write("Data Section");
|
||||
qfData.write("\n");
|
||||
@ -217,14 +232,7 @@ bool DataFileProcessor::WriteData()
|
||||
qfData.write("\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool res = true;
|
||||
return res;
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ typedef struct tagControllerParams
|
||||
float spd = 64000; //velocity
|
||||
float acc = 100000; //acceleration
|
||||
float dec = 100000; //deceleration
|
||||
float cra; //acc state current
|
||||
float crn; //normal state current
|
||||
float crh; //hold state current
|
||||
float cra = (float)0.8; //acc state current
|
||||
float crn = (float)0.8; //normal state current
|
||||
float crh = (float)0.8; //hold state current
|
||||
ZZ_U8 s1f;
|
||||
ZZ_U8 s1r;
|
||||
ZZ_U8 s2f;
|
||||
|
@ -56,6 +56,22 @@ void CMainDataGrabber::SubDataFrame(DataFrame& dfLeft, DataFrame const dfRight,
|
||||
}
|
||||
}
|
||||
|
||||
int CMainDataGrabber::SetContext(RunTimeGrabberParams struGrabberRTParams, DataFileProcessor &dfpSaver, Scheduler &sScheduler)
|
||||
{
|
||||
SetGrabberParams(struGrabberRTParams);
|
||||
SetGrabberFileProcessor(dfpSaver);
|
||||
SetTimer(sScheduler);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CMainDataGrabber::Init_Normal()
|
||||
{
|
||||
InitThreadStatus();
|
||||
InitializeWorkers();
|
||||
SetupMsgPipelines();
|
||||
StartWorkers();
|
||||
}
|
||||
|
||||
int CMainDataGrabber::SetGrabberParams(RunTimeGrabberParams struGrabberRTParams)
|
||||
{
|
||||
m_struAcqTime = struGrabberRTParams.atsParams;
|
||||
@ -185,6 +201,8 @@ int CMainDataGrabber::SetupMsgPipelines()
|
||||
connect(this, &CMainDataGrabber::SignalGrabOnceFinished_Signal, this, &CMainDataGrabber::GrabOnceFinished_Signal);
|
||||
connect(this, &CMainDataGrabber::SignalGrabOnceFinished_Dark, this, &CMainDataGrabber::GrabOnceFinished_Dark);
|
||||
|
||||
qDebug()<<connect(this,&CMainDataGrabber::SignalLSInit,this,&CMainDataGrabber::InitLS);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -194,6 +212,12 @@ int CMainDataGrabber::StartGrab()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CMainDataGrabber::Init_Self()
|
||||
{
|
||||
emit SignalLSInit();
|
||||
return;
|
||||
}
|
||||
|
||||
int CMainDataGrabber::HandleThreadEvent_Signal(int iThreadID, int iFlagStatus)
|
||||
{
|
||||
m_piFlagCaptureThreadStatus_Signal[iThreadID] = iFlagStatus;
|
||||
@ -248,6 +272,15 @@ int CMainDataGrabber::GrabOnceFinished_Dark()
|
||||
return 0;
|
||||
}
|
||||
|
||||
//int CMainDataGrabber::InitLS_Self(/*RunTimeGrabberParams struGrabberRTParams, DataFileProcessor &dfpSaver, Scheduler &sScheduler*/)
|
||||
//{
|
||||
// //SetGrabberFileProcessor(dfpSaver);
|
||||
// //SetGrabberParams(struGrabberRTParams);
|
||||
// //SetTimer(sScheduler);
|
||||
// InitLS();
|
||||
// return 0;
|
||||
//}
|
||||
|
||||
int CMainDataGrabber::StartGrabTimer()
|
||||
{
|
||||
|
||||
@ -384,7 +417,7 @@ int CMainDataGrabber::GrabOnceFinished()
|
||||
}
|
||||
m_pdfpSaver->SetData(vecData);
|
||||
m_pdfpSaver->WriteDataFile();
|
||||
|
||||
m_iFlagIsCapturing = 0;
|
||||
|
||||
// qDebug() << "-------------------------------------------busy" << QTime::currentTime().toString();
|
||||
// QThread::msleep(5000);
|
||||
|
@ -44,21 +44,27 @@ private:
|
||||
private:
|
||||
void Delay_MSec(ZZ_U16 usMS);
|
||||
void SubDataFrame(DataFrame& dfLeft, DataFrame const dfRight,int iCount);
|
||||
public:
|
||||
|
||||
//Call this first
|
||||
int SetGrabberParams(RunTimeGrabberParams struGrabberRTParams);
|
||||
int SetGrabberFileProcessor(DataFileProcessor &dfpSaver);
|
||||
int SetTimer(Scheduler &sScheduler);
|
||||
|
||||
int InitLS();
|
||||
int InitThreadStatus();
|
||||
int InitializeWorkers();
|
||||
int StartWorkers();
|
||||
int SetupMsgPipelines();
|
||||
|
||||
int StartGrab();
|
||||
|
||||
|
||||
public:
|
||||
int SetContext(RunTimeGrabberParams struGrabberRTParams, DataFileProcessor &dfpSaver, Scheduler &sScheduler);
|
||||
void Init_Normal();
|
||||
void Init_Self();
|
||||
|
||||
public slots:
|
||||
//int InitLS_Self(/*RunTimeGrabberParams struGrabberRTParams, DataFileProcessor &dfpSaver, Scheduler &sScheduler*/);
|
||||
int InitLS();
|
||||
int StartGrabTimer();
|
||||
int OnTimeCounter();
|
||||
|
||||
@ -80,4 +86,6 @@ signals:
|
||||
|
||||
void SignalStopGrab();
|
||||
void SignalStartGrab();
|
||||
|
||||
void SignalLSInit();
|
||||
};
|
@ -53,7 +53,7 @@ void Scheduler::StartAsPlanned()
|
||||
|
||||
int iIntervalInMS = m_struAcqTime.qtInterval.hour() * 3600 * 1000 + m_struAcqTime.qtInterval.minute() * 60 * 1000 + m_struAcqTime.qtInterval.second() * 1000;
|
||||
|
||||
m_GrabTimer->start(3000);
|
||||
m_GrabTimer->start(iIntervalInMS);
|
||||
}
|
||||
|
||||
int Scheduler::OnTimeCounter()
|
||||
|
Reference in New Issue
Block a user