bug fix for multiple digitizers
This commit is contained in:
parent
6211852acf
commit
ac81be92f7
|
@ -18,5 +18,5 @@ LIBS += -lcurl -lCAEN_FELib -lX11
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
# Input
|
# Input
|
||||||
HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h digiSettingsPanel.h Digiparameters.h scope.h manyThread.h CustomWidgets.h
|
HEADERS += ClassDigitizer2Gen.h Event.h influxdb.h mainwindow.h digiSettingsPanel.h Digiparameters.h scope.h manyThread.h CustomWidgets.h macro.h
|
||||||
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettingsPanel.cpp scope.cpp
|
SOURCES += ClassDigitizer2Gen.cpp influxdb.cpp main.cpp mainwindow.cpp digiSettingsPanel.cpp scope.cpp
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
|
|
||||||
#include "ClassDigitizer2Gen.h"
|
#include "ClassDigitizer2Gen.h"
|
||||||
#include "CustomWidgets.h"
|
#include "CustomWidgets.h"
|
||||||
|
#include "macro.h"
|
||||||
#define MaxNumberOfDigitizer 20
|
|
||||||
|
|
||||||
//^#######################################################
|
//^#######################################################
|
||||||
class DigiSettingsPanel : public QWidget{
|
class DigiSettingsPanel : public QWidget{
|
||||||
|
|
6
macro.h
Normal file
6
macro.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef MACRO_H
|
||||||
|
#define MACRO_H
|
||||||
|
|
||||||
|
#define MaxNumberOfDigitizer 20
|
||||||
|
|
||||||
|
#endif
|
|
@ -559,7 +559,7 @@ void MainWindow::OpenDigitizers(){
|
||||||
|
|
||||||
LogMsg("Opened digitizer : <font style=\"color:red;\">" + QString::number(digi[i]->GetSerialNumber()) + "</font>");
|
LogMsg("Opened digitizer : <font style=\"color:red;\">" + QString::number(digi[i]->GetSerialNumber()) + "</font>");
|
||||||
|
|
||||||
readDataThread[i] = new ReadDataThread(digi[i], this);
|
readDataThread[i] = new ReadDataThread(digi[i], i, this);
|
||||||
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
connect(readDataThread[i], &ReadDataThread::sendMsg, this, &MainWindow::LogMsg);
|
||||||
//connect(readDataThread[i], &ReadDataThread::checkFileSize, this, &MainWindow::CheckOutFileSize);
|
//connect(readDataThread[i], &ReadDataThread::checkFileSize, this, &MainWindow::CheckOutFileSize);
|
||||||
//connect(readDataThread[i], &ReadDataThread::endOfLastData, this, &MainWindow::CheckOutFileSize);
|
//connect(readDataThread[i], &ReadDataThread::endOfLastData, this, &MainWindow::CheckOutFileSize);
|
||||||
|
@ -644,6 +644,7 @@ void MainWindow::CloseDigitizers(){
|
||||||
if( digiSetting != NULL ) digiSetting->close();
|
if( digiSetting != NULL ) digiSetting->close();
|
||||||
|
|
||||||
if( readDataThread[i] != NULL ){
|
if( readDataThread[i] != NULL ){
|
||||||
|
LogMsg("Waiting for digitizer .....");
|
||||||
readDataThread[i]->quit();
|
readDataThread[i]->quit();
|
||||||
readDataThread[i]->wait();
|
readDataThread[i]->wait();
|
||||||
delete readDataThread[i];
|
delete readDataThread[i];
|
||||||
|
@ -672,13 +673,25 @@ void MainWindow::CloseDigitizers(){
|
||||||
|
|
||||||
//^###################################################################### Open Scope
|
//^###################################################################### Open Scope
|
||||||
void MainWindow::OpenScope(){
|
void MainWindow::OpenScope(){
|
||||||
|
|
||||||
if( digi ){
|
if( digi ){
|
||||||
if( !scope ){
|
if( !scope ){
|
||||||
scope = new Scope(digi, nDigi, readDataThread);
|
scope = new Scope(digi, nDigi, readDataThread);
|
||||||
connect(scope, &Scope::CloseWindow, this, [=](){ bnStartACQ->setEnabled(true); });
|
connect(scope, &Scope::CloseWindow, this, [=](){ bnStartACQ->setEnabled(true); });
|
||||||
connect(scope, &Scope::UpdateScalar, this, &MainWindow::UpdateScalar);
|
connect(scope, &Scope::UpdateScalar, this, &MainWindow::UpdateScalar);
|
||||||
connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
|
connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
|
||||||
|
connect(scope, &Scope::TellACQOnOff, this, [=](const bool onOff){
|
||||||
|
if( influx ){
|
||||||
|
influx->ClearDataPointsBuffer();
|
||||||
|
influx->AddDataPoint(onOff ? "StartStop value=1" : "StartStop value=0");
|
||||||
|
influx->WriteData(DatabaseName.toStdString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if( influx ){
|
||||||
|
influx->ClearDataPointsBuffer();
|
||||||
|
influx->AddDataPoint("StartStop value=1");
|
||||||
|
influx->WriteData(DatabaseName.toStdString());
|
||||||
|
}
|
||||||
|
|
||||||
if( digiSetting ) {
|
if( digiSetting ) {
|
||||||
connect(scope, &Scope::UpdateSettingsPanel, digiSetting, &DigiSettingsPanel::ShowSettingsToPanel);
|
connect(scope, &Scope::UpdateSettingsPanel, digiSetting, &DigiSettingsPanel::ShowSettingsToPanel);
|
||||||
|
@ -689,7 +702,7 @@ void MainWindow::OpenScope(){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
scope->show();
|
scope->show();
|
||||||
digiSetting->EnableControl();
|
if( digiSetting ) digiSetting->EnableControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -829,11 +842,11 @@ void MainWindow::UpdateScalar(){
|
||||||
|
|
||||||
//=========== another method, directly readValue
|
//=========== another method, directly readValue
|
||||||
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){
|
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
std::string timeStr = digi[iDigi]->ReadValue(PHA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount
|
std::string timeStr = digi[iDigi]->ReadValue(PHA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount
|
||||||
haha[ch] = digi[iDigi]->ReadValue(PHA::CH::SelfTrgRate, ch);
|
haha[ch] = digi[iDigi]->ReadValue(PHA::CH::SelfTrgRate, ch);
|
||||||
std::string kakaStr = digi[iDigi]->ReadValue(PHA::CH::ChannelSavedCount, ch);
|
std::string kakaStr = digi[iDigi]->ReadValue(PHA::CH::ChannelSavedCount, ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
|
|
||||||
unsigned long kaka = std::stoul(kakaStr.c_str()) ;
|
unsigned long kaka = std::stoul(kakaStr.c_str()) ;
|
||||||
unsigned long time = std::stoul(timeStr.c_str()) ;
|
unsigned long time = std::stoul(timeStr.c_str()) ;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <time.h> // time in nano-sec
|
#include <time.h> // time in nano-sec
|
||||||
|
|
||||||
|
#include "macro.h"
|
||||||
#include "ClassDigitizer2Gen.h"
|
#include "ClassDigitizer2Gen.h"
|
||||||
#include "influxdb.h"
|
#include "influxdb.h"
|
||||||
|
|
||||||
|
|
12
manyThread.h
12
manyThread.h
|
@ -5,25 +5,28 @@
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
|
#include "macro.h"
|
||||||
#include "ClassDigitizer2Gen.h"
|
#include "ClassDigitizer2Gen.h"
|
||||||
|
#include "macro.h"
|
||||||
|
|
||||||
static QMutex digiMTX;
|
static QMutex digiMTX[MaxNumberOfDigitizer];
|
||||||
|
|
||||||
//^#===================================================== ReadData Thread
|
//^#===================================================== ReadData Thread
|
||||||
class ReadDataThread : public QThread {
|
class ReadDataThread : public QThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ReadDataThread(Digitizer2Gen * dig, QObject * parent = 0) : QThread(parent){
|
ReadDataThread(Digitizer2Gen * dig, int digiID, QObject * parent = 0) : QThread(parent){
|
||||||
this->digi = dig;
|
this->digi = dig;
|
||||||
|
this->ID = digiID;
|
||||||
isSaveData = false;
|
isSaveData = false;
|
||||||
}
|
}
|
||||||
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
||||||
void run(){
|
void run(){
|
||||||
clock_gettime(CLOCK_REALTIME, &ta);
|
clock_gettime(CLOCK_REALTIME, &ta);
|
||||||
while(true){
|
while(true){
|
||||||
digiMTX.lock();
|
digiMTX[ID].lock();
|
||||||
int ret = digi->ReadData();
|
int ret = digi->ReadData();
|
||||||
digiMTX.unlock();
|
digiMTX[ID].unlock();
|
||||||
|
|
||||||
if( ret == CAEN_FELib_Success){
|
if( ret == CAEN_FELib_Success){
|
||||||
if( isSaveData) digi->SaveDataToFile();
|
if( isSaveData) digi->SaveDataToFile();
|
||||||
|
@ -54,6 +57,7 @@ signals:
|
||||||
//void checkFileSize();
|
//void checkFileSize();
|
||||||
private:
|
private:
|
||||||
Digitizer2Gen * digi;
|
Digitizer2Gen * digi;
|
||||||
|
int ID;
|
||||||
timespec ta, tb;
|
timespec ta, tb;
|
||||||
bool isSaveData;
|
bool isSaveData;
|
||||||
};
|
};
|
||||||
|
|
79
scope.cpp
79
scope.cpp
|
@ -81,12 +81,12 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
if( !allowChange ) return;
|
if( !allowChange ) return;
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
||||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
||||||
ReadScopeSettings();
|
ReadScopeSettings();
|
||||||
UpdateSettingsPanel();
|
UpdateSettingsPanel();
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
allowChange = false;
|
allowChange = false;
|
||||||
|
@ -143,9 +143,9 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
if( chkSetAllChannel->isChecked() ) ch = -1;
|
if( chkSetAllChannel->isChecked() ) ch = -1;
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveAnalogProbe0, (cbAnaProbe[0]->currentData()).toString().toStdString(), ch);
|
digi[iDigi]->WriteValue(PHA::CH::WaveAnalogProbe0, (cbAnaProbe[0]->currentData()).toString().toStdString(), ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(cbAnaProbe[1], &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbAnaProbe[1], &RComboBox::currentIndexChanged, this, [=](){
|
||||||
|
@ -153,9 +153,9 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
if( chkSetAllChannel->isChecked() ) ch = -1;
|
if( chkSetAllChannel->isChecked() ) ch = -1;
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveAnalogProbe1, (cbAnaProbe[1]->currentData()).toString().toStdString(), ch);
|
digi[iDigi]->WriteValue(PHA::CH::WaveAnalogProbe1, (cbAnaProbe[1]->currentData()).toString().toStdString(), ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
//TODO --- add None
|
//TODO --- add None
|
||||||
|
@ -190,36 +190,36 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
if( chkSetAllChannel->isChecked() ) ch = -1;
|
if( chkSetAllChannel->isChecked() ) ch = -1;
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe0, (cbDigProbe[0]->currentData()).toString().toStdString(), ch);
|
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe0, (cbDigProbe[0]->currentData()).toString().toStdString(), ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
connect(cbDigProbe[1], &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbDigProbe[1], &RComboBox::currentIndexChanged, this, [=](){
|
||||||
if( !allowChange ) return;
|
if( !allowChange ) return;
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
if( chkSetAllChannel->isChecked() ) ch = -1;
|
if( chkSetAllChannel->isChecked() ) ch = -1;
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe1, (cbDigProbe[1]->currentData()).toString().toStdString(), ch);
|
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe1, (cbDigProbe[1]->currentData()).toString().toStdString(), ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
connect(cbDigProbe[2], &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbDigProbe[2], &RComboBox::currentIndexChanged, this, [=](){
|
||||||
if( !allowChange ) return;
|
if( !allowChange ) return;
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
if( chkSetAllChannel->isChecked() ) ch = -1;
|
if( chkSetAllChannel->isChecked() ) ch = -1;
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe2, (cbDigProbe[2]->currentData()).toString().toStdString(), ch);
|
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe2, (cbDigProbe[2]->currentData()).toString().toStdString(), ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
connect(cbDigProbe[3], &RComboBox::currentIndexChanged, this, [=](){
|
connect(cbDigProbe[3], &RComboBox::currentIndexChanged, this, [=](){
|
||||||
if( !allowChange ) return;
|
if( !allowChange ) return;
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
int iDigi = cbScopeDigi->currentIndex();
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
if( chkSetAllChannel->isChecked() ) ch = -1;
|
if( chkSetAllChannel->isChecked() ) ch = -1;
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe3, (cbDigProbe[3]->currentData()).toString().toStdString(), ch);
|
digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe3, (cbDigProbe[3]->currentData()).toString().toStdString(), ch);
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
});
|
});
|
||||||
|
|
||||||
layout->addWidget(cbAnaProbe[0], rowID, 0);
|
layout->addWidget(cbAnaProbe[0], rowID, 0);
|
||||||
|
@ -286,7 +286,6 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
QLabel * lbinfo2 = new QLabel("Maximum time range is " + QString::number(MaxDisplayTraceDataLength * PHA::TraceStep) + " ns due to processing speed.", this);
|
QLabel * lbinfo2 = new QLabel("Maximum time range is " + QString::number(MaxDisplayTraceDataLength * PHA::TraceStep) + " ns due to processing speed.", this);
|
||||||
layout->addWidget(lbinfo2, rowID, 0, 1, 5);
|
layout->addWidget(lbinfo2, rowID, 0, 1, 5);
|
||||||
|
|
||||||
|
|
||||||
//------------ close button
|
//------------ close button
|
||||||
rowID ++;
|
rowID ++;
|
||||||
bnScopeStart = new QPushButton("Start", this);
|
bnScopeStart = new QPushButton("Start", this);
|
||||||
|
@ -318,17 +317,12 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope::~Scope(){
|
Scope::~Scope(){
|
||||||
|
|
||||||
updateTraceThread->Stop();
|
updateTraceThread->Stop();
|
||||||
updateTraceThread->quit();
|
updateTraceThread->quit();
|
||||||
updateTraceThread->wait();
|
updateTraceThread->wait();
|
||||||
delete updateTraceThread;
|
delete updateTraceThread;
|
||||||
|
|
||||||
|
|
||||||
for( int i = 0; i < 6; i++) delete dataTrace[i];
|
for( int i = 0; i < 6; i++) delete dataTrace[i];
|
||||||
|
|
||||||
delete plot;
|
delete plot;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ReadScopeSettings(){
|
void Scope::ReadScopeSettings(){
|
||||||
|
@ -338,8 +332,6 @@ void Scope::ReadScopeSettings(){
|
||||||
|
|
||||||
if( !digi[iDigi] && digi[iDigi]->IsDummy() ) return;
|
if( !digi[iDigi] && digi[iDigi]->IsDummy() ) return;
|
||||||
|
|
||||||
printf("%s\n", __func__);
|
|
||||||
|
|
||||||
allowChange = false;
|
allowChange = false;
|
||||||
|
|
||||||
for( int i = 0 ; i < 2; i++){
|
for( int i = 0 ; i < 2; i++){
|
||||||
|
@ -390,12 +382,10 @@ void Scope::StartScope(){
|
||||||
|
|
||||||
if( !digi ) return;
|
if( !digi ) return;
|
||||||
|
|
||||||
int iDigi = cbScopeDigi->currentIndex();
|
for( int iDigi = 0 ; iDigi < nDigi; iDigi ++ ){
|
||||||
|
|
||||||
if( digi[iDigi]->IsDummy() ) return;
|
if( digi[iDigi]->IsDummy() ) return;
|
||||||
|
|
||||||
printf("%s\n", __func__);
|
|
||||||
|
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
|
|
||||||
//*---- set digitizer to take full trace; since in scope mode, no data saving, speed would be fast (How fast?)
|
//*---- set digitizer to take full trace; since in scope mode, no data saving, speed would be fast (How fast?)
|
||||||
|
@ -416,7 +406,8 @@ void Scope::StartScope(){
|
||||||
|
|
||||||
ScopeControlOnOff(false);
|
ScopeControlOnOff(false);
|
||||||
emit TellSettingsPanelControlOnOff();
|
emit TellSettingsPanelControlOnOff();
|
||||||
|
}
|
||||||
|
emit TellACQOnOff(true);
|
||||||
allowChange = true;
|
allowChange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,15 +422,16 @@ void Scope::StopScope(){
|
||||||
if(digi){
|
if(digi){
|
||||||
for(int i = 0; i < nDigi; i++){
|
for(int i = 0; i < nDigi; i++){
|
||||||
if( digi[i]->IsDummy() ) continue;
|
if( digi[i]->IsDummy() ) continue;
|
||||||
digiMTX.lock();
|
digiMTX[i].lock();
|
||||||
digi[i]->StopACQ();
|
digi[i]->StopACQ();
|
||||||
digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1);
|
digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1);
|
||||||
digiMTX.unlock();
|
digiMTX[i].unlock();
|
||||||
|
|
||||||
readDataThread[i]->quit();
|
readDataThread[i]->quit();
|
||||||
readDataThread[i]->wait();
|
readDataThread[i]->wait();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit TellACQOnOff(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopeControlOnOff(true);
|
ScopeControlOnOff(true);
|
||||||
|
@ -458,23 +450,26 @@ void Scope::UpdateScope(){
|
||||||
|
|
||||||
if( digi ){
|
if( digi ){
|
||||||
|
|
||||||
digiMTX.lock();
|
digiMTX[iDigi].lock();
|
||||||
std::string time = digi[iDigi]->ReadValue(PHA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount
|
std::string time = digi[iDigi]->ReadValue(PHA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount
|
||||||
std::string haha = digi[iDigi]->ReadValue(PHA::CH::SelfTrgRate, ch);
|
std::string haha = digi[iDigi]->ReadValue(PHA::CH::SelfTrgRate, ch);
|
||||||
leTriggerRate->setText(QString::fromStdString(haha));
|
leTriggerRate->setText(QString::fromStdString(haha));
|
||||||
if( atoi(haha.c_str()) == 0 ) {
|
|
||||||
digiMTX.unlock();
|
|
||||||
|
|
||||||
for( int j = 0; j < 4; j++){
|
//unsigned int traceLength = qMin((int) digi[iDigi]->evt->traceLenght, MaxDisplayTraceDataLength);
|
||||||
|
unsigned int traceLength = qMin( atoi(digi[iDigi]->GetSettingValue(PHA::CH::RecordLength, ch).c_str())/sample2ns, MaxDisplayTraceDataLength );
|
||||||
|
|
||||||
|
if( atoi(haha.c_str()) == 0 ) {
|
||||||
|
digiMTX[iDigi].unlock();
|
||||||
|
|
||||||
|
for( int j = 0; j < 6; j++){
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
for( int i = 0 ; i < dataTrace[j]->count(); i++) points.append(QPointF(sample2ns * i , j > 1 ? 0 : (j+1)*1000));
|
for( unsigned int i = 0 ; i < traceLength; i++) points.append(QPointF(sample2ns * i , j > 1 ? 0 : (j+1)*1000));
|
||||||
dataTrace[j]->replace(points);
|
dataTrace[j]->replace(points);
|
||||||
}
|
}
|
||||||
|
plot->axes(Qt::Horizontal).first()->setRange(0, sample2ns * traceLength);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int traceLength = qMin((int) digi[iDigi]->evt->traceLenght, MaxDisplayTraceDataLength);
|
|
||||||
|
|
||||||
for( int j = 0; j < 2; j++) {
|
for( int j = 0; j < 2; j++) {
|
||||||
QVector<QPointF> points;
|
QVector<QPointF> points;
|
||||||
for( unsigned int i = 0 ; i < traceLength; i++) points.append(QPointF(sample2ns * i , digi[iDigi]->evt->analog_probes[j][i]));
|
for( unsigned int i = 0 ; i < traceLength; i++) points.append(QPointF(sample2ns * i , digi[iDigi]->evt->analog_probes[j][i]));
|
||||||
|
@ -485,7 +480,7 @@ void Scope::UpdateScope(){
|
||||||
for( unsigned int i = 0 ; i < traceLength; i++) points.append(QPointF(sample2ns * i , (j+1)*1000 + 4000*digi[iDigi]->evt->digital_probes[j][i]));
|
for( unsigned int i = 0 ; i < traceLength; i++) points.append(QPointF(sample2ns * i , (j+1)*1000 + 4000*digi[iDigi]->evt->digital_probes[j][i]));
|
||||||
dataTrace[j+2]->replace(points);
|
dataTrace[j+2]->replace(points);
|
||||||
}
|
}
|
||||||
digiMTX.unlock();
|
digiMTX[iDigi].unlock();
|
||||||
plot->axes(Qt::Horizontal).first()->setRange(0, sample2ns * traceLength);
|
plot->axes(Qt::Horizontal).first()->setRange(0, sample2ns * traceLength);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -494,6 +489,7 @@ void Scope::UpdateScope(){
|
||||||
|
|
||||||
void Scope::ProbeChange(RComboBox * cb[], const int size ){
|
void Scope::ProbeChange(RComboBox * cb[], const int size ){
|
||||||
|
|
||||||
|
printf("%s\n", __func__);
|
||||||
QStandardItemModel * model[size] = {NULL};
|
QStandardItemModel * model[size] = {NULL};
|
||||||
for( int i = 0; i < size; i++){
|
for( int i = 0; i < size; i++){
|
||||||
model[i] = qobject_cast<QStandardItemModel*>(cb[i]->model());
|
model[i] = qobject_cast<QStandardItemModel*>(cb[i]->model());
|
||||||
|
@ -512,20 +508,21 @@ void Scope::ProbeChange(RComboBox * cb[], const int size ){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
digiMTX.lock();
|
int ID = cbScopeDigi->currentIndex();
|
||||||
|
digiMTX[ID].lock();
|
||||||
if( size == 2) {// analog probes
|
if( size == 2) {// analog probes
|
||||||
for( int j = 0; j < 2; j++ )dataTrace[j]->setName(cb[j]->currentText());
|
for( int j = 0; j < 2; j++ )dataTrace[j]->setName(cb[j]->currentText());
|
||||||
}
|
}
|
||||||
if( size == 4){ // digitial probes
|
if( size == 4){ // digitial probes
|
||||||
for( int j = 2; j < 6; j++ )dataTrace[j]->setName(cb[j-2]->currentText());
|
for( int j = 2; j < 6; j++ )dataTrace[j]->setName(cb[j-2]->currentText());
|
||||||
}
|
}
|
||||||
digiMTX.unlock();
|
digiMTX[ID].unlock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ScopeControlOnOff(bool on){
|
void Scope::ScopeControlOnOff(bool on){
|
||||||
bnScopeStop->setEnabled(!on);
|
|
||||||
|
|
||||||
|
bnScopeStop->setEnabled(!on);
|
||||||
bnScopeStart->setEnabled(on);
|
bnScopeStart->setEnabled(on);
|
||||||
bnScopeReset->setEnabled(on);
|
bnScopeReset->setEnabled(on);
|
||||||
bnScopeReadSettings->setEnabled(on);
|
bnScopeReadSettings->setEnabled(on);
|
||||||
|
@ -549,6 +546,7 @@ void Scope::ScopeControlOnOff(bool on){
|
||||||
sbPileUpGuard->setEnabled(on);
|
sbPileUpGuard->setEnabled(on);
|
||||||
cbBaselineAvg->setEnabled(on);
|
cbBaselineAvg->setEnabled(on);
|
||||||
cbLowFreqFilter->setEnabled(on);
|
cbLowFreqFilter->setEnabled(on);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara){
|
void Scope::ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara){
|
||||||
|
@ -567,6 +565,7 @@ void Scope::ScopeReadComboBoxValue(int iDigi, int ch, RComboBox *cb, const Reg d
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::ScopeMakeSpinBox(RSpinBox * &sb, QString str, QGridLayout *layout, int row, int col, const Reg digPara){
|
void Scope::ScopeMakeSpinBox(RSpinBox * &sb, QString str, QGridLayout *layout, int row, int col, const Reg digPara){
|
||||||
|
printf("%s\n", __func__);
|
||||||
QLabel * lb = new QLabel(str, this);
|
QLabel * lb = new QLabel(str, this);
|
||||||
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||||
layout->addWidget(lb, row, col);
|
layout->addWidget(lb, row, col);
|
||||||
|
|
2
scope.h
2
scope.h
|
@ -16,6 +16,7 @@
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QGestureEvent>
|
#include <QGestureEvent>
|
||||||
|
|
||||||
|
#include "macro.h"
|
||||||
#include "ClassDigitizer2Gen.h"
|
#include "ClassDigitizer2Gen.h"
|
||||||
#include "manyThread.h"
|
#include "manyThread.h"
|
||||||
#include "CustomWidgets.h"
|
#include "CustomWidgets.h"
|
||||||
|
@ -133,6 +134,7 @@ signals:
|
||||||
void UpdateScalar();
|
void UpdateScalar();
|
||||||
void UpdateSettingsPanel();
|
void UpdateSettingsPanel();
|
||||||
void TellSettingsPanelControlOnOff();
|
void TellSettingsPanelControlOnOff();
|
||||||
|
void TellACQOnOff(const bool onOff);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user