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
43
FSUDAQ.cpp
43
FSUDAQ.cpp
|
@ -1714,39 +1714,46 @@ void FSUDAQ::OpenScope(){
|
||||||
if( scope == nullptr ) {
|
if( scope == nullptr ) {
|
||||||
scope = new Scope(digi, nDigi, readDataThread);
|
scope = new Scope(digi, nDigi, readDataThread);
|
||||||
connect(scope, &Scope::SendLogMsg, this, &FSUDAQ::LogMsg);
|
connect(scope, &Scope::SendLogMsg, this, &FSUDAQ::LogMsg);
|
||||||
|
|
||||||
connect(scope, &Scope::CloseWindow, this, [=](){
|
connect(scope, &Scope::CloseWindow, this, [=](){
|
||||||
bnStartACQ->setEnabled(true);
|
bnStartACQ->setEnabled(true);
|
||||||
bnStartACQ->setStyleSheet("background-color: green;");
|
bnStartACQ->setStyleSheet("background-color: green;");
|
||||||
bnStopACQ->setEnabled(false);
|
bnStopACQ->setEnabled(false);
|
||||||
bnStopACQ->setStyleSheet("");
|
bnStopACQ->setStyleSheet("");
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(scope, &Scope::TellACQOnOff, this, [=](bool onOff){
|
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("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
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");
|
scalarTimer->start(ScalarUpdateinMiliSec);
|
||||||
}else{
|
}
|
||||||
|
|
||||||
|
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("<font style=\"color: red;\"><b>ACQ Off</b></font>");
|
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");
|
scalarTimer->stop();
|
||||||
}
|
|
||||||
if( influx && chkInflux->isChecked()){
|
|
||||||
influx->WriteData(dataBaseName.toStdString());
|
|
||||||
influx->ClearDataPointsBuffer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( singleHistograms ) singleHistograms->stopWork();
|
||||||
|
if( onlineAnalyzer ) onlineAnalyzer->stopWork();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( digiSettings ) digiSettings->setEnabled(!onOff);
|
if( digiSettings ) digiSettings->EnableButtons(!onOff);
|
||||||
if( singleHistograms ) {
|
|
||||||
if( onOff ) {
|
|
||||||
singleHistograms->startWork();
|
|
||||||
}else{
|
|
||||||
singleHistograms->stopWork();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if( scalar ) connect(scope, &Scope::UpdateScaler, scalarWorker, &ScalarWorker::UpdateScalar);
|
|
||||||
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); });
|
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); });
|
||||||
|
|
||||||
scope->show();
|
scope->show();
|
||||||
|
|
10
Scope.cpp
10
Scope.cpp
|
@ -289,9 +289,6 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
});
|
});
|
||||||
workerThread->start();
|
workerThread->start();
|
||||||
|
|
||||||
scalarTimer = new QTimer(this);
|
|
||||||
connect(scalarTimer, &QTimer::timeout, this, &Scope::UpdateScaler);
|
|
||||||
|
|
||||||
enableSignalSlot = true;
|
enableSignalSlot = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -300,7 +297,7 @@ Scope::~Scope(){
|
||||||
DebugPrint("%s", "Scope");
|
DebugPrint("%s", "Scope");
|
||||||
|
|
||||||
scopeTimer->stop();
|
scopeTimer->stop();
|
||||||
scalarTimer->stop();
|
// scalarTimer->stop();
|
||||||
|
|
||||||
if( workerThread->isRunning() ){
|
if( workerThread->isRunning() ){
|
||||||
workerThread->quit();
|
workerThread->quit();
|
||||||
|
@ -435,7 +432,6 @@ void Scope::StartScope(){
|
||||||
}
|
}
|
||||||
|
|
||||||
scopeTimer->start(ScopeUpdateMiliSec);
|
scopeTimer->start(ScopeUpdateMiliSec);
|
||||||
scalarTimer->start(ScalarUpdateinMiliSec);
|
|
||||||
|
|
||||||
bnScopeStart->setEnabled(false);
|
bnScopeStart->setEnabled(false);
|
||||||
bnScopeStart->setStyleSheet("");
|
bnScopeStart->setStyleSheet("");
|
||||||
|
@ -458,7 +454,7 @@ void Scope::StopScope(){
|
||||||
|
|
||||||
// printf("------ Scope::%s \n", __func__);
|
// printf("------ Scope::%s \n", __func__);
|
||||||
scopeTimer->stop();
|
scopeTimer->stop();
|
||||||
scalarTimer->stop();
|
// scalarTimer->stop();
|
||||||
|
|
||||||
if( chkSoleRun->isChecked() ){
|
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();
|
emit UpdateOtherPanels();
|
||||||
|
|
||||||
|
|
4
Scope.h
4
Scope.h
|
@ -54,7 +54,6 @@ signals:
|
||||||
void CloseWindow();
|
void CloseWindow();
|
||||||
void SendLogMsg(const QString &msg);
|
void SendLogMsg(const QString &msg);
|
||||||
void TellACQOnOff(const bool onOff);
|
void TellACQOnOff(const bool onOff);
|
||||||
void UpdateScaler();
|
|
||||||
void UpdateOtherPanels();
|
void UpdateOtherPanels();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -90,7 +89,6 @@ private:
|
||||||
unsigned short oldCh, oldDigi;
|
unsigned short oldCh, oldDigi;
|
||||||
|
|
||||||
ReadDataThread ** readDataThread;
|
ReadDataThread ** readDataThread;
|
||||||
// TimingThread * updateScalarThread;
|
|
||||||
|
|
||||||
bool enableSignalSlot;
|
bool enableSignalSlot;
|
||||||
|
|
||||||
|
@ -152,8 +150,6 @@ private:
|
||||||
QThread * workerThread;
|
QThread * workerThread;
|
||||||
ScopeWorker * scopeWorker;
|
ScopeWorker * scopeWorker;
|
||||||
QTimer * scopeTimer;
|
QTimer * scopeTimer;
|
||||||
QTimer * scalarTimer;
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user