added some widgetsin DigiSetting

This commit is contained in:
splitPoleDAQ 2023-04-25 17:04:46 -04:00
parent 26056070f0
commit 75f0ae6467
6 changed files with 307 additions and 45 deletions

View File

@ -145,6 +145,7 @@ class Digitizer{
unsigned int ReadBits(Register::Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ); unsigned int ReadBits(Register::Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch );
void SetBits(Register::Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch); void SetBits(Register::Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch);
void SetBits(Register::Reg address, std::pair<unsigned short, unsigned short> bit, unsigned int bitValue, int ch){ SetBits(address, bitValue, bit.first, bit.second, ch);} void SetBits(Register::Reg address, std::pair<unsigned short, unsigned short> bit, unsigned int bitValue, int ch){ SetBits(address, bitValue, bit.first, bit.second, ch);}
static unsigned int ExtractBits(uint32_t value, std::pair<unsigned short, unsigned short> bit){ return ((value >> bit.second) & uint(pow(2, bit.first)-1) ); }
//====== Board Config breakDown //====== Board Config breakDown
bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(Register::DPP::BoardConfiguration) & 0x1 );} bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(Register::DPP::BoardConfiguration) & 0x1 );}

View File

@ -20,6 +20,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
//@===================================== tab //@===================================== tab
for( unsigned int iDigi = 0 ; iDigi < this->nDigi; iDigi ++ ){ for( unsigned int iDigi = 0 ; iDigi < this->nDigi; iDigi ++ ){
ID = iDigi;
QScrollArea * scrollArea = new QScrollArea(this); QScrollArea * scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true); scrollArea->setWidgetResizable(true);
@ -29,41 +31,48 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
QWidget * tab = new QWidget(tabWidget); QWidget * tab = new QWidget(tabWidget);
scrollArea->setWidget(tab); scrollArea->setWidget(tab);
QHBoxLayout * tabLayout_H = new QHBoxLayout(tab); //tab->setLayout(tabLayout_H); QHBoxLayout * tabLayout_H = new QHBoxLayout(tab);
QVBoxLayout * tabLayout_V1 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V1); QWidget * temp_V1 = new QWidget(this);
QVBoxLayout * tabLayout_V2 = new QVBoxLayout(tab); tabLayout_H->addLayout(tabLayout_V2); tabLayout_H->addWidget(temp_V1);
QVBoxLayout * tabLayout_V1 = new QVBoxLayout(temp_V1);
{//^====================== Group of Digitizer Info {//^====================== Group of Digitizer Info
QGroupBox * infoBox = new QGroupBox("Board Info", tab); infoBox[iDigi] = new QGroupBox("Board Info", tab);
//infoBox->setSizePolicy(sizePolicy); //infoBox->setSizePolicy(sizePolicy);
QGridLayout * infoLayout = new QGridLayout(infoBox); infoLayout[iDigi] = new QGridLayout(infoBox[iDigi]);
tabLayout_V1->addWidget(infoBox); tabLayout_V1->addWidget(infoBox[iDigi]);
SetUpInfo( "Model ", digi[iDigi]->GetModelName(), infoLayout, 0, 0);
SetUpInfo( "DPP Type ", digi[iDigi]->GetDPPString(), infoLayout, 0, 2);
SetUpInfo("Link Type ", digi[iDigi]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link" , infoLayout, 0, 4);
SetUpInfo( "S/N No. ", std::to_string(digi[iDigi]->GetSerialNumber()), infoLayout, 1, 0);
SetUpInfo( "No. Ch. ", std::to_string(digi[iDigi]->GetNChannels()), infoLayout, 1, 2);
SetUpInfo("Sampling Rate ", std::to_string(digi[iDigi]->GetCh2ns()), infoLayout, 1, 4);
SetUpInfo("ADC bit ", std::to_string(digi[iDigi]->GetADCBits()), infoLayout, 2, 0);
SetUpInfo("ROC version ", digi[iDigi]->GetROCVersion(), infoLayout, 2, 2);
SetUpInfo("AMC version ", digi[iDigi]->GetAMCVersion(), infoLayout, 2, 4);
} }
{//^======================= Board status {//^======================= Board status
QGroupBox * bardStatusBox = new QGroupBox("Board Status", tab); QGroupBox * boardStatusBox = new QGroupBox("Board Status", tab);
QGridLayout * statusLayout = new QGridLayout(bardStatusBox); tabLayout_V1->addWidget(boardStatusBox);
tabLayout_V1->addWidget(bardStatusBox);
//QGridLayout * statusLayout = new QGridLayout(bardStatusBox);
}
{//^======================= Buttons
QGroupBox * buttonsBox = new QGroupBox("Buttons", tab);
tabLayout_V1->addWidget(buttonsBox);
QGridLayout * buttonLayout = new QGridLayout(buttonsBox);
bnRefreshSetting = new QPushButton("Refresh Settings", this);
buttonLayout->addWidget(bnRefreshSetting, 0, 0);
connect(bnRefreshSetting, &QPushButton::clicked, this, &DigiSettingsPanel::ReadSettingsFromBoard);
} }
{//^======================= Board Settings {//^======================= Board Settings
QGroupBox * boardSettingBox = new QGroupBox("Board Settings", tab); boardSettingBox[iDigi] = new QGroupBox("Board Settings", tab);
QGridLayout * settingLayout = new QGridLayout(boardSettingBox); tabLayout_V1->addWidget(boardSettingBox[iDigi]);
tabLayout_V1->addWidget(boardSettingBox);
settingLayout[iDigi] = new QGridLayout(boardSettingBox[iDigi]);
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard();
} }
@ -81,6 +90,23 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
} }
connect(tabWidget, &QTabWidget::currentChanged, this, [=](int index){
if( index < (int) nDigi) {
ID = index;
// CleanUpGroupBox(boardSettingBox[ID]);
// if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard();
// if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDBoard();
CleanUpGroupBox(infoBox[ID]);
UpdatePanelFromMemory();
}
});
ID = 0;
UpdatePanelFromMemory();
enableSignalSlot = true;
} }
DigiSettingsPanel::~DigiSettingsPanel(){ DigiSettingsPanel::~DigiSettingsPanel(){
@ -90,12 +116,189 @@ DigiSettingsPanel::~DigiSettingsPanel(){
//*================================================================ //*================================================================
//*================================================================ //*================================================================
void DigiSettingsPanel::SetUpInfo(QString name, std::string value, QGridLayout *gLayout, int row, int col){ void DigiSettingsPanel::SetUpInfo(QString label, std::string value, QGridLayout *gLayout, int row, int col){
QLabel * lab = new QLabel(name, this); QLabel * lab = new QLabel(label, this);
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); lab->setAlignment(Qt::AlignRight | Qt::AlignCenter);
QLineEdit * leInfo = new QLineEdit(this); QLineEdit * leInfo = new QLineEdit(this);
leInfo->setAlignment(Qt::AlignHCenter);
leInfo->setReadOnly(true); leInfo->setReadOnly(true);
leInfo->setText(QString::fromStdString(value)); leInfo->setText(QString::fromStdString(value));
gLayout->addWidget(lab, row, col); gLayout->addWidget(lab, row, col);
gLayout->addWidget(leInfo, row, col + 1); gLayout->addWidget(leInfo, row, col + 1);
} }
void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para, std::pair<unsigned short, unsigned short> bit){
chkBox = new QCheckBox(label, this);
gLayout->addWidget(chkBox, row, col);
connect(chkBox, &QCheckBox::stateChanged, this, [=](int state){
if( !enableSignalSlot ) return;
digi[ID]->SetBits(para, bit, state ? 1 : 0, -1);
});
}
void DigiSettingsPanel::SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector<std::pair<QString, int>> items){
QLabel * lab = new QLabel(label, this);
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter);
gLayout->addWidget(lab, row, col);
cb = new RComboBox(this);
gLayout->addWidget(cb, row, col + 1);
for(int i = 0; i < (int) items.size(); i++){
cb->addItem(items[i].first, items[i].second);
}
}
void DigiSettingsPanel::CleanUpGroupBox(QGroupBox * & gBox){
printf("============== %s \n", __func__);
QList<QLabel *> labelChildren1 = gBox->findChildren<QLabel *>();
for( int i = 0; i < labelChildren1.size(); i++) delete labelChildren1[i];
QList<QLineEdit *> labelChildren1a = gBox->findChildren<QLineEdit *>();
for( int i = 0; i < labelChildren1a.size(); i++) delete labelChildren1a[i];
QList<RComboBox *> labelChildren2 = gBox->findChildren<RComboBox *>();
for( int i = 0; i < labelChildren2.size(); i++) delete labelChildren2[i];
QList<RSpinBox *> labelChildren3 = gBox->findChildren<RSpinBox *>();
for( int i = 0; i < labelChildren3.size(); i++) delete labelChildren3[i];
QList<QCheckBox *> labelChildren4 = gBox->findChildren<QCheckBox *>();
for( int i = 0; i < labelChildren4.size(); i++) delete labelChildren4[i];
}
void DigiSettingsPanel::SetUpPHABoard(){
printf("============== %s \n", __func__);
SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", settingLayout[ID], 0, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::EnableAutoDataFlush);
SetUpCheckBox(chkDecimateTrace[ID], "Decimate Trace", settingLayout[ID], 1, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DecimateTrace);
SetUpCheckBox(chkTrigPropagation[ID], "Trig. Propagate", settingLayout[ID], 2, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::TrigPropagation);
SetUpCheckBox(chkDualTrace[ID], "Dual Trace", settingLayout[ID], 3, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DualTrace);
SetUpCheckBox(chkTraceRecording[ID], "Record Trace", settingLayout[ID], 4, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::RecordTrace);
SetUpCheckBox(chkEnableExtra2[ID], "Enable Extra2", settingLayout[ID], 5, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::EnableExtra2);
SetUpComboBox(cbAnaProbe1[ID], "Ana. Probe 1 ", settingLayout[ID], 0, 1, {{"Input", 0},
{"RC-CR", 1},
{"RC-CR2", 2},
{"Trapezoid", 3}});
SetUpComboBox(cbAnaProbe2[ID], "Ana. Probe 2 ", settingLayout[ID], 1, 1, {{"Input", 0},
{"Threshold", 1},
{"Trap. - Baseline", 2},
{"Trap. Baseline", 3}});
SetUpComboBox(cbDigiProbe1[ID], "Digi. Probe 1 ", settingLayout[ID], 2, 1, {{"Peaking", 0},
{"Armed", 1},
{"Peak Run", 2},
{"Pile Up", 3},
{"peaking", 4},
{"TRG Valid. Win", 5},
{"Baseline Freeze", 6},
{"TRG Holdoff", 7},
{"TRG Valid.", 8},
{"ACQ Busy", 9},
{"Zero Cross", 10},
{"Ext. TRG", 11},
{"Budy", 12}});
SetUpComboBox(cbDigiProbe2[ID], "Digi. Probe 2 ", settingLayout[ID], 3, 1, {{"trigger", 0}});
cbDigiProbe2[ID]->setEnabled(false);
SetUpComboBox(cbAggOrg[ID], "Aggregate Organization ", settingLayout[ID], 6, 0, {{"Not used", 0},
{"4", 2},
{"8", 3},
{"16", 4},
{"32", 5},
{"64", 6},
{"128", 7},
{"256", 8},
{"512", 9},
{"1024", 10}});
}
void DigiSettingsPanel::SetUpPSDBoard(){
}
void DigiSettingsPanel::UpdatePanelFromMemory(){
printf("============== %s \n", __func__);
SetUpInfo( "Model ", digi[ID]->GetModelName(), infoLayout[ID], 0, 0);
SetUpInfo( "DPP Type ", digi[ID]->GetDPPString(), infoLayout[ID], 0, 2);
SetUpInfo("Link Type ", digi[ID]->GetLinkType() == CAEN_DGTZ_USB ? "USB" : "Optical Link" , infoLayout[ID], 0, 4);
SetUpInfo( "S/N No. ", std::to_string(digi[ID]->GetSerialNumber()), infoLayout[ID], 1, 0);
SetUpInfo( "No. Ch. ", std::to_string(digi[ID]->GetNChannels()), infoLayout[ID], 1, 2);
SetUpInfo("Sampling Rate ", std::to_string(digi[ID]->GetCh2ns()), infoLayout[ID], 1, 4);
SetUpInfo("ADC bit ", std::to_string(digi[ID]->GetADCBits()), infoLayout[ID], 2, 0);
SetUpInfo("ROC version ", digi[ID]->GetROCVersion(), infoLayout[ID], 2, 2);
SetUpInfo("AMC version ", digi[ID]->GetAMCVersion(), infoLayout[ID], 2, 4);
enableSignalSlot = false;
uint32_t BdCfg = digi[ID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
chkAutoDataFlush[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::EnableAutoDataFlush) );
chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DecimateTrace) );
chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::TrigPropagation) );
chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DualTrace) );
chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::TrigPropagation) );
chkEnableExtra2[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::EnableExtra2) );
//connect(chkAutoDataFlush, &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetAutoDataFlush);
int temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe1);
for( int i = 0; i < cbAnaProbe1[ID]->count(); i++){
if( cbAnaProbe1[ID]->itemData(i).toInt() == temp) {
cbAnaProbe1[ID]->setCurrentIndex(i);
break;
}
}
temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe2);
for(int i = 0; i < cbAnaProbe2[ID]->count(); i++){
if( cbAnaProbe2[ID]->itemData(i).toInt() == temp) {
cbAnaProbe2[ID]->setCurrentIndex(i);
break;
}
}
temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DigiProbel1);
for(int i = 0; i < cbDigiProbe1[ID]->count(); i++){
if( cbDigiProbe1[ID]->itemData(i).toInt() == temp) {
cbDigiProbe1[ID]->setCurrentIndex(i);
break;
}
}
enableSignalSlot = false;
}
void DigiSettingsPanel::ReadSettingsFromBoard(){
digi[ID]->ReadAllSettingsFromBoard();
UpdatePanelFromMemory();
}
//*================================================================
//*================================================================
void DigiSettingsPanel::SetAutoDataFlush(){
if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::EnableAutoDataFlush, chkAutoDataFlush[ID]->checkState() ? 1 : 0, -1);
}

View File

@ -5,6 +5,9 @@
#include <QTabWidget> #include <QTabWidget>
#include <QLineEdit> #include <QLineEdit>
#include <QGridLayout> #include <QGridLayout>
#include <QCheckBox>
#include <QGroupBox>
#include <QPushButton>
#include "macro.h" #include "macro.h"
#include "ClassDigitizer.h" #include "ClassDigitizer.h"
@ -18,21 +21,57 @@ public:
~DigiSettingsPanel(); ~DigiSettingsPanel();
private slots: private slots:
void UpdatePanelFromMemory();
void ReadSettingsFromBoard();
void SetAutoDataFlush();
signals: signals:
void SendLogMsg(const QString &msg); void SendLogMsg(const QString &msg);
private: private:
void SetUpInfo(QString name, std::string value, QGridLayout *gLayout, int row, int col); void SetUpInfo(QString label, std::string value, QGridLayout *gLayout, int row, int col);
void SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para, std::pair<unsigned short, unsigned short> bit);
void SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector<std::pair<QString, int>> items);
void CleanUpGroupBox(QGroupBox * & gBox);
void SetUpPHABoard();
void SetUpPSDBoard();
Digitizer ** digi; Digitizer ** digi;
unsigned int nDigi; unsigned int nDigi;
unsigned short ID;
bool enableSignalSlot; bool enableSignalSlot;
QTabWidget * tabWidget; QTabWidget * tabWidget;
QGroupBox * infoBox[MaxNDigitizer];
QGridLayout * infoLayout[MaxNDigitizer];
QPushButton * bnRefreshSetting; // read setting from board
QGroupBox * boardSettingBox[MaxNDigitizer];
QGridLayout * settingLayout[MaxNDigitizer];
QCheckBox * chkAutoDataFlush[MaxNDigitizer];
QCheckBox * chkDecimateTrace[MaxNDigitizer];
QCheckBox * chkTrigPropagation[MaxNDigitizer];
QCheckBox * chkDualTrace[MaxNDigitizer];
QCheckBox * chkTraceRecording[MaxNDigitizer];
QCheckBox * chkEnableExtra2[MaxNDigitizer];
RComboBox * cbAnaProbe1[MaxNDigitizer];
RComboBox * cbAnaProbe2[MaxNDigitizer];
RComboBox * cbDigiProbe1[MaxNDigitizer];
RComboBox * cbDigiProbe2[MaxNDigitizer];
RComboBox * cbAggOrg[MaxNDigitizer];
}; };

View File

@ -199,7 +199,7 @@ inline uint32_t Reg::CalAddress(unsigned int index){
///====== Common for PHA and PSD ///====== Common for PHA and PSD
namespace DPP { namespace DPP {
namespace BoardConfigBit{ namespace Bit_BoardConfig{
const std::pair<unsigned short, unsigned short> EnableAutoDataFlush = {1, 0} ; /// length, smallest pos const std::pair<unsigned short, unsigned short> EnableAutoDataFlush = {1, 0} ; /// length, smallest pos
const std::pair<unsigned short, unsigned short> DecimateTrace = {1, 1} ; const std::pair<unsigned short, unsigned short> DecimateTrace = {1, 1} ;
const std::pair<unsigned short, unsigned short> TrigPropagation = {1, 2} ; const std::pair<unsigned short, unsigned short> TrigPropagation = {1, 2} ;
@ -212,7 +212,7 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const std::pair<unsigned short, unsigned short> DigiProbel2 = {3, 26} ; const std::pair<unsigned short, unsigned short> DigiProbel2 = {3, 26} ;
} }
namespace DPPAlgorithmControlBit { namespace Bit_DPPAlgorithmControl {
const std::pair<unsigned short, unsigned short> TrapRescaling = {6, 0} ; /// length, smallest pos const std::pair<unsigned short, unsigned short> TrapRescaling = {6, 0} ; /// length, smallest pos
const std::pair<unsigned short, unsigned short> TraceDecimation = {2, 8}; const std::pair<unsigned short, unsigned short> TraceDecimation = {2, 8};
const std::pair<unsigned short, unsigned short> TraceDeciGain = {2, 10,}; const std::pair<unsigned short, unsigned short> TraceDeciGain = {2, 10,};
@ -225,6 +225,27 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const std::pair<unsigned short, unsigned short> EnablePileUpFlag = {1, 27}; const std::pair<unsigned short, unsigned short> EnablePileUpFlag = {1, 27};
} }
namespace Bit_AcquistionControl {
const std::pair<unsigned short, unsigned short> StartStopMode = {2, 0} ;
const std::pair<unsigned short, unsigned short> ACQStartArm = {1, 2} ;
const std::pair<unsigned short, unsigned short> PLLRef = {1, 6} ;
const std::pair<unsigned short, unsigned short> LVDSBusyEnable = {1, 8} ;
const std::pair<unsigned short, unsigned short> LVDSVetoEnable = {1, 9} ;
const std::pair<unsigned short, unsigned short> VetoTRGOut = {1, 12} ;
}
namespace Bit_AcqStatus {
const std::pair<unsigned short, unsigned short> AcqStatus = {1, 2} ;
const std::pair<unsigned short, unsigned short> EventReady = {1, 3} ;
const std::pair<unsigned short, unsigned short> EventFull = {1, 4} ;
const std::pair<unsigned short, unsigned short> ClockSource = {1, 5} ;
const std::pair<unsigned short, unsigned short> PLLLock = {1, 7} ;
const std::pair<unsigned short, unsigned short> BoardReady = {1, 8} ;
const std::pair<unsigned short, unsigned short> SINStatus = {1, 15} ;
const std::pair<unsigned short, unsigned short> TRGINStatus = {1, 16} ;
const std::pair<unsigned short, unsigned short> ChannelsDown = {1, 19} ;
}
const Reg RecordLength_G ("RecordLength_G" , 0x1020, RW::ReadWrite, true, 0x3FFF, 8); /// R/W const Reg RecordLength_G ("RecordLength_G" , 0x1020, RW::ReadWrite, true, 0x3FFF, 8); /// R/W
const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {{"2 Vpp", 0},{"0.5 Vpp", 1}}); /// R/W const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {{"2 Vpp", 0},{"0.5 Vpp", 1}}); /// R/W
const Reg NumberEventsPerAggregate_G ("NumberEventsPerAggregate_G" , 0x1034, RW::ReadWrite, true, 0x3FF, -1); /// R/W const Reg NumberEventsPerAggregate_G ("NumberEventsPerAggregate_G" , 0x1034, RW::ReadWrite, true, 0x3FF, -1); /// R/W

View File

@ -449,7 +449,7 @@ void Scope::SetUpPHAPanel(){
cbPolarity->addItem("Negative", 1); cbPolarity->addItem("Negative", 1);
connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){ connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::DPPAlgorithmControlBit::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex());
}); });
SetUpComboBoxSimple(cbBaselineAvg, "Baseline Avg. ", rowID, 2); SetUpComboBoxSimple(cbBaselineAvg, "Baseline Avg. ", rowID, 2);
@ -462,7 +462,7 @@ void Scope::SetUpPHAPanel(){
cbBaselineAvg->addItem("16384 sample", 6); cbBaselineAvg->addItem("16384 sample", 6);
connect(cbBaselineAvg, &RComboBox::currentIndexChanged, this, [=](){ connect(cbBaselineAvg, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::DPPAlgorithmControlBit::BaselineAvg, cbBaselineAvg->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::BaselineAvg, cbBaselineAvg->currentData().toInt(), cbScopeCh->currentIndex());
}); });
SetUpComboBoxSimple(cbPeakAvg, "Peak Avg. ", rowID, 4); SetUpComboBoxSimple(cbPeakAvg, "Peak Avg. ", rowID, 4);
@ -472,7 +472,7 @@ void Scope::SetUpPHAPanel(){
cbPeakAvg->addItem("64 sample", 3); cbPeakAvg->addItem("64 sample", 3);
connect(cbPeakAvg, &RComboBox::currentIndexChanged, this, [=](){ connect(cbPeakAvg, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::DPPAlgorithmControlBit::PeakMean, cbPeakAvg->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::PeakMean, cbPeakAvg->currentData().toInt(), cbScopeCh->currentIndex());
}); });
SetUpSpinBox(sbPeakHoldOff, "Peak HoldOff [ns] ", rowID, 6, Register::DPP::PHA::PeakHoldOff); SetUpSpinBox(sbPeakHoldOff, "Peak HoldOff [ns] ", rowID, 6, Register::DPP::PHA::PeakHoldOff);
@ -486,7 +486,7 @@ void Scope::SetUpPHAPanel(){
cbAnaProbe1->addItem("Trap.", 3); cbAnaProbe1->addItem("Trap.", 3);
connect(cbAnaProbe1, &RComboBox::currentIndexChanged, this, [=](){ connect(cbAnaProbe1, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::BoardConfigBit::AnalogProbe1, cbAnaProbe1->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe1, cbAnaProbe1->currentData().toInt(), cbScopeCh->currentIndex());
dataTrace[0]->setName(cbAnaProbe1->currentText()); dataTrace[0]->setName(cbAnaProbe1->currentText());
}); });
@ -497,7 +497,7 @@ void Scope::SetUpPHAPanel(){
cbAnaProbe2->addItem("Baseline", 3); cbAnaProbe2->addItem("Baseline", 3);
connect(cbAnaProbe2, &RComboBox::currentIndexChanged, this, [=](){ connect(cbAnaProbe2, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::BoardConfigBit::AnalogProbe2, cbAnaProbe2->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe2, cbAnaProbe2->currentData().toInt(), cbScopeCh->currentIndex());
dataTrace[1]->setName(cbAnaProbe2->currentText()); dataTrace[1]->setName(cbAnaProbe2->currentText());
}); });
@ -517,7 +517,7 @@ void Scope::SetUpPHAPanel(){
cbDigiProbe1->addItem("Budy", 12); cbDigiProbe1->addItem("Budy", 12);
connect(cbDigiProbe1, &RComboBox::currentIndexChanged, this, [=](){ connect(cbDigiProbe1, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::BoardConfigBit::DigiProbel1, cbDigiProbe1->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel1, cbDigiProbe1->currentData().toInt(), cbScopeCh->currentIndex());
dataTrace[2]->setName(cbDigiProbe2->currentText()); dataTrace[2]->setName(cbDigiProbe2->currentText());
}); });
@ -545,7 +545,7 @@ void Scope::SetUpPSDPanel(){
cbPolarity->addItem("Negative", 1); cbPolarity->addItem("Negative", 1);
connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){ connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::DPPAlgorithmControlBit::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()); digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex());
}); });
} }
@ -615,7 +615,7 @@ void Scope::UpdatePanelFromMomeory(){
UpdateComobox(cbDynamicRange, Register::DPP::InputDynamicRange); UpdateComobox(cbDynamicRange, Register::DPP::InputDynamicRange);
uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch); uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch);
if( (DPPAlg >> Register::DPP::DPPAlgorithmControlBit::Polarity.second) & 0x1 ){ if( Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::Polarity) ){
cbPolarity->setCurrentIndex(1); cbPolarity->setCurrentIndex(1);
}else{ }else{
cbPolarity->setCurrentIndex(0); cbPolarity->setCurrentIndex(0);
@ -633,7 +633,7 @@ void Scope::UpdatePanelFromMomeory(){
UpdateComobox(cbSmoothingFactor, Register::DPP::PHA::RCCR2SmoothingFactor); UpdateComobox(cbSmoothingFactor, Register::DPP::PHA::RCCR2SmoothingFactor);
int temp = (DPPAlg >> Register::DPP::DPPAlgorithmControlBit::BaselineAvg.second) & 0x7; int temp = Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::BaselineAvg);
for(int i = 0; i < cbBaselineAvg->count(); i++){ for(int i = 0; i < cbBaselineAvg->count(); i++){
if( cbBaselineAvg->itemData(i).toInt() == temp) { if( cbBaselineAvg->itemData(i).toInt() == temp) {
cbBaselineAvg->setCurrentIndex(i); cbBaselineAvg->setCurrentIndex(i);
@ -641,7 +641,7 @@ void Scope::UpdatePanelFromMomeory(){
} }
} }
temp = (DPPAlg >> Register::DPP::DPPAlgorithmControlBit::PeakMean.second) & 0x3; temp = Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::PeakMean);
for(int i = 0; i < cbPeakAvg->count(); i++){ for(int i = 0; i < cbPeakAvg->count(); i++){
if( cbPeakAvg->itemData(i).toInt() == temp) { if( cbPeakAvg->itemData(i).toInt() == temp) {
cbPeakAvg->setCurrentIndex(i); cbPeakAvg->setCurrentIndex(i);
@ -649,11 +649,9 @@ void Scope::UpdatePanelFromMomeory(){
} }
} }
uint32_t BdCfg = digi[ID]->GetSettingFromMemory(Register::DPP::BoardConfiguration, ch); uint32_t BdCfg = digi[ID]->GetSettingFromMemory(Register::DPP::BoardConfiguration);
qDebug() << QString::number(BdCfg, 16); temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe1);
temp = (BdCfg >> Register::DPP::BoardConfigBit::AnalogProbe1.second) & 0x3;
for(int i = 0; i < cbAnaProbe1->count(); i++){ for(int i = 0; i < cbAnaProbe1->count(); i++){
if( cbAnaProbe1->itemData(i).toInt() == temp) { if( cbAnaProbe1->itemData(i).toInt() == temp) {
cbAnaProbe1->setCurrentIndex(i); cbAnaProbe1->setCurrentIndex(i);
@ -661,7 +659,7 @@ void Scope::UpdatePanelFromMomeory(){
break; break;
} }
} }
temp = (BdCfg >> Register::DPP::BoardConfigBit::AnalogProbe2.second) & 0x3; temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe2);
for(int i = 0; i < cbAnaProbe2->count(); i++){ for(int i = 0; i < cbAnaProbe2->count(); i++){
if( cbAnaProbe2->itemData(i).toInt() == temp) { if( cbAnaProbe2->itemData(i).toInt() == temp) {
cbAnaProbe2->setCurrentIndex(i); cbAnaProbe2->setCurrentIndex(i);
@ -669,7 +667,7 @@ void Scope::UpdatePanelFromMomeory(){
break; break;
} }
} }
temp = (BdCfg >> Register::DPP::BoardConfigBit::DigiProbel1.second) & 0x3; temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DigiProbel1);
for(int i = 0; i < cbDigiProbe1->count(); i++){ for(int i = 0; i < cbDigiProbe1->count(); i++){
if( cbDigiProbe1->itemData(i).toInt() == temp) { if( cbDigiProbe1->itemData(i).toInt() == temp) {
cbDigiProbe1->setCurrentIndex(i); cbDigiProbe1->setCurrentIndex(i);

View File

@ -1,7 +1,7 @@
#ifndef MACRO_H #ifndef MACRO_H
#define MACRO_H #define MACRO_H
#define MaxNPorts 1 #define MaxNPorts 2
#define MaxNBoards 1 #define MaxNBoards 1
#define MaxNDigitizer MaxNPorts * MaxNBoards #define MaxNDigitizer MaxNPorts * MaxNBoards