fix display bug on QDC scope RecordLength
This commit is contained in:
parent
513608e991
commit
952b352e8a
|
@ -1943,7 +1943,7 @@ void MainWindow::CheckElog(){
|
||||||
if( elogName == "" ) LogMsg("no elog Name");
|
if( elogName == "" ) LogMsg("no elog Name");
|
||||||
if( elogUser == "" ) LogMsg("no elog User name. Please set it in the programSettings.txt, line 6.");
|
if( elogUser == "" ) LogMsg("no elog User name. Please set it in the programSettings.txt, line 6.");
|
||||||
if( elogPWD == "" ) LogMsg("no elog User pwd. Please set it in the programSettings.txt, line 7.");
|
if( elogPWD == "" ) LogMsg("no elog User pwd. Please set it in the programSettings.txt, line 7.");
|
||||||
if( elogID < 0 ) LogMsg("Possible elog IP, Name, User name, or pwd incorrect");
|
if( elogID < 0 ) LogMsg("Possible elog IP, Name, User name, pwd incorrect, or elog not installed.");
|
||||||
leElogIP->setEnabled(false);
|
leElogIP->setEnabled(false);
|
||||||
leElogName->setEnabled(false);
|
leElogName->setEnabled(false);
|
||||||
|
|
||||||
|
|
120
Scope.cpp
120
Scope.cpp
|
@ -68,31 +68,6 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
plot->addSeries(dataTrace[i]);
|
plot->addSeries(dataTrace[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// testing software trapezoid filter
|
|
||||||
// FILE * fileIn = fopen("wave.txt", "r");
|
|
||||||
// if( fileIn != nullptr ){
|
|
||||||
|
|
||||||
// char buf[500];
|
|
||||||
// int v1, v2;
|
|
||||||
|
|
||||||
// QVector<QPointF> points;
|
|
||||||
// QVector<QPointF> points1;
|
|
||||||
// while( fgets(buf, sizeof(buf), fileIn) != nullptr ){
|
|
||||||
|
|
||||||
// if (sscanf(buf, "%d, %d", &v1, &v2) == 2) {
|
|
||||||
// points.append(QPointF(v1, v2 + 7000));
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fclose(fileIn);
|
|
||||||
|
|
||||||
// points1 = TrapezoidFilter(points, 400/16, 100, 200, 1000);
|
|
||||||
|
|
||||||
// dataTrace[0]->replace(points);
|
|
||||||
// dataTrace[1]->replace(points1);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
dataTrace[0]->setPen(QPen(Qt::red, 2));
|
dataTrace[0]->setPen(QPen(Qt::red, 2));
|
||||||
dataTrace[1]->setPen(QPen(Qt::blue, 2));
|
dataTrace[1]->setPen(QPen(Qt::blue, 2));
|
||||||
dataTrace[2]->setPen(QPen(Qt::darkYellow, 1));
|
dataTrace[2]->setPen(QPen(Qt::darkYellow, 1));
|
||||||
|
@ -191,7 +166,6 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
bnReadSettingsFromBoard = new QPushButton("Refresh Settings", this);
|
bnReadSettingsFromBoard = new QPushButton("Refresh Settings", this);
|
||||||
layout->addWidget(bnReadSettingsFromBoard, rowID, 2);
|
layout->addWidget(bnReadSettingsFromBoard, rowID, 2);
|
||||||
connect(bnReadSettingsFromBoard, &QPushButton::clicked, this, &Scope::ReadSettingsFromBoard);
|
connect(bnReadSettingsFromBoard, &QPushButton::clicked, this, &Scope::ReadSettingsFromBoard);
|
||||||
|
@ -257,18 +231,21 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
layout->addWidget(bnScopeStart, rowID, 0);
|
layout->addWidget(bnScopeStart, rowID, 0);
|
||||||
connect(bnScopeStart, &QPushButton::clicked, this, [=](){this->StartScope();});
|
connect(bnScopeStart, &QPushButton::clicked, this, [=](){this->StartScope();});
|
||||||
|
|
||||||
|
chkSoleRun = new QCheckBox("Only this channel", this);
|
||||||
|
layout->addWidget(chkSoleRun, rowID, 1);
|
||||||
|
|
||||||
bnScopeStop = new QPushButton("Stop", this);
|
bnScopeStop = new QPushButton("Stop", this);
|
||||||
layout->addWidget(bnScopeStop, rowID, 1);
|
layout->addWidget(bnScopeStop, rowID, 2);
|
||||||
connect(bnScopeStop, &QPushButton::clicked, this, &Scope::StopScope);
|
connect(bnScopeStop, &QPushButton::clicked, this, &Scope::StopScope);
|
||||||
|
|
||||||
QLabel * lbTriggerRate = new QLabel("Trigger Rate [Hz] : ", this);
|
QLabel * lbTriggerRate = new QLabel("Trigger Rate [Hz] : ", this);
|
||||||
lbTriggerRate->setAlignment(Qt::AlignCenter | Qt::AlignRight);
|
lbTriggerRate->setAlignment(Qt::AlignCenter | Qt::AlignRight);
|
||||||
layout->addWidget(lbTriggerRate, rowID, 2);
|
layout->addWidget(lbTriggerRate, rowID, 3);
|
||||||
|
|
||||||
leTriggerRate = new QLineEdit(this);
|
leTriggerRate = new QLineEdit(this);
|
||||||
leTriggerRate->setAlignment(Qt::AlignRight);
|
leTriggerRate->setAlignment(Qt::AlignRight);
|
||||||
leTriggerRate->setReadOnly(true);
|
leTriggerRate->setReadOnly(true);
|
||||||
layout->addWidget(leTriggerRate, rowID, 3);
|
layout->addWidget(leTriggerRate, rowID, 4);
|
||||||
|
|
||||||
QPushButton * bnClose = new QPushButton("Close", this);
|
QPushButton * bnClose = new QPushButton("Close", this);
|
||||||
layout->addWidget(bnClose, rowID, 6);
|
layout->addWidget(bnClose, rowID, 6);
|
||||||
|
@ -365,6 +342,54 @@ void Scope::StartScope(){
|
||||||
//TODO set other channel to be no trace;
|
//TODO set other channel to be no trace;
|
||||||
emit UpdateOtherPanels();
|
emit UpdateOtherPanels();
|
||||||
|
|
||||||
|
if( chkSoleRun->isChecked() ){
|
||||||
|
|
||||||
|
int ID = cbScopeDigi->currentIndex();
|
||||||
|
int ch = cbScopeCh->currentIndex();
|
||||||
|
|
||||||
|
//save present settings, channleMap, trigger condition
|
||||||
|
traceOn[ID] = digi[ID]->IsRecordTrace();
|
||||||
|
digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
||||||
|
|
||||||
|
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PHA_CODE ){
|
||||||
|
dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
|
||||||
|
dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch);
|
||||||
|
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
|
||||||
|
|
||||||
|
digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 0, ch);
|
||||||
|
digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger, 0, ch);
|
||||||
|
|
||||||
|
digi[ID]->SetBits(DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 0, ch);
|
||||||
|
digi[ID]->SetBits(DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode, 0, ch);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PSD_CODE ){
|
||||||
|
dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
|
||||||
|
dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PSD::DPPAlgorithmControl2_G, ch);
|
||||||
|
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
|
||||||
|
//TODO ===============
|
||||||
|
}
|
||||||
|
|
||||||
|
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_QDC_CODE ){
|
||||||
|
dppAlg = digi[ID]->GetSettingFromMemory(DPP::QDC::DPPAlgorithmControl, ch);
|
||||||
|
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
|
||||||
|
//TODO ===============
|
||||||
|
}
|
||||||
|
|
||||||
|
digi[ID]->WriteRegister(DPP::RegChannelEnableMask, (1 << ch));
|
||||||
|
|
||||||
|
//=========== start
|
||||||
|
digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||||
|
|
||||||
|
readDataThread[ID]->SetScopeMode(true);
|
||||||
|
readDataThread[ID]->SetSaveData(false);
|
||||||
|
|
||||||
|
digi[ID]->StartACQ();
|
||||||
|
readDataThread[ID]->start();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
for( int iDigi = (int)nDigi-1 ; iDigi >= 0; iDigi --){
|
for( int iDigi = (int)nDigi-1 ; iDigi >= 0; iDigi --){
|
||||||
|
|
||||||
traceOn[iDigi] = digi[iDigi]->IsRecordTrace(); //remember setting
|
traceOn[iDigi] = digi[iDigi]->IsRecordTrace(); //remember setting
|
||||||
|
@ -381,13 +406,15 @@ void Scope::StartScope(){
|
||||||
|
|
||||||
digi[iDigi]->StartACQ();
|
digi[iDigi]->StartACQ();
|
||||||
|
|
||||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
// if( readDataThread[iDigi]->isRunning() ){
|
// if( readDataThread[iDigi]->isRunning() ){
|
||||||
// readDataThread[iDigi]->quit();
|
// readDataThread[iDigi]->quit();
|
||||||
// readDataThread[iDigi]->wait();
|
// readDataThread[iDigi]->wait();
|
||||||
// }
|
// }
|
||||||
readDataThread[iDigi]->start();
|
readDataThread[iDigi]->start();
|
||||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTraceThread->start();
|
updateTraceThread->start();
|
||||||
|
@ -398,6 +425,8 @@ void Scope::StartScope(){
|
||||||
bnScopeStop->setEnabled(true);
|
bnScopeStop->setEnabled(true);
|
||||||
bnScopeStop->setStyleSheet("background-color: red;");
|
bnScopeStop->setStyleSheet("background-color: red;");
|
||||||
|
|
||||||
|
chkSoleRun->setEnabled(false);
|
||||||
|
|
||||||
EnableControl(false);
|
EnableControl(false);
|
||||||
|
|
||||||
TellACQOnOff(true);
|
TellACQOnOff(true);
|
||||||
|
@ -419,12 +448,36 @@ void Scope::StopScope(){
|
||||||
updateScalarThread->quit();
|
updateScalarThread->quit();
|
||||||
updateScalarThread->exit();
|
updateScalarThread->exit();
|
||||||
|
|
||||||
|
if( chkSoleRun->isChecked() ){
|
||||||
|
|
||||||
|
int ID = cbScopeDigi->currentIndex();
|
||||||
|
|
||||||
|
if( readDataThread[ID]->isRunning() ){
|
||||||
|
readDataThread[ID]->Stop();
|
||||||
|
readDataThread[ID]->quit();
|
||||||
|
readDataThread[ID]->wait();
|
||||||
|
readDataThread[ID]->SetScopeMode(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
digiMTX[ID].lock();
|
||||||
|
digi[ID]->StopACQ();
|
||||||
|
digi[ID]->ReadACQStatus();
|
||||||
|
digiMTX[ID].unlock();
|
||||||
|
|
||||||
|
//restore setting
|
||||||
|
digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[ID], -1);
|
||||||
|
//TODO =============
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
||||||
|
|
||||||
if( readDataThread[iDigi]->isRunning() ){
|
if( readDataThread[iDigi]->isRunning() ){
|
||||||
readDataThread[iDigi]->Stop();
|
readDataThread[iDigi]->Stop();
|
||||||
readDataThread[iDigi]->quit();
|
readDataThread[iDigi]->quit();
|
||||||
readDataThread[iDigi]->wait();
|
readDataThread[iDigi]->wait();
|
||||||
|
readDataThread[iDigi]->SetScopeMode(false);
|
||||||
}
|
}
|
||||||
digiMTX[iDigi].lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->StopACQ();
|
digi[iDigi]->StopACQ();
|
||||||
|
@ -437,6 +490,8 @@ void Scope::StopScope(){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
emit UpdateOtherPanels();
|
emit UpdateOtherPanels();
|
||||||
|
|
||||||
bnScopeStart->setEnabled(true);
|
bnScopeStart->setEnabled(true);
|
||||||
|
@ -444,6 +499,7 @@ void Scope::StopScope(){
|
||||||
bnScopeStop->setEnabled(false);
|
bnScopeStop->setEnabled(false);
|
||||||
bnScopeStop->setStyleSheet("");
|
bnScopeStop->setStyleSheet("");
|
||||||
|
|
||||||
|
chkSoleRun->setEnabled(true);
|
||||||
runStatus->setStyleSheet("");
|
runStatus->setStyleSheet("");
|
||||||
|
|
||||||
EnableControl(true);
|
EnableControl(true);
|
||||||
|
@ -1230,7 +1286,7 @@ void Scope::UpdatePanel_QDC(){
|
||||||
sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 );
|
sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 );
|
||||||
|
|
||||||
//UpdateSpinBox(sbReordLength, DPP::QDC::RecordLength);
|
//UpdateSpinBox(sbReordLength, DPP::QDC::RecordLength);
|
||||||
sbReordLength->setValue(digi[ID]->ReadQDCRecordLength());
|
sbReordLength->setValue(digi[ID]->ReadQDCRecordLength() * 8 * 16);
|
||||||
UpdateSpinBox(sbPreTrigger, DPP::QDC::PreTrigger);
|
UpdateSpinBox(sbPreTrigger, DPP::QDC::PreTrigger);
|
||||||
|
|
||||||
UpdateSpinBox(sbShortGate, DPP::QDC::GateWidth);
|
UpdateSpinBox(sbShortGate, DPP::QDC::GateWidth);
|
||||||
|
|
5
Scope.h
5
Scope.h
|
@ -80,9 +80,11 @@ private:
|
||||||
bool isACQStarted;
|
bool isACQStarted;
|
||||||
int tick2ns;
|
int tick2ns;
|
||||||
int factor; // whether dual trace or not
|
int factor; // whether dual trace or not
|
||||||
bool traceOn[MaxNDigitizer];
|
|
||||||
int AggPerRead[MaxNDigitizer];
|
int AggPerRead[MaxNDigitizer];
|
||||||
|
|
||||||
|
bool traceOn[MaxNDigitizer];
|
||||||
|
uint32_t dppAlg, dppAlg2, chMask; //for single channel run
|
||||||
|
|
||||||
ReadDataThread ** readDataThread;
|
ReadDataThread ** readDataThread;
|
||||||
TimingThread * updateTraceThread;
|
TimingThread * updateTraceThread;
|
||||||
TimingThread * updateScalarThread;
|
TimingThread * updateScalarThread;
|
||||||
|
@ -105,6 +107,7 @@ private:
|
||||||
QGroupBox * settingGroup;
|
QGroupBox * settingGroup;
|
||||||
QGridLayout * settingLayout;
|
QGridLayout * settingLayout;
|
||||||
|
|
||||||
|
QCheckBox * chkSoleRun;
|
||||||
QPushButton * runStatus;
|
QPushButton * runStatus;
|
||||||
|
|
||||||
/// common to PSD and PHA
|
/// common to PSD and PHA
|
||||||
|
|
Loading…
Reference in New Issue
Block a user