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);
|
||||||
|
|
||||||
|
|
176
Scope.cpp
176
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,29 +342,79 @@ void Scope::StartScope(){
|
||||||
//TODO set other channel to be no trace;
|
//TODO set other channel to be no trace;
|
||||||
emit UpdateOtherPanels();
|
emit UpdateOtherPanels();
|
||||||
|
|
||||||
for( int iDigi = (int)nDigi-1 ; iDigi >= 0; iDigi --){
|
if( chkSoleRun->isChecked() ){
|
||||||
|
|
||||||
traceOn[iDigi] = digi[iDigi]->IsRecordTrace(); //remember setting
|
int ID = cbScopeDigi->currentIndex();
|
||||||
SendLogMsg("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()) + " is starting ACQ." );
|
int ch = cbScopeCh->currentIndex();
|
||||||
digi[iDigi]->WriteRegister(DPP::SoftwareClear_W, 1);
|
|
||||||
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
|
||||||
|
|
||||||
//AggPerRead[iDigi] = digi[iDigi]->GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer);
|
//save present settings, channleMap, trigger condition
|
||||||
//SendLogMsg("Set Agg/Read to 1 for scope, it was " + QString::number(AggPerRead[iDigi]) + ".");
|
traceOn[ID] = digi[ID]->IsRecordTrace();
|
||||||
//digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, 1);
|
digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
||||||
|
|
||||||
readDataThread[iDigi]->SetScopeMode(true);
|
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PHA_CODE ){
|
||||||
readDataThread[iDigi]->SetSaveData(false);
|
dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
|
||||||
|
dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch);
|
||||||
|
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
|
||||||
|
|
||||||
digi[iDigi]->StartACQ();
|
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 --){
|
||||||
|
|
||||||
|
traceOn[iDigi] = digi[iDigi]->IsRecordTrace(); //remember setting
|
||||||
|
SendLogMsg("Digi-" + QString::number(digi[iDigi]->GetSerialNumber()) + " is starting ACQ." );
|
||||||
|
digi[iDigi]->WriteRegister(DPP::SoftwareClear_W, 1);
|
||||||
|
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
|
||||||
|
|
||||||
|
//AggPerRead[iDigi] = digi[iDigi]->GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer);
|
||||||
|
//SendLogMsg("Set Agg/Read to 1 for scope, it was " + QString::number(AggPerRead[iDigi]) + ".");
|
||||||
|
//digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, 1);
|
||||||
|
|
||||||
|
readDataThread[iDigi]->SetScopeMode(true);
|
||||||
|
readDataThread[iDigi]->SetSaveData(false);
|
||||||
|
|
||||||
|
digi[iDigi]->StartACQ();
|
||||||
|
|
||||||
|
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
|
// if( readDataThread[iDigi]->isRunning() ){
|
||||||
|
// readDataThread[iDigi]->quit();
|
||||||
|
// readDataThread[iDigi]->wait();
|
||||||
|
// }
|
||||||
|
readDataThread[iDigi]->start();
|
||||||
|
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
|
}
|
||||||
|
|
||||||
// printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
|
||||||
// if( readDataThread[iDigi]->isRunning() ){
|
|
||||||
// readDataThread[iDigi]->quit();
|
|
||||||
// readDataThread[iDigi]->wait();
|
|
||||||
// }
|
|
||||||
readDataThread[iDigi]->start();
|
|
||||||
// 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,21 +448,47 @@ void Scope::StopScope(){
|
||||||
updateScalarThread->quit();
|
updateScalarThread->quit();
|
||||||
updateScalarThread->exit();
|
updateScalarThread->exit();
|
||||||
|
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
if( chkSoleRun->isChecked() ){
|
||||||
|
|
||||||
if( readDataThread[iDigi]->isRunning() ){
|
int ID = cbScopeDigi->currentIndex();
|
||||||
readDataThread[iDigi]->Stop();
|
|
||||||
readDataThread[iDigi]->quit();
|
if( readDataThread[ID]->isRunning() ){
|
||||||
readDataThread[iDigi]->wait();
|
readDataThread[ID]->Stop();
|
||||||
|
readDataThread[ID]->quit();
|
||||||
|
readDataThread[ID]->wait();
|
||||||
|
readDataThread[ID]->SetScopeMode(false);
|
||||||
}
|
}
|
||||||
digiMTX[iDigi].lock();
|
|
||||||
digi[iDigi]->StopACQ();
|
|
||||||
digi[iDigi]->ReadACQStatus();
|
|
||||||
//digi[iDigi]->GetData()->PrintAllData();
|
|
||||||
digiMTX[iDigi].unlock();
|
|
||||||
|
|
||||||
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
|
digiMTX[ID].lock();
|
||||||
//digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, AggPerRead[iDigi]);
|
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 ++){
|
||||||
|
|
||||||
|
if( readDataThread[iDigi]->isRunning() ){
|
||||||
|
readDataThread[iDigi]->Stop();
|
||||||
|
readDataThread[iDigi]->quit();
|
||||||
|
readDataThread[iDigi]->wait();
|
||||||
|
readDataThread[iDigi]->SetScopeMode(false);
|
||||||
|
}
|
||||||
|
digiMTX[iDigi].lock();
|
||||||
|
digi[iDigi]->StopACQ();
|
||||||
|
digi[iDigi]->ReadACQStatus();
|
||||||
|
//digi[iDigi]->GetData()->PrintAllData();
|
||||||
|
digiMTX[iDigi].unlock();
|
||||||
|
|
||||||
|
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
|
||||||
|
//digi[iDigi]->WriteRegister(DPP::MaxAggregatePerBlockTransfer, AggPerRead[iDigi]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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