simplify code and check Scope panel, still have some settings to add

This commit is contained in:
Ryan Tang 2023-02-08 19:15:13 -05:00
parent 07d02756f7
commit ba0eec863d
3 changed files with 160 additions and 184 deletions

View File

@ -371,41 +371,31 @@ void MainWindow::ReadScopeSettings(int iDigi, int ch){
printf("%s\n", __func__); printf("%s\n", __func__);
int index;
std::string ans;
allowChange = false; allowChange = false;
for( int i = 0 ; i < 2; i++){ for( int i = 0 ; i < 2; i++){
ans = digi[iDigi]->ReadChValue(std::to_string(ch), DIGIPARA::CH::AnalogProbe[i]); ScopeReadComboBoxValue(iDigi, ch, cbAnaProbe[i], DIGIPARA::CH::AnalogProbe[i]);
index = cbAnaProbe[i]->findData(QString::fromStdString(ans));
if( index >= 0 ) {
cbAnaProbe[i]->setCurrentIndex(index);
}else{
qDebug() << QString::fromStdString(ans);
}
} }
for( int i = 0 ; i < 4; i++){ for( int i = 0 ; i < 4; i++){
ans = digi[iDigi]->ReadChValue(std::to_string(ch), DIGIPARA::CH::DigitalProbe[i]); ScopeReadComboBoxValue(iDigi, ch, cbDigProbe[i], DIGIPARA::CH::DigitalProbe[i]);
index = cbDigProbe[i]->findData(QString::fromStdString(ans));
if( index >= 0 ) {
cbDigProbe[i]->setCurrentIndex(index);
}else{
qDebug() << QString::fromStdString(ans);
}
} }
ans = digi[iDigi]->ReadChValue(std::to_string(ch), DIGIPARA::CH::RecordLength); ScopeReadComboBoxValue(iDigi, ch, cbPolarity, DIGIPARA::CH::Polarity);
sbRL->setValue(atoi(ans.c_str())); ScopeReadComboBoxValue(iDigi, ch, cbWaveRes, DIGIPARA::CH::WaveResolution);
ScopeReadComboBoxValue(iDigi, ch, cbTrapPeakAvg, DIGIPARA::CH::EnergyFilterPeakingAvg);
ans = digi[iDigi]->ReadChValue(std::to_string(ch), DIGIPARA::CH::PreTrigger);
sbPT->setValue(atoi(ans.c_str()));
ans = digi[iDigi]->ReadChValue(std::to_string(ch), DIGIPARA::CH::DC_Offset);
sbDCOffset->setValue(atoi(ans.c_str()));
ScopeReadSpinBoxValue(iDigi, ch, sbRL, DIGIPARA::CH::RecordLength);
ScopeReadSpinBoxValue(iDigi, ch, sbPT, DIGIPARA::CH::PreTrigger);
ScopeReadSpinBoxValue(iDigi, ch, sbDCOffset, DIGIPARA::CH::DC_Offset);
ScopeReadSpinBoxValue(iDigi, ch, sbThreshold, DIGIPARA::CH::TriggerThreshold);
ScopeReadSpinBoxValue(iDigi, ch, sbTimeRiseTime, DIGIPARA::CH::TimeFilterRiseTime);
ScopeReadSpinBoxValue(iDigi, ch, sbTimeGuard, DIGIPARA::CH::TimeFilterRetriggerGuard);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapRiseTime, DIGIPARA::CH::EnergyFilterRiseTime);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapFlatTop, DIGIPARA::CH::EnergyFilterFlatTop);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapPoleZero, DIGIPARA::CH::EnergyFilterPoleZero);
ScopeReadSpinBoxValue(iDigi, ch, sbEnergyFineGain, DIGIPARA::CH::EnergyFilterFineGain);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapPeaking, DIGIPARA::CH::EnergyFilterPeakingPosition);
allowChange = true; allowChange = true;
} }
@ -434,16 +424,9 @@ void MainWindow::StartScope(int iDigi){
updateTraceThread->start(); updateTraceThread->start();
bnScopeStart->setEnabled(false); ScopeControlOnOff(false);
bnScopeStop->setEnabled(true);
sbRL->setEnabled(false);
sbPT->setEnabled(false);
sbDCOffset->setEnabled(false);
bnScopeReset->setEnabled(false);
allowChange = true; allowChange = true;
} }
void MainWindow::StopScope(){ void MainWindow::StopScope(){
@ -470,14 +453,8 @@ void MainWindow::StopScope(){
bnStopACQ->setEnabled(true); bnStopACQ->setEnabled(true);
} }
bnScopeStart->setEnabled(true); ScopeControlOnOff(true);
bnScopeStop->setEnabled(false); allowChange = true;
sbRL->setEnabled(true);
sbPT->setEnabled(true);
sbDCOffset->setEnabled(true);
bnScopeReset->setEnabled(true);
} }
void MainWindow::UpdateScope(){ void MainWindow::UpdateScope(){
@ -485,7 +462,7 @@ void MainWindow::UpdateScope(){
if( scope->isVisible() == false) return; if( scope->isVisible() == false) return;
int iDigi = cbScopeDigi->currentIndex(); int iDigi = cbScopeDigi->currentIndex();
//int ch = cbScopeCh->currentIndex(); int sample2ns = DIGIPARA::TraceStep * (1 << cbWaveRes->currentIndex());
if( digi ){ if( digi ){
digiMTX.lock(); digiMTX.lock();
@ -496,14 +473,13 @@ void MainWindow::UpdateScope(){
for( int j = 0; j < 6; j++ ) dataTrace[j]->removePoints(0, dataLength); for( int j = 0; j < 6; j++ ) dataTrace[j]->removePoints(0, dataLength);
for( unsigned int i = 0 ; i < traceLength; i++){ for( unsigned int i = 0 ; i < traceLength; i++){
for( int j = 0; j < 2; j++) dataTrace[j]->append(DIGIPARA::TraceStep * i, digi[iDigi]->evt->analog_probes[j][i]); for( int j = 0; j < 2; j++) dataTrace[j]->append(sample2ns * i, digi[iDigi]->evt->analog_probes[j][i]);
for( int j = 2; j < 6; j++) dataTrace[j]->append(DIGIPARA::TraceStep * i, (j-1)*1000 + 4000 * digi[iDigi]->evt->digital_probes[j-2][i]); for( int j = 2; j < 6; j++) dataTrace[j]->append(sample2ns * i, (j-1)*1000 + 4000 * digi[iDigi]->evt->digital_probes[j-2][i]);
} }
digiMTX.unlock(); digiMTX.unlock();
//plot->axes(Qt::Vertical).first()->setRange(-1, 16000); /// this must be after createDefaultAxes(); plot->axes(Qt::Horizontal).first()->setRange(0, sample2ns * traceLength);
plot->axes(Qt::Horizontal).first()->setRange(0, DIGIPARA::TraceStep* traceLength);
} }
} }
@ -537,7 +513,76 @@ void MainWindow::ProbeChange(QComboBox * cb[], const int size ){
} }
digiMTX.unlock(); digiMTX.unlock();
}
void MainWindow::ScopeControlOnOff(bool on){
bnScopeStop->setEnabled(!on);
bnScopeStart->setEnabled(on);
bnScopeReset->setEnabled(on);
bnScopeReadSettings->setEnabled(on);
sbRL->setEnabled(on);
sbPT->setEnabled(on);
sbDCOffset->setEnabled(on);
sbThreshold->setEnabled(on);
sbTimeRiseTime->setEnabled(on);
sbTimeGuard->setEnabled(on);
sbTrapRiseTime->setEnabled(on);
sbTrapFlatTop->setEnabled(on);
sbTrapPoleZero->setEnabled(on);
sbEnergyFineGain->setEnabled(on);
sbTrapPeaking->setEnabled(on);
cbPolarity->setEnabled(on);
cbWaveRes->setEnabled(on);
cbTrapPeakAvg->setEnabled(on);
}
void MainWindow::ScopeReadSpinBoxValue(int iDigi, int ch, QSpinBox *sb, std::string digPara){
std::string ans = digi[iDigi]->ReadChValue(std::to_string(ch), digPara);
sb->setValue(atoi(ans.c_str()));
}
void MainWindow::ScopeReadComboBoxValue(int iDigi, int ch, QComboBox *cb, std::string digPara){
std::string ans = digi[iDigi]->ReadChValue(std::to_string(ch), digPara);
int index = cb->findData(QString::fromStdString(ans));
if( index >= 0 && index < cb->count()) {
cb->setCurrentIndex(index);
}else{
qDebug() << QString::fromStdString(ans);
}
}
void MainWindow::ScopeMakeSpinBox(QSpinBox *sb, QString str, QGridLayout *layout, int row, int col, int min, int max, int step, std::string digPara){
QLabel * lb = new QLabel(str, scope);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
layout->addWidget(lb, row, col);
sb->setMinimum(min);
sb->setMaximum(max);
sb->setSingleStep(abs(step));
layout->addWidget(sb, row, col+1);
connect(sb, &QSpinBox::valueChanged, this, [=](){
if( !allowChange ) return;
int iDigi = cbScopeDigi->currentIndex();
if( step > 1 ) sb->setValue(step*((sb->value() + step - 1)/step));
digiMTX.lock();
digi[iDigi]->WriteChValue(std::to_string(cbScopeCh->currentIndex()), digPara, std::to_string(sb->value()));
digiMTX.unlock();
});
}
void MainWindow::ScopeMakeComoBox(QComboBox *cb, QString str, QGridLayout *layout, int row, int col, std::string digPara){
QLabel * lb = new QLabel(str, scope);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
layout->addWidget(lb, row, col);
layout->addWidget(cb, row, col+1);
connect(cb, &QComboBox::currentIndexChanged, this, [=](){
if( !allowChange ) return;
int iDigi = cbScopeDigi->currentIndex();
digiMTX.lock();
digi[iDigi]->WriteChValue(std::to_string(cbScopeCh->currentIndex()), digPara, cb->currentData().toString().toStdString());
digiMTX.unlock();
});
} }
void MainWindow::SetUpPlot(){ //@--- this function run at start up void MainWindow::SetUpPlot(){ //@--- this function run at start up
@ -615,14 +660,26 @@ void MainWindow::SetUpPlot(){ //@--- this function run at start up
digiMTX.unlock(); digiMTX.unlock();
}); });
bnScopeReset = new QPushButton("Reset Digitizer", scope); bnScopeReset = new QPushButton("ReProgram Digitizer", scope);
layout->addWidget(bnScopeReset, rowID, 2); layout->addWidget(bnScopeReset, rowID, 2);
connect(bnScopeReset, &QPushButton::clicked, this, [=](){ connect(bnScopeReset, &QPushButton::clicked, this, [=](){
if( !allowChange ) return; if( !allowChange ) return;
int iDigi = cbScopeDigi->currentIndex(); int iDigi = cbScopeDigi->currentIndex();
digi[iDigi]->Reset(); digi[iDigi]->Reset();
digi[iDigi]->ProgramPHA(false);
}); });
bnScopeReadSettings = new QPushButton("Read Ch. Settings", scope);
layout->addWidget(bnScopeReadSettings, rowID, 3);
connect(bnScopeReadSettings, &QPushButton::clicked, this, [=](){
if( !allowChange ) return;
ReadScopeSettings(cbScopeDigi->currentIndex(), cbScopeCh->currentIndex());
});
//TODO----- add copy settings and paste settings
QCheckBox * chkSetAllChannel = new QCheckBox("apply to all channels", scope);
layout->addWidget(chkSetAllChannel, rowID, 4);
//------------ Probe selection //------------ Probe selection
rowID ++; rowID ++;
//TODO --- add None //TODO --- add None
@ -665,7 +722,7 @@ void MainWindow::SetUpPlot(){ //@--- this function run at start up
cbDigProbe[0] = new QComboBox(scope); cbDigProbe[0] = new QComboBox(scope);
cbDigProbe[0]->addItem("Trigger", "Trigger"); cbDigProbe[0]->addItem("Trigger", "Trigger");
cbDigProbe[0]->addItem("Time Filter Armed", "TimeFilterArmed"); cbDigProbe[0]->addItem("Time Filter Armed", "TimeFilterArmed");
cbDigProbe[0]->addItem("ReTrigger Guard", "ReTriggerGaurd"); cbDigProbe[0]->addItem("ReTrigger Guard", "ReTriggerGuard");
cbDigProbe[0]->addItem("Trap. basline Freeze", "EnergyFilterBaselineFreeze"); cbDigProbe[0]->addItem("Trap. basline Freeze", "EnergyFilterBaselineFreeze");
cbDigProbe[0]->addItem("Peaking", "EnergyFilterPeaking"); cbDigProbe[0]->addItem("Peaking", "EnergyFilterPeaking");
cbDigProbe[0]->addItem("Peak Ready", "EnergyFilterPeakReady"); cbDigProbe[0]->addItem("Peak Ready", "EnergyFilterPeakReady");
@ -730,7 +787,6 @@ void MainWindow::SetUpPlot(){ //@--- this function run at start up
digiMTX.unlock(); digiMTX.unlock();
}); });
layout->addWidget(cbAnaProbe[0], rowID, 0); layout->addWidget(cbAnaProbe[0], rowID, 0);
layout->addWidget(cbAnaProbe[1], rowID, 1); layout->addWidget(cbAnaProbe[1], rowID, 1);
@ -747,161 +803,60 @@ void MainWindow::SetUpPlot(){ //@--- this function run at start up
QGridLayout * bLayout = new QGridLayout(box); QGridLayout * bLayout = new QGridLayout(box);
bLayout->setSpacing(0); bLayout->setSpacing(0);
QLabel * lbRL = new QLabel("Record Lenght [ns] ",scope);
lbRL->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbRL, 0, 0);
sbRL = new QSpinBox(scope); sbRL = new QSpinBox(scope);
sbRL->setMinimum(32); ScopeMakeSpinBox(sbRL, "Record Lenght [ns] ", bLayout, 0, 0, 32, 648000, DIGIPARA::TraceStep, DIGIPARA::CH::RecordLength);
sbRL->setMaximum(648000);
sbRL->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbRL, 0, 1);
connect(sbRL, &QSpinBox::valueChanged, this, [=](){ sbThreshold = new QSpinBox(scope);
if( !allowChange ) return; ScopeMakeSpinBox(sbThreshold, "Threshold [LSB] ", bLayout, 0, 2, 0, 8191, -20, DIGIPARA::CH::TriggerThreshold);
int iDigi = cbScopeDigi->currentIndex();
sbRL->setValue(DIGIPARA::TraceStep*((sbRL->value() + DIGIPARA::TraceStep - 1)/DIGIPARA::TraceStep));
digiMTX.lock();
digi[iDigi]->WriteChValue(std::to_string(cbScopeCh->currentIndex()), DIGIPARA::CH::RecordLength, std::to_string(sbRL->value()));
digiMTX.unlock();
});
QLabel * lbThreshold = new QLabel("Threshold [LSB] ",scope); cbPolarity = new QComboBox(scope);
lbThreshold->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbThreshold, 0, 2);
QSpinBox * sbThreshold = new QSpinBox(scope);
sbThreshold->setMinimum(0);
sbThreshold->setMaximum(8191);
sbThreshold->setSingleStep(20);
bLayout->addWidget(sbThreshold, 0, 3);
QLabel * lbPolarity = new QLabel("Polarity ",scope);
lbPolarity->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbPolarity, 0, 4);
QComboBox * cbPolarity = new QComboBox(scope);
cbPolarity->addItem("Pos. +", "Positive"); cbPolarity->addItem("Pos. +", "Positive");
cbPolarity->addItem("Neg. -", "Negative"); cbPolarity->addItem("Neg. -", "Negative");
bLayout->addWidget(cbPolarity, 0, 5); ScopeMakeComoBox(cbPolarity, "Polarity ", bLayout, 0, 4, DIGIPARA::CH::Polarity);
QLabel * lbWaveRes = new QLabel("Wave Res. ", scope); cbWaveRes = new QComboBox(scope);
lbWaveRes->setAlignment(Qt::AlignRight | Qt::AlignCenter); cbWaveRes->addItem(" 8 ns", "RES8");
bLayout->addWidget(lbWaveRes, 0, 6); cbWaveRes->addItem("16 ns", "RES16");
QComboBox * cbWaveRes = new QComboBox(scope); cbWaveRes->addItem("32 ns", "RES32");
cbWaveRes->addItem(" 8 ns", "Res8"); cbWaveRes->addItem("64 ns", "RES64");
cbWaveRes->addItem("16 ns", "Res16"); ScopeMakeComoBox(cbWaveRes, "Wave Re. ", bLayout, 0, 6, DIGIPARA::CH::WaveResolution);
cbWaveRes->addItem("32 ns", "Res32");
cbWaveRes->addItem("64 ns", "Res64");
bLayout->addWidget(cbWaveRes, 0, 7);
//------------------ next row //------------------ next row
QLabel * lbPT = new QLabel("Pre Trigger [ns] ",scope);
lbPT->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbPT, 1, 0);
sbPT = new QSpinBox(scope); sbPT = new QSpinBox(scope);
sbPT->setMinimum(32); ScopeMakeSpinBox(sbPT, "Pre Trigger [ns] ", bLayout, 1, 0, 32, 32000, DIGIPARA::TraceStep, DIGIPARA::CH::PreTrigger);
sbPT->setMaximum(32000);
sbPT->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbPT, 1, 1);
connect(sbPT, &QSpinBox::valueChanged, this, [=](){
if( !allowChange ) return;
int iDigi = cbScopeDigi->currentIndex();
sbPT->setValue(DIGIPARA::TraceStep*((sbPT->value() + DIGIPARA::TraceStep - 1)/DIGIPARA::TraceStep));
digiMTX.lock();
digi[iDigi]->WriteChValue(std::to_string(cbScopeCh->currentIndex()), DIGIPARA::CH::PreTrigger, std::to_string(sbPT->value()));
digiMTX.unlock();
});
QLabel * lbDCOffset = new QLabel("DC offset [%] ",scope);
lbDCOffset->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbDCOffset, 1, 2);
sbDCOffset = new QSpinBox(scope); sbDCOffset = new QSpinBox(scope);
sbDCOffset->setMinimum(0); ScopeMakeSpinBox(sbDCOffset, "DC offset [%] ", bLayout, 1, 2, 0, 100, -10, DIGIPARA::CH::DC_Offset);
sbDCOffset->setMaximum(100);
sbDCOffset->setSingleStep(1);
bLayout->addWidget(sbDCOffset, 1, 3);
connect(sbDCOffset, &QSpinBox::valueChanged, this, [=](){ sbTimeRiseTime = new QSpinBox(scope);
if( !allowChange ) return; ScopeMakeSpinBox(sbTimeRiseTime, "Trigger Rise Time [ns] ", bLayout, 1, 4, 32, 2000, DIGIPARA::TraceStep, DIGIPARA::CH::TimeFilterRiseTime);
int iDigi = cbScopeDigi->currentIndex();
digiMTX.lock();
digi[iDigi]->WriteChValue(std::to_string(cbScopeCh->currentIndex()), DIGIPARA::CH::DC_Offset, std::to_string(sbDCOffset->value()));
digiMTX.unlock();
});
QLabel * lbTimeRiseTime = new QLabel("Trigger Rise Time [ns] ", scope); sbTimeGuard = new QSpinBox(scope);
lbTimeRiseTime->setAlignment(Qt::AlignRight | Qt::AlignCenter); ScopeMakeSpinBox(sbTimeGuard, "Trigger Guard [ns] ", bLayout, 1, 6, 0, 8000, DIGIPARA::TraceStep, DIGIPARA::CH::TimeFilterRetriggerGuard);
bLayout->addWidget(lbTimeRiseTime, 1, 4);
QSpinBox * sbTimeRiseTime = new QSpinBox(scope);
sbTimeRiseTime->setMinimum(32);
sbTimeRiseTime->setMaximum(2000);
sbTimeRiseTime->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbTimeRiseTime, 1, 5);
QLabel * lbTimeGuard = new QLabel("Trigger Guard [ns] ", scope);
lbTimeGuard->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbTimeGuard, 1, 6);
QSpinBox * sbTimeGuard = new QSpinBox(scope);
sbTimeGuard->setMinimum(0);
sbTimeGuard->setMaximum(8000);
sbTimeGuard->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbTimeGuard, 1, 7);
//----------------- next row //----------------- next row
QLabel * lbTrapRiseTime = new QLabel("Trap. Rise Time [ns] ", scope); sbTrapRiseTime = new QSpinBox(scope);
lbTrapRiseTime->setAlignment(Qt::AlignRight | Qt::AlignCenter); ScopeMakeSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", bLayout, 2, 0, 32, 13000, DIGIPARA::TraceStep, DIGIPARA::CH::EnergyFilterRiseTime);
bLayout->addWidget(lbTrapRiseTime, 2, 0);
QSpinBox * sbTrapRiseTime = new QSpinBox(scope);
sbTrapRiseTime->setMinimum(32);
sbTrapRiseTime->setMaximum(13000);
sbTrapRiseTime->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbTrapRiseTime, 2, 1);
QLabel * lbTrapFlatTop = new QLabel("Trap. Flat Top [ns] ", scope); sbTrapFlatTop = new QSpinBox(scope);
lbTrapFlatTop->setAlignment(Qt::AlignRight | Qt::AlignCenter); ScopeMakeSpinBox(sbTrapFlatTop, "Trap. Flat Top [ns] ", bLayout, 2, 2, 32, 3000, DIGIPARA::TraceStep, DIGIPARA::CH::EnergyFilterFlatTop);
bLayout->addWidget(lbTrapFlatTop, 2, 2);
QSpinBox * sbTrapFlatTop = new QSpinBox(scope);
sbTrapFlatTop->setMinimum(32);
sbTrapFlatTop->setMaximum(3000);
sbTrapFlatTop->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbTrapFlatTop, 2, 3);
QLabel * lbTrapPoleZero = new QLabel("Trap. Pole Zero [ns] ", scope); sbTrapPoleZero = new QSpinBox(scope);
lbTrapPoleZero->setAlignment(Qt::AlignRight | Qt::AlignCenter); ScopeMakeSpinBox(sbTrapPoleZero, "Trap. Pole Zero [ns] ", bLayout, 2, 4, 32, 524000, DIGIPARA::TraceStep, DIGIPARA::CH::EnergyFilterPoleZero);
bLayout->addWidget(lbTrapPoleZero, 2, 4);
QSpinBox * sbTrapPoleZero = new QSpinBox(scope);
sbTrapPoleZero->setMinimum(32);
sbTrapPoleZero->setMaximum(524000);
sbTrapPoleZero->setSingleStep(DIGIPARA::TraceStep);
bLayout->addWidget(sbTrapPoleZero, 2, 5);
QLabel * lbEnergyFineGain = new QLabel("Energy Fine Gain ", scope); sbEnergyFineGain = new QSpinBox(scope);
lbEnergyFineGain->setAlignment(Qt::AlignRight | Qt::AlignCenter); ScopeMakeSpinBox(sbEnergyFineGain, "Energy Fine Gain ", bLayout, 2, 6, 1, 10, -1, DIGIPARA::CH::EnergyFilterFineGain);
bLayout->addWidget(lbEnergyFineGain, 2, 6);
QSpinBox * sbEnergyFineGain = new QSpinBox(scope);
sbEnergyFineGain->setMinimum(1);
sbEnergyFineGain->setMaximum(10);
bLayout->addWidget(sbEnergyFineGain, 2, 7);
//----------------- next row //----------------- next row
QLabel * lbTrapPeaking = new QLabel("Trap. Peaking [%] ", scope); sbTrapPeaking = new QSpinBox(scope);
lbTrapPeaking->setAlignment(Qt::AlignRight | Qt::AlignCenter); ScopeMakeSpinBox(sbTrapPeaking, "Trap. Peaking [%] ", bLayout, 3, 0, 1, 100, -10, DIGIPARA::CH::EnergyFilterPeakingPosition);
bLayout->addWidget(lbTrapPeaking, 3, 0);
QSpinBox * sbTrapPeaking = new QSpinBox(scope);
sbTrapPeaking->setMinimum(0);
sbTrapPeaking->setMaximum(100);
bLayout->addWidget(sbTrapPeaking, 3, 1);
QLabel * lbTrapPeakAvg = new QLabel("Trap. Peak Avg. ", scope); cbTrapPeakAvg = new QComboBox(scope);
lbTrapPeakAvg->setAlignment(Qt::AlignRight | Qt::AlignCenter);
bLayout->addWidget(lbTrapPeakAvg, 3, 2);
QComboBox * cbTrapPeakAvg = new QComboBox(scope);
cbTrapPeakAvg->addItem(" 1 sample", "OneShot"); cbTrapPeakAvg->addItem(" 1 sample", "OneShot");
cbTrapPeakAvg->addItem(" 4 sample", "LowAVG"); cbTrapPeakAvg->addItem(" 4 sample", "LowAVG");
cbTrapPeakAvg->addItem("16 sample", "MediumAVG"); cbTrapPeakAvg->addItem("16 sample", "MediumAVG");
cbTrapPeakAvg->addItem("64 sample", "HighAVG"); cbTrapPeakAvg->addItem("64 sample", "HighAVG");
bLayout->addWidget(cbTrapPeakAvg, 3, 3); ScopeMakeComoBox(cbTrapPeakAvg, "Trap. Peaking ", bLayout, 3, 2, DIGIPARA::CH::EnergyFilterPeakingAvg);
} }
//------------ plot view //------------ plot view

View File

@ -118,8 +118,13 @@ private slots:
void ReadScopeSettings(int iDigi, int ch); void ReadScopeSettings(int iDigi, int ch);
void StartScope(int iDigi); void StartScope(int iDigi);
void StopScope(); void StopScope();
void SetUpPlot();
void UpdateScope(); void UpdateScope();
void ScopeControlOnOff(bool on);
void ScopeReadSpinBoxValue(int iDigi, int ch, QSpinBox *sb, std::string digPara);
void ScopeReadComboBoxValue(int iDigi, int ch, QComboBox *cb, std::string digPara);
void ScopeMakeSpinBox(QSpinBox * sb, QString str, QGridLayout* layout, int row, int col, int min, int max, int step, std::string digPara);
void ScopeMakeComoBox(QComboBox * cb, QString str, QGridLayout* layout, int row, int col, std::string digPara);
void SetUpPlot();
void OpenDigitizersSettings(); void OpenDigitizersSettings();
@ -157,13 +162,29 @@ private:
QComboBox * cbScopeDigi; QComboBox * cbScopeDigi;
QComboBox * cbScopeCh; QComboBox * cbScopeCh;
QPushButton * bnScopeReset; QPushButton * bnScopeReset;
QPushButton * bnScopeReadSettings;
QPushButton * bnScopeStart;
QPushButton * bnScopeStop;
QComboBox * cbAnaProbe[2]; QComboBox * cbAnaProbe[2];
QComboBox * cbDigProbe[4]; QComboBox * cbDigProbe[4];
QSpinBox * sbRL; // record length QSpinBox * sbRL; // record length
QSpinBox * sbPT; // pre trigger QSpinBox * sbPT; // pre trigger
QSpinBox * sbDCOffset; QSpinBox * sbDCOffset;
QPushButton * bnScopeStart; QSpinBox * sbThreshold;
QPushButton * bnScopeStop; QSpinBox * sbTimeRiseTime;
QSpinBox * sbTimeGuard;
QSpinBox * sbTrapRiseTime;
QSpinBox * sbTrapFlatTop;
QSpinBox * sbTrapPoleZero;
QSpinBox * sbEnergyFineGain;
QSpinBox * sbTrapPeaking;
QComboBox * cbPolarity;
QComboBox * cbWaveRes;
QComboBox * cbTrapPeakAvg;
bool allowChange; bool allowChange;
void ProbeChange(QComboBox * cb[], const int size); void ProbeChange(QComboBox * cb[], const int size);