diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index 57eb1e9..bb89c18 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -1714,39 +1714,46 @@ void FSUDAQ::OpenScope(){ if( scope == nullptr ) { scope = new Scope(digi, nDigi, readDataThread); connect(scope, &Scope::SendLogMsg, this, &FSUDAQ::LogMsg); + connect(scope, &Scope::CloseWindow, this, [=](){ bnStartACQ->setEnabled(true); bnStartACQ->setStyleSheet("background-color: green;"); bnStopACQ->setEnabled(false); bnStopACQ->setStyleSheet(""); }); + connect(scope, &Scope::TellACQOnOff, this, [=](bool onOff){ - if( scope ) { - if( onOff ) { + + isACQStarted = onOff; + + if( onOff ){ + if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); + + if( scalar ){ lbScalarACQStatus->setText("ACQ On"); - if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1"); - }else{ + scalarTimer->start(ScalarUpdateinMiliSec); + } + + if( singleHistograms ) singleHistograms->startWork(); + if( onlineAnalyzer ) onlineAnalyzer->startWork(); + + }else{ + if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); + + if( scalar ){ lbScalarACQStatus->setText("ACQ Off"); - if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0"); - } - if( influx && chkInflux->isChecked()){ - influx->WriteData(dataBaseName.toStdString()); - influx->ClearDataPointsBuffer(); + scalarTimer->stop(); } + + if( singleHistograms ) singleHistograms->stopWork(); + if( onlineAnalyzer ) onlineAnalyzer->stopWork(); + } - if( digiSettings ) digiSettings->setEnabled(!onOff); - if( singleHistograms ) { - if( onOff ) { - singleHistograms->startWork(); - }else{ - singleHistograms->stopWork(); - } - } + if( digiSettings ) digiSettings->EnableButtons(!onOff); }); - if( scalar ) connect(scope, &Scope::UpdateScaler, scalarWorker, &ScalarWorker::UpdateScalar); connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); }); scope->show(); diff --git a/Scope.cpp b/Scope.cpp index 556aa80..372e719 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -289,9 +289,6 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh }); workerThread->start(); - scalarTimer = new QTimer(this); - connect(scalarTimer, &QTimer::timeout, this, &Scope::UpdateScaler); - enableSignalSlot = true; } @@ -300,7 +297,7 @@ Scope::~Scope(){ DebugPrint("%s", "Scope"); scopeTimer->stop(); - scalarTimer->stop(); + // scalarTimer->stop(); if( workerThread->isRunning() ){ workerThread->quit(); @@ -435,7 +432,6 @@ void Scope::StartScope(){ } scopeTimer->start(ScopeUpdateMiliSec); - scalarTimer->start(ScalarUpdateinMiliSec); bnScopeStart->setEnabled(false); bnScopeStart->setStyleSheet(""); @@ -458,7 +454,7 @@ void Scope::StopScope(){ // printf("------ Scope::%s \n", __func__); scopeTimer->stop(); - scalarTimer->stop(); + // scalarTimer->stop(); if( chkSoleRun->isChecked() ){ @@ -517,7 +513,7 @@ void Scope::StopScope(){ } - runStatus->setStyleSheet(""); // cheated, don;t know why digi[iDigi]->GetACQStatusFromMemory(), sometimes return ACQ on + runStatus->setStyleSheet(""); // cheated, don;t know why digi[iDigi]->GetACQStatusFromMemory(), sometimes return ACQ one. emit UpdateOtherPanels(); diff --git a/Scope.h b/Scope.h index d1268db..be68607 100644 --- a/Scope.h +++ b/Scope.h @@ -54,7 +54,6 @@ signals: void CloseWindow(); void SendLogMsg(const QString &msg); void TellACQOnOff(const bool onOff); - void UpdateScaler(); void UpdateOtherPanels(); private: @@ -90,7 +89,6 @@ private: unsigned short oldCh, oldDigi; ReadDataThread ** readDataThread; - // TimingThread * updateScalarThread; bool enableSignalSlot; @@ -152,8 +150,6 @@ private: QThread * workerThread; ScopeWorker * scopeWorker; QTimer * scopeTimer; - QTimer * scalarTimer; - };