simplify the update other panels machanism
This commit is contained in:
parent
7b237fabcb
commit
b914e05097
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -85,7 +85,7 @@
|
|||
},
|
||||
{
|
||||
"tag": "?",
|
||||
"color": "#0076FF",
|
||||
"color": "#DBFF33",
|
||||
"strikethrough": false,
|
||||
"backgroundColor": "transparent",
|
||||
"bold": false,
|
||||
|
|
|
@ -28,6 +28,16 @@ class RSpinBox : public QDoubleSpinBox{
|
|||
setFocusPolicy(Qt::StrongFocus);
|
||||
setDecimals(decimal);
|
||||
}
|
||||
|
||||
void SetToolTip(double min = -1){
|
||||
if( min == -1 ){
|
||||
setToolTip("(" + QString::number(minimum()) + " - " + QString::number(maximum()) + ", " + QString::number(singleStep()) + ")");
|
||||
}else{
|
||||
setToolTip("(" + QString::number(min) + " - " + QString::number(maximum()) + ", " + QString::number(singleStep()) + ")");
|
||||
}
|
||||
setToolTipDuration(-1);
|
||||
}
|
||||
|
||||
signals:
|
||||
void returnPressed();
|
||||
protected:
|
||||
|
|
|
@ -20,8 +20,6 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
setWindowTitle("SOLARIS Settings");
|
||||
setGeometry(0, 0, 1350, 800);
|
||||
|
||||
printf("%s\n", __func__);
|
||||
|
||||
this->digi = digi;
|
||||
this->nDigi = nDigi;
|
||||
this->mapping = mapping;
|
||||
|
@ -105,13 +103,48 @@ SOLARISpanel::SOLARISpanel(Digitizer2Gen **digi, unsigned short nDigi,
|
|||
connect(bnLoadSetting, &QPushButton::clicked, this, &SOLARISpanel::LoadSettings);
|
||||
mainLayout->addWidget(bnLoadSetting, rowIndex, 2);
|
||||
|
||||
QLabel * lbCoinTime = new QLabel("Coin. Time [ns]", this);
|
||||
QLabel * lbCoinTime = new QLabel("Coin. Time (all ch.) [ns]", this);
|
||||
lbCoinTime->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
mainLayout->addWidget(lbCoinTime, rowIndex, 3);
|
||||
|
||||
RSpinBox * sbCoinTime = new RSpinBox(this);
|
||||
sbCoinTime = new RSpinBox(this);
|
||||
sbCoinTime->setMinimum(-1);
|
||||
sbCoinTime->setMaximum(atof(PHA::CH::CoincidenceLength.GetAnswers()[1].first.c_str()));
|
||||
sbCoinTime->setSingleStep(atof(PHA::CH::CoincidenceLength.GetAnswers()[2].first.c_str()));
|
||||
sbCoinTime->setDecimals(0);
|
||||
sbCoinTime->SetToolTip(atof(PHA::CH::CoincidenceLength.GetAnswers()[1].first.c_str()));
|
||||
mainLayout->addWidget(sbCoinTime, rowIndex, 4);
|
||||
|
||||
connect(sbCoinTime, &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
sbCoinTime->setStyleSheet("color:blue;");
|
||||
});
|
||||
|
||||
connect(sbCoinTime, &RSpinBox::returnPressed, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
//printf("%s %d %d \n", para.GetPara().c_str(), index, spb->value());
|
||||
if( sbCoinTime->decimals() == 0 && sbCoinTime->singleStep() != 1) {
|
||||
double step = sbCoinTime->singleStep();
|
||||
double value = sbCoinTime->value();
|
||||
sbCoinTime->setValue( (std::round(value/step) * step) );
|
||||
}
|
||||
|
||||
for(int i = 0; i < (int) mapping.size(); i ++){
|
||||
if( i >= nDigi || digi[i]->IsDummy() || !digi[i]->IsConnected() ) return;
|
||||
QString msg;
|
||||
msg = QString::fromStdString(PHA::CH::CoincidenceLength.GetPara()) + "|DIG:"+ QString::number(digi[i]->GetSerialNumber());
|
||||
msg += ",CH:All = " + QString::number(sbCoinTime->value());
|
||||
if( digi[i]->WriteValue(PHA::CH::CoincidenceLength, std::to_string(sbCoinTime->value()))){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbCoinTime->setStyleSheet("");
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
sbCoinTime->setStyleSheet("color:red;");
|
||||
}
|
||||
}
|
||||
UpdatePanelFromMemory();
|
||||
});
|
||||
|
||||
///=================================
|
||||
rowIndex ++;
|
||||
QLabel * info = new QLabel("Only simple trigger is avalible. For complex trigger scheme, please use the setting panel.", this);
|
||||
|
@ -230,6 +263,7 @@ void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detID, QGridLayout *
|
|||
sbSetting[SettingID][digiID][chID]->setMinimum(atoi(SettingItems[SettingID].GetAnswers()[0].first.c_str()));
|
||||
sbSetting[SettingID][digiID][chID]->setMaximum(atoi(SettingItems[SettingID].GetAnswers()[1].first.c_str()));
|
||||
sbSetting[SettingID][digiID][chID]->setSingleStep(atoi(SettingItems[SettingID].GetAnswers()[2].first.c_str()));
|
||||
sbSetting[SettingID][digiID][chID]->SetToolTip();
|
||||
|
||||
layout0->addWidget(sbSetting[SettingID][digiID][chID], 2*i+1, 2);
|
||||
|
||||
|
@ -268,7 +302,8 @@ void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detID, QGridLayout *
|
|||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
}
|
||||
emit UpdateOtherPanels();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
});
|
||||
|
||||
///===================== for the OnOff CheckBox
|
||||
|
@ -285,7 +320,8 @@ void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detID, QGridLayout *
|
|||
}
|
||||
enableSignalSlot = true;
|
||||
|
||||
emit UpdateOtherPanels();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
|
||||
});
|
||||
|
||||
|
@ -367,10 +403,11 @@ void SOLARISpanel::CreateDetGroup(int SettingID, QList<int> detID, QGridLayout *
|
|||
}
|
||||
}
|
||||
|
||||
UpdateOtherPanels();
|
||||
|
||||
});
|
||||
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
|
||||
}
|
||||
layout->addWidget(groupbox, row, col);
|
||||
}
|
||||
|
@ -382,14 +419,18 @@ void SOLARISpanel::RefreshSettings(){
|
|||
digi[i]->ReadAllSettings();
|
||||
}
|
||||
}
|
||||
UpdatePanel();
|
||||
UpdatePanelFromMemory();
|
||||
}
|
||||
|
||||
void SOLARISpanel::UpdatePanel(){
|
||||
void SOLARISpanel::UpdatePanelFromMemory(){
|
||||
|
||||
if( !isVisible() ) return;
|
||||
|
||||
enableSignalSlot = false;
|
||||
|
||||
printf("%s\n", __func__);
|
||||
printf("SOLARISpanel::%s\n", __func__);
|
||||
|
||||
//@===================== LineEdit and SpinBox
|
||||
for( int SettingID = 0; SettingID < (int) SettingItems.size() ; SettingID ++){
|
||||
for( int DigiID = 0; DigiID < (int) mapping.size(); DigiID ++){
|
||||
if( DigiID >= nDigi ) continue;;
|
||||
|
@ -410,14 +451,17 @@ void SOLARISpanel::UpdatePanel(){
|
|||
|
||||
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID);
|
||||
chkOnOff[SettingID][DigiID][chID]->setChecked( haha == "True" ? true : false);
|
||||
|
||||
leDisplay[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
||||
sbSetting[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
|
||||
|
||||
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//@===================== Trigger
|
||||
for( int k = 0; k < detIDList.size() ; k++){
|
||||
if( detIDList[k][0] >= detMaxID[0] || 0 > detIDList[k][0]) continue;
|
||||
if( detIDList[k][0] >= detMaxID[0] || 0 > detIDList[k][0]) continue; //! only for array
|
||||
|
||||
//if( detIDList[k].size() <= 2) continue;
|
||||
std::vector<unsigned long> triggerMap;
|
||||
|
@ -502,7 +546,35 @@ void SOLARISpanel::UpdatePanel(){
|
|||
if( !isAcceptableSetting ) cbTrigger[detTypeID][detIDList[k][0]]->setCurrentText("Others");
|
||||
}
|
||||
|
||||
//@===================== Coin. time
|
||||
std::vector<int> coinTime;
|
||||
|
||||
for( int i = 0; i < detIDList.size(); i++){
|
||||
for( int j = 1; j < detIDList[i].size(); j++){
|
||||
int digiID = detIDList[i][j] >> 8;
|
||||
int chID = (detIDList[i][j] & 0xFF);
|
||||
if( digiID >= nDigi ) continue;
|
||||
if( digi[digiID]->IsDummy() || !digi[digiID]->IsConnected() ) continue;
|
||||
coinTime.push_back( atoi(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceLength, chID).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
bool isSameCoinTime = true;
|
||||
for( int i = 1; i < (int) coinTime.size(); i++){
|
||||
if( coinTime[i] != coinTime[0]) {
|
||||
isSameCoinTime = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( isSameCoinTime ){
|
||||
sbCoinTime->setValue(coinTime[0]);
|
||||
}else{
|
||||
sbCoinTime->setValue(-1);
|
||||
}
|
||||
|
||||
enableSignalSlot = true;
|
||||
|
||||
}
|
||||
|
||||
void SOLARISpanel::UpdateThreshold(){
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
#include "CustomWidgets.h"
|
||||
#include "macro.h"
|
||||
|
||||
#define MaxSettingItem 3
|
||||
#define MaxDetType 10
|
||||
#define MaxDetID 60
|
||||
#define MaxSettingItem 3
|
||||
|
||||
class SOLARISpanel : public QWidget{
|
||||
Q_OBJECT
|
||||
|
@ -45,11 +45,11 @@ private slots:
|
|||
void LoadSettings();
|
||||
|
||||
public slots:
|
||||
void UpdatePanel();
|
||||
void UpdateThreshold();
|
||||
void UpdatePanelFromMemory();
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
void UpdateOtherPanels();
|
||||
void SendLogMsg(const QString str);
|
||||
|
||||
|
@ -66,6 +66,8 @@ private:
|
|||
|
||||
int FindDetTypID(QList<int> detIDListElement);
|
||||
|
||||
RSpinBox * sbCoinTime;
|
||||
|
||||
QCheckBox * chkAll; // checkBox for all setting on that tab;
|
||||
QCheckBox * chkAlle;
|
||||
QCheckBox * chkAllxf;
|
||||
|
|
|
@ -348,6 +348,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
dsbBdVetoWidth[iDigi]->setMinimum(0);
|
||||
dsbBdVetoWidth[iDigi]->setMaximum(34359738360);
|
||||
dsbBdVetoWidth[iDigi]->setSingleStep(20);
|
||||
dsbBdVetoWidth[iDigi]->SetToolTip();
|
||||
boardLayout->addWidget(dsbBdVetoWidth[iDigi], rowId, 5);
|
||||
connect(dsbBdVetoWidth[iDigi], &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
@ -386,6 +387,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
dsbVolatileClockOutDelay[iDigi]->setMaximum(18888.888);
|
||||
dsbVolatileClockOutDelay[iDigi]->setSingleStep(74.074);
|
||||
dsbVolatileClockOutDelay[iDigi]->setValue(0);
|
||||
dsbVolatileClockOutDelay[iDigi]->SetToolTip();
|
||||
boardLayout->addWidget(dsbVolatileClockOutDelay[iDigi], rowId, 5);
|
||||
connect(dsbVolatileClockOutDelay[iDigi], &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
@ -422,6 +424,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
dsbClockOutDelay[iDigi]->setMaximum(18888.888);
|
||||
dsbClockOutDelay[iDigi]->setValue(0);
|
||||
dsbClockOutDelay[iDigi]->setSingleStep(74.074);
|
||||
dsbClockOutDelay[iDigi]->SetToolTip();
|
||||
boardLayout->addWidget(dsbClockOutDelay[iDigi], rowId, 5);
|
||||
connect(dsbClockOutDelay[iDigi], &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
@ -482,6 +485,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
VGA[iDigi][k]->setMinimum(0);
|
||||
VGA[iDigi][k]->setMaximum(40);
|
||||
VGA[iDigi][k]->setSingleStep(0.5);
|
||||
VGA[iDigi][k]->SetToolTip();
|
||||
|
||||
vgaLayout->addWidget(VGA[iDigi][k], 0, 2*k+1);
|
||||
connect(VGA[iDigi][k], &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
@ -543,7 +548,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
connect(cbChPick[iDigi], &RComboBox::currentIndexChanged, this, [=](){
|
||||
int index = cbChPick[ID]->currentData().toInt();
|
||||
if(index == -1) {
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
return;
|
||||
}else{
|
||||
enableSignalSlot = false;
|
||||
|
@ -593,7 +598,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index);
|
||||
|
||||
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
|
||||
leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16));
|
||||
leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
|
||||
enableSignalSlot = true;
|
||||
}
|
||||
|
@ -620,16 +625,16 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
SetupComboBox(cbbLowFilter[iDigi][ch], PHA::CH::EnergyFilterLowFreqFilter, -1, true, "Low Freq. Filter", layout1, rowID, 2);
|
||||
|
||||
rowID ++;
|
||||
SetupSpinBox(spbDCOffset[iDigi][ch], PHA::CH::DC_Offset, -1, false, "DC Offset [%]", layout1, rowID, 0);
|
||||
SetupSpinBox(spbThreshold[iDigi][ch], PHA::CH::TriggerThreshold, -1, false, "Threshold [LSB]", layout1, rowID, 2);
|
||||
SetupSpinBox(spbDCOffset[iDigi][ch], PHA::CH::DC_Offset, -1, true, "DC Offset [%]", layout1, rowID, 0);
|
||||
SetupSpinBox(spbThreshold[iDigi][ch], PHA::CH::TriggerThreshold, -1, true, "Threshold [LSB]", layout1, rowID, 2);
|
||||
|
||||
rowID ++;
|
||||
SetupSpinBox(spbInputRiseTime[iDigi][ch], PHA::CH::TimeFilterRiseTime, -1, false, "Input Rise Time [ns]", layout1, rowID, 0);
|
||||
SetupSpinBox(spbTriggerGuard[iDigi][ch], PHA::CH::TimeFilterRetriggerGuard, -1, false, "Trigger Guard [ns]", layout1, rowID, 2);
|
||||
SetupSpinBox(spbInputRiseTime[iDigi][ch], PHA::CH::TimeFilterRiseTime, -1, true, "Input Rise Time [ns]", layout1, rowID, 0);
|
||||
SetupSpinBox(spbTriggerGuard[iDigi][ch], PHA::CH::TimeFilterRetriggerGuard, -1, true, "Trigger Guard [ns]", layout1, rowID, 2);
|
||||
|
||||
rowID ++;
|
||||
SetupSpinBox(spbRecordLength[iDigi][ch], PHA::CH::RecordLength, -1, false, "Record Length [ns]", layout1, rowID, 0);
|
||||
SetupSpinBox(spbPreTrigger[iDigi][ch], PHA::CH::PreTrigger, -1, false, "Pre Trigger [ns]", layout1, rowID, 2);
|
||||
SetupSpinBox(spbRecordLength[iDigi][ch], PHA::CH::RecordLength, -1, true, "Record Length [ns]", layout1, rowID, 0);
|
||||
SetupSpinBox(spbPreTrigger[iDigi][ch], PHA::CH::PreTrigger, -1, true, "Pre Trigger [ns]", layout1, rowID, 2);
|
||||
|
||||
}
|
||||
|
||||
|
@ -640,21 +645,21 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
//------------------------------
|
||||
rowID = 0;
|
||||
SetupSpinBox(spbTrapRiseTime[iDigi][ch], PHA::CH::EnergyFilterRiseTime, -1, false, "Trap. Rise Time [ns]", layout3, rowID, 0);
|
||||
SetupSpinBox(spbTrapFlatTop[iDigi][ch], PHA::CH::EnergyFilterFlatTop, -1, false, "Trap. Flat Top [ns]", layout3, rowID, 2);
|
||||
SetupSpinBox(spbTrapPoleZero[iDigi][ch], PHA::CH::EnergyFilterPoleZero, -1, false, "Trap. Pole Zero [ns]", layout3, rowID, 4);
|
||||
SetupSpinBox(spbTrapRiseTime[iDigi][ch], PHA::CH::EnergyFilterRiseTime, -1, true, "Trap. Rise Time [ns]", layout3, rowID, 0);
|
||||
SetupSpinBox(spbTrapFlatTop[iDigi][ch], PHA::CH::EnergyFilterFlatTop, -1, true, "Trap. Flat Top [ns]", layout3, rowID, 2);
|
||||
SetupSpinBox(spbTrapPoleZero[iDigi][ch], PHA::CH::EnergyFilterPoleZero, -1, true, "Trap. Pole Zero [ns]", layout3, rowID, 4);
|
||||
|
||||
//------------------------------
|
||||
rowID ++;
|
||||
SetupSpinBox(spbPeaking[iDigi][ch], PHA::CH::EnergyFilterPeakingPosition, -1, false, "Peaking [%]", layout3, rowID, 0);
|
||||
SetupSpinBox(spbBaselineGuard[iDigi][ch], PHA::CH::EnergyFilterBaselineGuard, -1, false, "Baseline Guard [ns]", layout3, rowID, 2);
|
||||
SetupSpinBox(spbPileupGuard[iDigi][ch], PHA::CH::EnergyFilterPileUpGuard, -1, false, "Pile-up Guard [ns]", layout3, rowID, 4);
|
||||
SetupSpinBox(spbPeaking[iDigi][ch], PHA::CH::EnergyFilterPeakingPosition, -1, true, "Peaking [%]", layout3, rowID, 0);
|
||||
SetupSpinBox(spbBaselineGuard[iDigi][ch], PHA::CH::EnergyFilterBaselineGuard, -1, true, "Baseline Guard [ns]", layout3, rowID, 2);
|
||||
SetupSpinBox(spbPileupGuard[iDigi][ch], PHA::CH::EnergyFilterPileUpGuard, -1, true, "Pile-up Guard [ns]", layout3, rowID, 4);
|
||||
|
||||
//------------------------------
|
||||
rowID ++;
|
||||
SetupComboBox(cbbPeakingAvg[iDigi][ch], PHA::CH::EnergyFilterPeakingAvg, -1, true, "Peak Avg", layout3, rowID, 0);
|
||||
SetupComboBox(cbbBaselineAvg[iDigi][ch], PHA::CH::EnergyFilterBaselineAvg, -1, true, "Baseline Avg", layout3, rowID, 2);
|
||||
SetupSpinBox(spbFineGain[iDigi][ch], PHA::CH::EnergyFilterFineGain, -1, false, "Fine Gain", layout3, rowID, 4);
|
||||
SetupSpinBox(spbFineGain[iDigi][ch], PHA::CH::EnergyFilterFineGain, -1, true, "Fine Gain", layout3, rowID, 4);
|
||||
|
||||
}
|
||||
|
||||
|
@ -694,10 +699,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
rowID ++;
|
||||
SetupComboBox(cbbChVetoSrc[iDigi][ch], PHA::CH::ChannelVetoSource, -1, true, "Veto Source", layout5, rowID, 0);
|
||||
|
||||
QLabel * lbTrgMsk = new QLabel("Trigger Mask :");
|
||||
QLabel * lbTrgMsk = new QLabel("Trigger Mask");
|
||||
lbTrgMsk->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
layout5->addWidget(lbTrgMsk, rowID, 2);
|
||||
leTriggerMask[iDigi][ch] = new QLineEdit(this);
|
||||
leTriggerMask[iDigi][ch]->setToolTip("Both Hex or Dec is OK.");
|
||||
layout5->addWidget(leTriggerMask[iDigi][ch], rowID, 3);
|
||||
|
||||
connect(leTriggerMask[iDigi][ch], &QLineEdit::textChanged, this, [=](){
|
||||
|
@ -709,7 +715,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
if( !enableSignalSlot ) return;
|
||||
int index = cbChPick[ID]->currentData().toInt();
|
||||
|
||||
QString SixteenBaseValue = "0x" + QString::number(Utility::TenBase(leTriggerMask[ID][ch]->text().toStdString()), 16);
|
||||
QString SixteenBaseValue = "0x" + QString::number(Utility::TenBase(leTriggerMask[ID][ch]->text().toStdString()), 16).toUpper();
|
||||
leTriggerMask[ID][ch]->setText(SixteenBaseValue);
|
||||
|
||||
QString msg;
|
||||
|
@ -720,7 +726,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
if( digi[ID]->WriteValue(PHA::CH::ChannelsTriggerMask, SixteenBaseValue.toStdString(), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
leTriggerMask[ID][ch]->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
leTriggerMask[ID][ch]->setStyleSheet("color:red;");
|
||||
|
@ -734,8 +741,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
//------------------------------
|
||||
rowID ++;
|
||||
SetupSpinBox(spbCoinLength[iDigi][ch], PHA::CH::CoincidenceLength, -1, false, "Coin. Length [ns]", layout5, rowID, 0);
|
||||
SetupSpinBox(spbADCVetoWidth[iDigi][ch], PHA::CH::ADCVetoWidth, -1, false, "ADC Veto Length [ns]", layout5, rowID, 2);
|
||||
SetupSpinBox(spbCoinLength[iDigi][ch], PHA::CH::CoincidenceLength, -1, true, "Coin. Length [ns]", layout5, rowID, 0);
|
||||
SetupSpinBox(spbADCVetoWidth[iDigi][ch], PHA::CH::ADCVetoWidth, -1, true, "ADC Veto Length [ns]", layout5, rowID, 2);
|
||||
|
||||
for( int i = 0; i < layout5->columnCount(); i++) layout5->setColumnStretch(i, 1);
|
||||
|
||||
|
@ -753,8 +760,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
//------------------------------
|
||||
rowID ++;
|
||||
SetupSpinBox(spbEnergySkimLow[iDigi][ch], PHA::CH::EnergySkimLowDiscriminator, -1, false, "Energy Skim Low", layout6, rowID, 0);
|
||||
SetupSpinBox(spbEnergySkimHigh[iDigi][ch], PHA::CH::EnergySkimHighDiscriminator, -1, false, "Energy Skim High", layout6, rowID, 2);
|
||||
SetupSpinBox(spbEnergySkimLow[iDigi][ch], PHA::CH::EnergySkimLowDiscriminator, -1, true, "Energy Skim Low", layout6, rowID, 0);
|
||||
SetupSpinBox(spbEnergySkimHigh[iDigi][ch], PHA::CH::EnergySkimHighDiscriminator, -1, true, "Energy Skim High", layout6, rowID, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -880,6 +887,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
|
||||
for( int ch = 0; ch < digi[ID]->GetNChannels() + 1; ch++) {
|
||||
//send UpdateOtherPanels signal
|
||||
/*
|
||||
connect(spbDCOffset[iDigi][ch], &RSpinBox::returnPressed, this, &DigiSettingsPanel::UpdateOtherPanels);
|
||||
connect(spbRecordLength[iDigi][ch], &RSpinBox::returnPressed, this, &DigiSettingsPanel::UpdateOtherPanels);
|
||||
connect(spbPreTrigger[iDigi][ch], &RSpinBox::returnPressed, this, &DigiSettingsPanel::UpdateOtherPanels);
|
||||
|
@ -905,7 +913,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
connect(cbbDigProbe1[iDigi][ch], &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::UpdateOtherPanels);
|
||||
connect(cbbDigProbe2[iDigi][ch], &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::UpdateOtherPanels);
|
||||
connect(cbbDigProbe3[iDigi][ch], &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::UpdateOtherPanels);
|
||||
|
||||
*/
|
||||
//----- SyncBox
|
||||
connect(cbbOnOff[iDigi][ch], &RComboBox::currentIndexChanged, this, [=](){ SyncComboBox(cbbOnOff, ch);});
|
||||
connect(spbDCOffset[iDigi][ch], &RSpinBox::returnPressed, this, [=](){ SyncSpinBox(spbDCOffset, ch);});
|
||||
|
@ -1150,7 +1158,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cbBdAns->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
leBdSettingsRead->setText("fail write value");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
|
@ -1179,7 +1188,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbBdSettingsWrite->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
leBdSettingsRead->setText("fail write value");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
|
@ -1204,7 +1214,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbBdSettingsWrite->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
leBdSettingsRead->setText("fail write value");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
|
@ -1266,7 +1277,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cbChSettingsWrite->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
leChSettingsRead->setText("fail write value");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
|
@ -1297,7 +1309,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbChSettingsWrite->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
leChSettingsRead->setText("fail write value");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
|
@ -1322,7 +1335,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para)));
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sbChSettingsWrite->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
leChSettingsRead->setText("fail write value");
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
|
@ -1454,7 +1468,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
|
|||
connect(tabWidget, &QTabWidget::currentChanged, this, [=](int index){
|
||||
if( index < nDigi) {
|
||||
ID = index;
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
}else{
|
||||
ID = 0;
|
||||
}
|
||||
|
@ -1513,9 +1527,11 @@ void DigiSettingsPanel::onTriggerClick(int haha){
|
|||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
digi[iDig]->ReadValue(PHA::CH::ChannelsTriggerMask, ch);
|
||||
ShowSettingsToPanel();
|
||||
}
|
||||
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
|
||||
}
|
||||
|
||||
void DigiSettingsPanel::ReadTriggerMap(){
|
||||
|
@ -1550,12 +1566,12 @@ void DigiSettingsPanel::ReadTriggerMap(){
|
|||
|
||||
void DigiSettingsPanel::RefreshSettings(){
|
||||
digi[ID]->ReadAllSettings();
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
}
|
||||
|
||||
void DigiSettingsPanel::EnableControl(){
|
||||
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
|
||||
bool enable = !digi[ID]->IsAcqOn();
|
||||
|
||||
|
@ -1651,7 +1667,8 @@ void DigiSettingsPanel::LoadSettings(){
|
|||
|
||||
if( digi[ID]->LoadSettingsFromFile(fileName.toStdString().c_str()) ){
|
||||
SendLogMsg("Loaded settings file " + fileName + " for Digi-" + QString::number(digi[ID]->GetSerialNumber()));
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg("Fail to Loaded settings file " + fileName + " for Digi-" + QString::number(digi[ID]->GetSerialNumber()));
|
||||
}
|
||||
|
@ -1664,11 +1681,13 @@ void DigiSettingsPanel::SetDefaultPHASettigns(){
|
|||
RefreshSettings();
|
||||
}
|
||||
|
||||
void DigiSettingsPanel::ShowSettingsToPanel(){
|
||||
void DigiSettingsPanel::UpdatePanelFromMemory(){
|
||||
|
||||
if( !isVisible() ) return;
|
||||
|
||||
enableSignalSlot = false;
|
||||
|
||||
printf("%s Digi-%d\n", __func__, digi[ID]->GetSerialNumber());
|
||||
printf("DigiSettingsPanel::%s Digi-%d\n", __func__, digi[ID]->GetSerialNumber());
|
||||
|
||||
for (unsigned short j = 0; j < (unsigned short) infoIndex.size(); j++){
|
||||
leInfo[ID][j]->setText(QString::fromStdString(digi[ID]->GetSettingValue(infoIndex[j].second)));
|
||||
|
@ -1821,7 +1840,7 @@ void DigiSettingsPanel::ShowSettingsToPanel(){
|
|||
}
|
||||
}
|
||||
|
||||
if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16));
|
||||
if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16).toUpper());
|
||||
}
|
||||
|
||||
enableSignalSlot = true;
|
||||
|
@ -1949,7 +1968,8 @@ void DigiSettingsPanel::SetupComboBox(RComboBox *&cbb, const Reg para, int ch_in
|
|||
if( digi[ID]->WriteValue(para, cbb->currentData().toString().toStdString(), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cbb->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
cbb->setStyleSheet("color:red;");
|
||||
|
@ -1968,11 +1988,13 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
|
|||
spb->setMinimum(atof( para.GetAnswers()[0].first.c_str()));
|
||||
}
|
||||
spb->setMaximum(atof( para.GetAnswers()[1].first.c_str()));
|
||||
|
||||
if( para.GetAnswers().size() >= 3 ) {
|
||||
spb->setSingleStep(atof(para.GetAnswers()[2].first.c_str()));
|
||||
}else{
|
||||
printf("--- missed. %s\n", para.GetPara().c_str());
|
||||
}
|
||||
spb->SetToolTip( atof( para.GetAnswers()[0].first.c_str()));
|
||||
layout->addWidget(spb, row, col + 1, srow, scol);
|
||||
|
||||
connect(spb, &RSpinBox::valueChanged, this, [=](){
|
||||
|
@ -1995,7 +2017,8 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
|
|||
if( digi[ID]->WriteValue(para, std::to_string(spb->value()), index)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
spb->setStyleSheet("");
|
||||
ShowSettingsToPanel();
|
||||
UpdatePanelFromMemory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
spb->setStyleSheet("color:red;");
|
||||
|
@ -2053,7 +2076,6 @@ void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxNumberOfChannel+1], in
|
|||
}
|
||||
|
||||
//printf("%d =? %d \n", count, nCh);
|
||||
|
||||
enableSignalSlot = false;
|
||||
if( count != nCh ){
|
||||
spb[ID][nCh]->setValue(-1);
|
||||
|
|
|
@ -40,13 +40,13 @@ private slots:
|
|||
void RefreshSettings(); // this read digitizer and ShowSettingToPanel
|
||||
|
||||
public slots:
|
||||
void ShowSettingsToPanel();
|
||||
void EnableControl();
|
||||
void UpdatePanelFromMemory();
|
||||
|
||||
signals:
|
||||
|
||||
void SendLogMsg(const QString &msg);
|
||||
void UpdateOtherPanels();
|
||||
void SendLogMsg(const QString &msg);
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -70,10 +70,6 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
scope = nullptr;
|
||||
digiSetting = nullptr;
|
||||
|
||||
ConnectScopeAndSetting = false;
|
||||
ConnectScopeAndSolaris = false;
|
||||
ConnectSettingAndSolaris = false;
|
||||
|
||||
QWidget * mainLayoutWidget = new QWidget(this);
|
||||
setCentralWidget(mainLayoutWidget);
|
||||
QVBoxLayout * layoutMain = new QVBoxLayout(mainLayoutWidget);
|
||||
|
@ -713,6 +709,7 @@ void MainWindow::OpenScope(){
|
|||
connect(scope, &Scope::CloseWindow, this, [=](){ bnStartACQ->setEnabled(true); });
|
||||
connect(scope, &Scope::UpdateScalar, this, &MainWindow::UpdateScalar);
|
||||
connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
|
||||
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanel(0);});
|
||||
connect(scope, &Scope::TellACQOnOff, this, [=](const bool onOff){
|
||||
if( influx ){
|
||||
influx->ClearDataPointsBuffer();
|
||||
|
@ -726,20 +723,10 @@ void MainWindow::OpenScope(){
|
|||
influx->AddDataPoint("StartStop value=1");
|
||||
influx->WriteData(DatabaseName.toStdString());
|
||||
}
|
||||
|
||||
if( digiSetting && ConnectScopeAndSetting ) {
|
||||
connect(scope, &Scope::UpdateOtherPanels, digiSetting, &DigiSettingsPanel::ShowSettingsToPanel);
|
||||
if( digiSetting) {
|
||||
connect(scope, &Scope::TellSettingsPanelControlOnOff, digiSetting, &DigiSettingsPanel::EnableControl);
|
||||
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, scope, &Scope::ReadScopeSettings);
|
||||
ConnectScopeAndSetting = true;
|
||||
}
|
||||
if( digiSetting) digiSetting->EnableControl();
|
||||
|
||||
if( solarisSetting && !ConnectScopeAndSolaris ){
|
||||
connect(scope, &Scope::UpdateOtherPanels, solarisSetting, &SOLARISpanel::UpdatePanel);
|
||||
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, scope, &Scope::ReadScopeSettings);
|
||||
ConnectScopeAndSolaris = true;
|
||||
}
|
||||
digiSetting->EnableControl();
|
||||
}
|
||||
|
||||
}else{
|
||||
scope->show();
|
||||
|
@ -757,42 +744,18 @@ void MainWindow::OpenDigitizersSettings(){
|
|||
if( digiSetting == NULL){
|
||||
digiSetting = new DigiSettingsPanel(digi, nDigi);
|
||||
connect(digiSetting, &DigiSettingsPanel::SendLogMsg, this, &MainWindow::LogMsg);
|
||||
|
||||
if( scope && !ConnectScopeAndSetting) {
|
||||
connect(scope, &Scope::UpdateOtherPanels, digiSetting, &DigiSettingsPanel::ShowSettingsToPanel);
|
||||
connect(scope, &Scope::TellSettingsPanelControlOnOff, digiSetting, &DigiSettingsPanel::EnableControl);
|
||||
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, scope, &Scope::ReadScopeSettings);
|
||||
ConnectScopeAndSetting = true;
|
||||
}
|
||||
|
||||
if( solarisSetting && !ConnectSettingAndSolaris){
|
||||
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, solarisSetting, &SOLARISpanel::UpdatePanel);
|
||||
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, digiSetting, &DigiSettingsPanel::ShowSettingsToPanel);
|
||||
ConnectSettingAndSolaris = true;
|
||||
}
|
||||
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(1);});
|
||||
|
||||
}else{
|
||||
digiSetting->show();
|
||||
}
|
||||
digiSetting->UpdatePanelFromMemory();
|
||||
}
|
||||
|
||||
//^###################################################################### Open SOLARIS setting panel
|
||||
void MainWindow::OpenSOLARISpanel(){
|
||||
solarisSetting->show();
|
||||
solarisSetting->UpdatePanel();
|
||||
|
||||
if( digiSetting && !ConnectSettingAndSolaris){
|
||||
connect(digiSetting, &DigiSettingsPanel::UpdateOtherPanels, solarisSetting, &SOLARISpanel::UpdatePanel);
|
||||
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, digiSetting, &DigiSettingsPanel::ShowSettingsToPanel);
|
||||
ConnectSettingAndSolaris = true;
|
||||
}
|
||||
|
||||
if( scope && !ConnectScopeAndSolaris){
|
||||
connect(scope, &Scope::UpdateOtherPanels, solarisSetting, &SOLARISpanel::UpdatePanel);
|
||||
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, scope, &Scope::ReadScopeSettings);
|
||||
ConnectScopeAndSolaris = true;
|
||||
}
|
||||
|
||||
solarisSetting->UpdatePanelFromMemory();
|
||||
}
|
||||
|
||||
bool MainWindow::CheckSOLARISpanelOK(){
|
||||
|
@ -864,11 +827,6 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
|||
}
|
||||
file.close();
|
||||
|
||||
//if( (int) mapping.size() > nDigi){
|
||||
// LogMsg("Num. of Digitizer in the Mapping is more than Opened DIgitizer.");
|
||||
// return false;
|
||||
//}
|
||||
|
||||
LogMsg("Mapping.h | Num. Digi : " + QString::number(mapping.size()));
|
||||
for( int i = 0 ; i < (int) mapping.size(); i ++){
|
||||
if( i < nDigi ){
|
||||
|
@ -889,12 +847,34 @@ bool MainWindow::CheckSOLARISpanelOK(){
|
|||
//@============= Create SOLAIRS panel
|
||||
solarisSetting = new SOLARISpanel(digi, nDigi, mapping, detType, detMaxID);
|
||||
connect(solarisSetting, &SOLARISpanel::SendLogMsg, this, &MainWindow::LogMsg);
|
||||
connect(solarisSetting, &SOLARISpanel::UpdateOtherPanels, this, [=](){ UpdateAllPanel(2);});
|
||||
|
||||
if( solarisSetting == nullptr) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::UpdateAllPanel(int panelID){
|
||||
|
||||
printf("%s %d\n", __func__, panelID);
|
||||
|
||||
switch (panelID) {
|
||||
case 0 :{
|
||||
if( digiSetting && digiSetting->isVisible() ) digiSetting->UpdatePanelFromMemory();
|
||||
if( solarisSetting && solarisSetting->isVisible() ) solarisSetting->UpdatePanelFromMemory();
|
||||
};break;
|
||||
case 1 :{
|
||||
if( scope && scope->isVisible() ) scope->ReadScopeSettings();
|
||||
if( solarisSetting && solarisSetting->isVisible() ) solarisSetting->UpdatePanelFromMemory();
|
||||
};break;
|
||||
case 2 :{
|
||||
if( scope && scope->isVisible() ) scope->ReadScopeSettings();
|
||||
if( digiSetting && digiSetting->isVisible() ) digiSetting->UpdatePanelFromMemory();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//^###################################################################### Open Scaler, when DAQ is running
|
||||
void MainWindow::OpenScaler(){
|
||||
scalar->show();
|
||||
|
|
|
@ -39,7 +39,6 @@ public:
|
|||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
void OpenDigitizers();
|
||||
|
@ -183,9 +182,7 @@ private:
|
|||
unsigned long oldTimeStamp[MaxNumberOfDigitizer][MaxNumberOfChannel];
|
||||
|
||||
//@------ connection between pannels
|
||||
bool ConnectScopeAndSetting;
|
||||
bool ConnectScopeAndSolaris;
|
||||
bool ConnectSettingAndSolaris;
|
||||
void UpdateAllPanel(int panelID);
|
||||
|
||||
};
|
||||
|
||||
|
|
68
scope.cpp
68
scope.cpp
|
@ -85,7 +85,6 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
|||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
|
||||
digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
|
||||
ReadScopeSettings();
|
||||
UpdateOtherPanels();
|
||||
digiMTX[iDigi].unlock();
|
||||
});
|
||||
|
||||
|
@ -113,6 +112,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
|
|||
connect(bnScopeReadSettings, &QPushButton::clicked, this, [=](){
|
||||
if( !allowChange ) return;
|
||||
ReadScopeSettings();
|
||||
UpdateOtherPanels();
|
||||
});
|
||||
|
||||
//TODO----- add copy settings and paste settings
|
||||
|
@ -327,13 +327,55 @@ Scope::~Scope(){
|
|||
|
||||
void Scope::ReadScopeSettings(){
|
||||
|
||||
int iDigi = cbScopeDigi->currentIndex();
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
if( !isVisible() ) return;
|
||||
|
||||
if( !digi[iDigi] && digi[iDigi]->IsDummy() ) return;
|
||||
int iDigi = cbScopeDigi->currentIndex();
|
||||
if( !digi[iDigi] || digi[iDigi]->IsDummy() || !digi[iDigi]->IsConnected()) return;
|
||||
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveAnalogProbe0, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveAnalogProbe1, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe0, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe1, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe2, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveDigitalProbe3, ch);
|
||||
|
||||
digi[iDigi]->ReadValue(PHA::CH::Polarity, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::WaveResolution, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPeakingAvg, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterBaselineAvg, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterLowFreqFilter, ch);
|
||||
|
||||
digi[iDigi]->ReadValue(PHA::CH::RecordLength, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::PreTrigger, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::DC_Offset, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::TriggerThreshold, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::TimeFilterRiseTime, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::TimeFilterRetriggerGuard, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterRiseTime, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterFlatTop, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPoleZero, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterFineGain, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPeakingPosition, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterBaselineGuard, ch);
|
||||
digi[iDigi]->ReadValue(PHA::CH::EnergyFilterPileUpGuard, ch);
|
||||
|
||||
UpdateSettingsFromMemeory();
|
||||
|
||||
}
|
||||
|
||||
void Scope::UpdateSettingsFromMemeory(){
|
||||
if( !isVisible() ) return;
|
||||
|
||||
printf("Scope::%s\n", __func__);
|
||||
|
||||
int iDigi = cbScopeDigi->currentIndex();
|
||||
if( !digi[iDigi] || digi[iDigi]->IsDummy() || !digi[iDigi]->IsConnected()) return;
|
||||
|
||||
allowChange = false;
|
||||
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
|
||||
for( int i = 0 ; i < 2; i++){
|
||||
ScopeReadComboBoxValue(iDigi, ch, cbAnaProbe[i], PHA::CH::AnalogProbe[i]);
|
||||
}
|
||||
|
@ -375,6 +417,7 @@ void Scope::ReadScopeSettings(){
|
|||
sbBaselineGuard->setStyleSheet("");
|
||||
sbPileUpGuard->setStyleSheet("");
|
||||
|
||||
|
||||
allowChange = true;
|
||||
}
|
||||
|
||||
|
@ -550,12 +593,12 @@ void Scope::ScopeControlOnOff(bool on){
|
|||
}
|
||||
|
||||
void Scope::ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara){
|
||||
std::string ans = digi[iDigi]->ReadValue(digPara, ch);
|
||||
std::string ans = digi[iDigi]->GetSettingValue(digPara, ch);
|
||||
sb->setValue(atoi(ans.c_str()));
|
||||
}
|
||||
|
||||
void Scope::ScopeReadComboBoxValue(int iDigi, int ch, RComboBox *cb, const Reg digPara){
|
||||
std::string ans = digi[iDigi]->ReadValue(digPara, ch);
|
||||
std::string ans = digi[iDigi]->GetSettingValue(digPara, ch);
|
||||
int index = cb->findData(QString::fromStdString(ans));
|
||||
if( index >= 0 && index < cb->count()) {
|
||||
cb->setCurrentIndex(index);
|
||||
|
@ -595,16 +638,12 @@ void Scope::ScopeMakeSpinBox(RSpinBox * &sb, QString str, QGridLayout *layout, i
|
|||
if( digi[iDigi]->WriteValue(digPara, std::to_string(sb->value()), ch)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
sb->setStyleSheet("");
|
||||
|
||||
//TODO digiSettingPanel update setting
|
||||
printf("UpdateOtherPanels \n");
|
||||
emit UpdateOtherPanels();
|
||||
|
||||
UpdateSettingsFromMemeory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
sb->setStyleSheet("color:red;");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
@ -632,9 +671,8 @@ void Scope::ScopeMakeComoBox(RComboBox * &cb, QString str, QGridLayout *layout,
|
|||
if( digi[iDigi]->WriteValue(digPara, cb->currentData().toString().toStdString(), ch)){
|
||||
SendLogMsg(msg + "|OK.");
|
||||
cb->setStyleSheet("");
|
||||
//TODO digiSettingPanel update setting
|
||||
printf("UpdateOtherPanels \n");
|
||||
emit UpdateOtherPanels();
|
||||
UpdateSettingsFromMemeory();
|
||||
UpdateOtherPanels();
|
||||
}else{
|
||||
SendLogMsg(msg + "|Fail.");
|
||||
cb->setStyleSheet("color:red;");
|
||||
|
|
3
scope.h
3
scope.h
|
@ -109,6 +109,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void ReadScopeSettings(); // read from digitizer and show;
|
||||
void UpdateSettingsFromMemeory();
|
||||
|
||||
private slots:
|
||||
void StartScope();
|
||||
|
@ -130,8 +131,8 @@ private slots:
|
|||
signals:
|
||||
|
||||
void CloseWindow();
|
||||
void SendLogMsg(const QString &msg);
|
||||
void UpdateScalar();
|
||||
void SendLogMsg(const QString &msg);
|
||||
void UpdateOtherPanels();
|
||||
void TellSettingsPanelControlOnOff();
|
||||
void TellACQOnOff(const bool onOff);
|
||||
|
|
Loading…
Reference in New Issue
Block a user