remove scope Qtimer for scalar, use the Scope::TellACQOnOff to start/stop work for scalar, singleHostogram, and onlineAnalyzer
This commit is contained in:
parent
c2265f3cc6
commit
11ae70db18
39
FSUDAQ.cpp
39
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 ) {
|
||||
|
||||
isACQStarted = onOff;
|
||||
|
||||
if( onOff ){
|
||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||
if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=1");
|
||||
}else{
|
||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||
if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
|
||||
}
|
||||
if( influx && chkInflux->isChecked()){
|
||||
influx->WriteData(dataBaseName.toStdString());
|
||||
influx->ClearDataPointsBuffer();
|
||||
}
|
||||
|
||||
if( scalar ){
|
||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||
scalarTimer->start(ScalarUpdateinMiliSec);
|
||||
}
|
||||
|
||||
if( digiSettings ) digiSettings->setEnabled(!onOff);
|
||||
if( singleHistograms ) {
|
||||
if( onOff ) {
|
||||
singleHistograms->startWork();
|
||||
if( singleHistograms ) singleHistograms->startWork();
|
||||
if( onlineAnalyzer ) onlineAnalyzer->startWork();
|
||||
|
||||
}else{
|
||||
singleHistograms->stopWork();
|
||||
if( influx && chkInflux->isChecked() && !elogName.isEmpty()) influx->AddDataPoint("SavingData,ExpName=" + elogName.toStdString() + " value=0");
|
||||
|
||||
if( scalar ){
|
||||
lbScalarACQStatus->setText("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
||||
scalarTimer->stop();
|
||||
}
|
||||
|
||||
if( singleHistograms ) singleHistograms->stopWork();
|
||||
if( onlineAnalyzer ) onlineAnalyzer->stopWork();
|
||||
|
||||
}
|
||||
|
||||
if( digiSettings ) digiSettings->EnableButtons(!onOff);
|
||||
|
||||
});
|
||||
|
||||
if( scalar ) connect(scope, &Scope::UpdateScaler, scalarWorker, &ScalarWorker::UpdateScalar);
|
||||
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); });
|
||||
|
||||
scope->show();
|
||||
|
|
10
Scope.cpp
10
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();
|
||||
|
||||
|
|
4
Scope.h
4
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;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user