working on Scope with PSD
This commit is contained in:
parent
29c8c95d0d
commit
53c36185c9
71
Scope.cpp
71
Scope.cpp
|
@ -116,10 +116,11 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
|||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHAPanel();
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDPanel();
|
||||
|
||||
ReadSettingsFromBoard();
|
||||
//ReadSettingsFromBoard();
|
||||
|
||||
});
|
||||
|
||||
|
||||
bnReadSettingsFromBoard = new QPushButton("Refresh Settings", this);
|
||||
layout->addWidget(bnReadSettingsFromBoard, rowID, 2);
|
||||
connect(bnReadSettingsFromBoard, &QPushButton::clicked, this, &Scope::ReadSettingsFromBoard);
|
||||
|
@ -134,6 +135,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
|||
settingLayout->setSpacing(0);
|
||||
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHAPanel();
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDPanel();
|
||||
|
||||
}
|
||||
//================ Plot view
|
||||
|
@ -142,6 +144,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
|||
plotView->setRenderHints(QPainter::Antialiasing);
|
||||
layout->addWidget(plotView, rowID, 0, 1, 6);
|
||||
|
||||
|
||||
//================ Key binding
|
||||
rowID ++;
|
||||
QLabel * lbhints = new QLabel("Type 'r' to restore view, '+/-' Zoom in/out, arrow key to pan.", this);
|
||||
|
@ -186,11 +189,11 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
|||
layout->setColumnStretch(4, 1);
|
||||
layout->setColumnStretch(5, 1);
|
||||
|
||||
UpdatePanelFromMomeory();
|
||||
|
||||
bnScopeStart->setEnabled(true);
|
||||
bnScopeStop->setEnabled(false);
|
||||
|
||||
UpdatePanelFromMomeory();
|
||||
|
||||
enableSignalSlot = true;
|
||||
|
||||
}
|
||||
|
@ -345,6 +348,7 @@ void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const
|
|||
}
|
||||
|
||||
void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Reg para){
|
||||
|
||||
QLabel * lb = new QLabel(str, settingGroup);
|
||||
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
settingLayout->addWidget(lb, row, col);
|
||||
|
@ -363,6 +367,7 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re
|
|||
sb->setStyleSheet("color:blue");
|
||||
});
|
||||
|
||||
|
||||
connect(sb, &RSpinBox::returnPressed, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
if( sb->decimals() == 0 && sb->singleStep() != 1) {
|
||||
|
@ -534,6 +539,9 @@ void Scope::SetUpPHAPanel(){
|
|||
|
||||
void Scope::SetUpPSDPanel(){
|
||||
|
||||
enableSignalSlot = false;
|
||||
printf("==== %s \n", __func__);
|
||||
|
||||
int rowID = 0;
|
||||
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::RecordLength_G);
|
||||
SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::PreTrigger);
|
||||
|
@ -541,6 +549,7 @@ void Scope::SetUpPSDPanel(){
|
|||
sbDCOffset->setDecimals(2);
|
||||
SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, DPP::InputDynamicRange);
|
||||
|
||||
|
||||
rowID ++; //=============================================================
|
||||
SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0);
|
||||
cbPolarity->addItem("Positive", 0);
|
||||
|
@ -554,7 +563,7 @@ void Scope::SetUpPSDPanel(){
|
|||
SetUpSpinBox(sbLongGate, "Long Gate [ns] ", rowID, 4, DPP::PSD::LongGateWidth);
|
||||
SetUpSpinBox(sbGateOffset, "Gate Offset [ns] ", rowID, 6, DPP::PSD::GateOffset);
|
||||
|
||||
|
||||
enableSignalSlot = true;
|
||||
}
|
||||
|
||||
void Scope::EnableControl(bool enable){
|
||||
|
@ -607,20 +616,34 @@ void Scope::UpdateSpinBox(RSpinBox * &sb, const Reg para){
|
|||
void Scope::UpdatePanelFromMomeory(){
|
||||
|
||||
enableSignalSlot = false;
|
||||
printf("==== %s \n", __func__);
|
||||
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
|
||||
int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace,
|
||||
|
||||
unsigned int haha = digi[ID]->GetSettingFromMemory(DPP::RecordLength_G, ch);
|
||||
sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns / factor);
|
||||
|
||||
haha = digi[ID]->GetSettingFromMemory(DPP::PreTrigger, ch);
|
||||
sbPreTrigger->setValue(haha * DPP::PreTrigger.GetPartialStep() * ch2ns / factor);
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||
int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace,
|
||||
sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns / factor);
|
||||
}else{
|
||||
sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns);
|
||||
}
|
||||
|
||||
haha = digi[ID]->GetSettingFromMemory(DPP::ChannelDCOffset, ch);
|
||||
sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 );
|
||||
|
||||
UpdateComobox(cbDynamicRange, DPP::InputDynamicRange);
|
||||
UpdateSpinBox(sbPreTrigger, DPP::PreTrigger);
|
||||
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) UpdatePHAPanel();
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) UpdatePSDPanel();
|
||||
|
||||
}
|
||||
|
||||
void Scope::UpdatePHAPanel(){
|
||||
enableSignalSlot = false;
|
||||
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
|
||||
uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
|
||||
if( Digitizer::ExtractBits(DPPAlg, DPP::Bit_DPPAlgorithmControl_PHA::Polarity) ){
|
||||
|
@ -629,7 +652,6 @@ void Scope::UpdatePanelFromMomeory(){
|
|||
cbPolarity->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||
UpdateSpinBox(sbInputRiseTime, DPP::PHA::InputRiseTime);
|
||||
UpdateSpinBox(sbThreshold, DPP::PHA::TriggerThreshold);
|
||||
UpdateSpinBox(sbTriggerHoldOff, DPP::PHA::TriggerHoldOffWidth);
|
||||
|
@ -684,9 +706,28 @@ void Scope::UpdatePanelFromMomeory(){
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
enableSignalSlot = true;
|
||||
}
|
||||
|
||||
void Scope::UpdatePSDPanel(){
|
||||
enableSignalSlot = false;
|
||||
|
||||
printf("==== %s \n", __func__);
|
||||
|
||||
|
||||
// int ch = cbScopeCh->currentIndex();
|
||||
|
||||
// uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
|
||||
// if( Digitizer::ExtractBits(DPPAlg, DPP::Bit_DPPAlgorithmControl_PSD::Polarity) ){
|
||||
// cbPolarity->setCurrentIndex(1);
|
||||
// }else{
|
||||
// cbPolarity->setCurrentIndex(0);
|
||||
// }
|
||||
|
||||
// UpdateSpinBox(sbShortGate, DPP::PSD::ShortGateWidth);
|
||||
// UpdateSpinBox(sbLongGate, DPP::PSD::LongGateWidth);
|
||||
// UpdateSpinBox(sbGateOffset, DPP::PSD::GateOffset);
|
||||
|
||||
enableSignalSlot = true;
|
||||
}
|
||||
|
||||
|
@ -713,6 +754,14 @@ void Scope::ReadSettingsFromBoard(){
|
|||
|
||||
}
|
||||
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE){
|
||||
|
||||
digi[ID]->ReadRegister(DPP::PSD::ShortGateWidth);
|
||||
digi[ID]->ReadRegister(DPP::PSD::LongGateWidth);
|
||||
digi[ID]->ReadRegister(DPP::PSD::GateOffset);
|
||||
|
||||
}
|
||||
|
||||
UpdatePanelFromMomeory();
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user