small improvement on digiSettignPanel

This commit is contained in:
Ryan Tang 2023-03-14 17:35:27 -04:00
parent c6df41184f
commit cc8e292193
3 changed files with 40 additions and 11 deletions

View File

@ -172,12 +172,12 @@ namespace PHA{
{"SINlevel", "S-IN Level"}, {"SINlevel", "S-IN Level"},
{"SINedge", "S-IN Edge"}, {"SINedge", "S-IN Edge"},
{"SWcmd", "Software"}, {"SWcmd", "Software"},
{"LVDS", "LVDS"}}); {"LVDS", "LVDS"}}, ANSTYPE::STR);
const Reg GlobalTriggerSource ("GlobalTriggerSource", RW::ReadWrite, TYPE::DIG,{{"TrgIn", "TRG-IN" }, const Reg GlobalTriggerSource ("GlobalTriggerSource", RW::ReadWrite, TYPE::DIG,{{"TrgIn", "TRG-IN" },
{"SwTrg", "Software" }, {"SwTrg", "Software" },
{"GPIO", "GPIO" }, {"GPIO", "GPIO" },
{"TestPulse", "Test Pulse" }, {"TestPulse", "Test Pulse" },
{"LVDS", "LVDS"}}); {"LVDS", "LVDS"}}, ANSTYPE::STR);
const Reg BusyInSource ("BusyInSource", RW::ReadWrite, TYPE::DIG, {{"Disabled","Disabled"}, const Reg BusyInSource ("BusyInSource", RW::ReadWrite, TYPE::DIG, {{"Disabled","Disabled"},
{"SIN", "SIN"}, {"SIN", "SIN"},
@ -507,8 +507,8 @@ namespace PHA{
{"GlobalTriggerSource", "Global Trigger"}, {"GlobalTriggerSource", "Global Trigger"},
{"ITLA", "ITLA"}, {"ITLA", "ITLA"},
{"ITLB", "ITLB"}}); {"ITLB", "ITLB"}});
const Reg CoincidenceLength ("CoincidenceLengthT", RW::ReadWrite, TYPE::CH, {{"8", ""},{"524280", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns"); const Reg CoincidenceLength ("CoincidenceLengthT", RW::ReadWrite, TYPE::CH, {{"0", ""},{"524280", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
const Reg CoincidenceLengthSample ("CoincidenceLengthS", RW::ReadWrite, TYPE::CH, {{"1", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "sample"); const Reg CoincidenceLengthSample ("CoincidenceLengthS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"65535", ""}, {"1", ""}}, ANSTYPE::INTEGER, "sample");
const Reg ADCVetoWidth ("ADCVetoWidth", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"524280", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ns"); const Reg ADCVetoWidth ("ADCVetoWidth", RW::ReadWrite, TYPE::CH, {{"0", ""}, {"524280", ""}, {"1", ""}}, ANSTYPE::INTEGER, "ns");

View File

@ -554,7 +554,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
}else{ }else{
enableSignalSlot = false; enableSignalSlot = false;
unsigned short ch = digi[iDigi]->GetNChannels(); unsigned short ch = digi[iDigi]->GetNChannels();
printf("index = %d, ch = %d\n", index, ch); //printf("index = %d, ch = %d\n", index, ch);
FillComboBoxValueFromMemory(cbbOnOff[ID][ch], PHA::CH::ChannelEnable, index); FillComboBoxValueFromMemory(cbbOnOff[ID][ch], PHA::CH::ChannelEnable, index);
FillSpinBoxValueFromMemory(spbDCOffset[ID][ch], PHA::CH::DC_Offset, index); FillSpinBoxValueFromMemory(spbDCOffset[ID][ch], PHA::CH::DC_Offset, index);
FillSpinBoxValueFromMemory(spbThreshold[ID][ch], PHA::CH::TriggerThreshold, index); FillSpinBoxValueFromMemory(spbThreshold[ID][ch], PHA::CH::TriggerThreshold, index);
@ -945,7 +945,10 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
rowID ++; rowID ++;
SetupComboBox( cbAllCoinMask, PHA::CH::CoincidenceMask, -1, false, "Coincident Mask (all ch.)", triggerLayout, rowID, 0); SetupComboBox( cbAllCoinMask, PHA::CH::CoincidenceMask, -1, false, "Coincident Mask (all ch.)", triggerLayout, rowID, 0);
SetupSpinBox( sbAllCoinLength, PHA::CH::CoincidenceLength, -1, false, "Coincident Length [ns] (all ch.)", triggerLayout, rowID, 2); SetupSpinBox( sbAllCoinLength, PHA::CH::CoincidenceLength, -1, false, "Coincident Length [ns] (all ch.)", triggerLayout, rowID, 2);
//----------------------------
rowID ++;
SetupComboBox( cbAllAntiCoinMask, PHA::CH::AntiCoincidenceMask, -1, false, "Anti-Coincident Mask (all ch.)", triggerLayout, rowID, 0);
QSignalMapper * triggerMapper = new QSignalMapper(tab); QSignalMapper * triggerMapper = new QSignalMapper(tab);
connect(triggerMapper, &QSignalMapper::mappedInt, this, &DigiSettingsPanel::onTriggerClick); connect(triggerMapper, &QSignalMapper::mappedInt, this, &DigiSettingsPanel::onTriggerClick);
@ -1084,7 +1087,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
leBdSettingsRead = new QLineEdit(ICTab); leBdSettingsRead = new QLineEdit(ICTab);
leBdSettingsRead->setAlignment(Qt::AlignRight); leBdSettingsRead->setAlignment(Qt::AlignRight);
leBdSettingsRead->setFixedWidth(200); leBdSettingsRead->setFixedWidth(250);
leBdSettingsRead->setReadOnly(true); leBdSettingsRead->setReadOnly(true);
inquiryLayout->addWidget(leBdSettingsRead, rowID, 3); inquiryLayout->addWidget(leBdSettingsRead, rowID, 3);
@ -1202,7 +1205,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
leChSettingsRead = new QLineEdit(ICTab); leChSettingsRead = new QLineEdit(ICTab);
leChSettingsRead->setAlignment(Qt::AlignRight); leChSettingsRead->setAlignment(Qt::AlignRight);
leChSettingsRead->setFixedWidth(200); leChSettingsRead->setFixedWidth(250);
leChSettingsRead->setReadOnly(true); leChSettingsRead->setReadOnly(true);
inquiryLayout->addWidget(leChSettingsRead, rowID, 3); inquiryLayout->addWidget(leChSettingsRead, rowID, 3);
@ -1429,7 +1432,7 @@ void DigiSettingsPanel::onTriggerClick(int haha){
unsigned short ch = (haha >> 8 ) & 0xFF; unsigned short ch = (haha >> 8 ) & 0xFF;
unsigned short ch2 = haha & 0xFF; unsigned short ch2 = haha & 0xFF;
qDebug() << "Digi-" << iDig << ", Ch-" << ch << ", " << ch2; //qDebug() << "Digi-" << iDig << ", Ch-" << ch << ", " << ch2;
if(trgMapClickStatus[ch][ch2]){ if(trgMapClickStatus[ch][ch2]){
trgMap[ch][ch2]->setStyleSheet(""); trgMap[ch][ch2]->setStyleSheet("");
@ -1467,6 +1470,7 @@ void DigiSettingsPanel::ReadTriggerMap(){
cbAllEvtTrigger->setCurrentIndex(cbbEvtTrigger[ID][MaxNumberOfChannel]->currentIndex()); cbAllEvtTrigger->setCurrentIndex(cbbEvtTrigger[ID][MaxNumberOfChannel]->currentIndex());
cbAllWaveTrigger->setCurrentIndex(cbbWaveTrigger[ID][MaxNumberOfChannel]->currentIndex()); cbAllWaveTrigger->setCurrentIndex(cbbWaveTrigger[ID][MaxNumberOfChannel]->currentIndex());
cbAllCoinMask->setCurrentIndex(cbbCoinMask[ID][MaxNumberOfChannel]->currentIndex()); cbAllCoinMask->setCurrentIndex(cbbCoinMask[ID][MaxNumberOfChannel]->currentIndex());
cbAllAntiCoinMask->setCurrentIndex(cbbAntiCoinMask[ID][MaxNumberOfChannel]->currentIndex());
sbAllCoinLength->setValue(spbCoinLength[ID][MaxNumberOfChannel]->value()); sbAllCoinLength->setValue(spbCoinLength[ID][MaxNumberOfChannel]->value());
for( int ch = 0; ch < (int) digi[ID]->GetNChannels(); ch ++){ for( int ch = 0; ch < (int) digi[ID]->GetNChannels(); ch ++){
@ -2063,14 +2067,24 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
if( haha == ANSTYPE::LIST){ if( haha == ANSTYPE::LIST){
cbBdAns->setEnabled(true); cbBdAns->setEnabled(true);
cbBdAns->clear(); cbBdAns->clear();
int ansIndex = -1;
QString ans2 = "";
for( int i = 0; i < (int) PHA::DIG::AllSettings[cbIndex].GetAnswers().size(); i++){ for( int i = 0; i < (int) PHA::DIG::AllSettings[cbIndex].GetAnswers().size(); i++){
cbBdAns->addItem(QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetAnswers()[i].second), cbBdAns->addItem(QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetAnswers()[i].second),
QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetAnswers()[i].first)); QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetAnswers()[i].first));
if( ans == QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetAnswers()[i].first)) {
ansIndex = i;
ans2 = QString::fromStdString(PHA::DIG::AllSettings[cbIndex].GetAnswers()[i].second);
}
} }
cbBdAns->setCurrentIndex(ansIndex);
leBdSettingsRead->setText( ans + " [ " + ans2 + " ]");
sbBdSettingsWrite->setEnabled(false); sbBdSettingsWrite->setEnabled(false);
sbBdSettingsWrite->setStyleSheet("");
sbBdSettingsWrite->setValue(0); sbBdSettingsWrite->setValue(0);
leBdSettingsWrite->setEnabled(false); leBdSettingsWrite->setEnabled(false);
leBdSettingsWrite->clear(); leBdSettingsWrite->setText(ans);
} }
//===== lineEdit //===== lineEdit
if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){ if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){
@ -2079,12 +2093,14 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
leBdSettingsWrite->setEnabled(true); leBdSettingsWrite->setEnabled(true);
leBdSettingsWrite->clear(); leBdSettingsWrite->clear();
sbBdSettingsWrite->setEnabled(false); sbBdSettingsWrite->setEnabled(false);
sbBdSettingsWrite->setStyleSheet("");
sbBdSettingsWrite->setValue(0); sbBdSettingsWrite->setValue(0);
} }
}else{ }else{
cbBdAns->clear(); cbBdAns->clear();
cbBdAns->setEnabled(false); cbBdAns->setEnabled(false);
sbBdSettingsWrite->setEnabled(false); sbBdSettingsWrite->setEnabled(false);
sbBdSettingsWrite->setStyleSheet("");
sbBdSettingsWrite->cleanText(); sbBdSettingsWrite->cleanText();
leBdSettingsWrite->setEnabled(false); leBdSettingsWrite->setEnabled(false);
leBdSettingsWrite->clear(); leBdSettingsWrite->clear();
@ -2143,14 +2159,24 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
if( haha == ANSTYPE::LIST){ if( haha == ANSTYPE::LIST){
cbChAns->setEnabled(true); cbChAns->setEnabled(true);
cbChAns->clear(); cbChAns->clear();
int ansIndex = -1;
QString ans2 = "";
for( int i = 0; i < (int) PHA::CH::AllSettings[cbIndex].GetAnswers().size(); i++){ for( int i = 0; i < (int) PHA::CH::AllSettings[cbIndex].GetAnswers().size(); i++){
cbChAns->addItem(QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second), cbChAns->addItem(QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second),
QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first)); QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first));
if( ans == QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].first)) {
ansIndex = i;
ans2 = QString::fromStdString(PHA::CH::AllSettings[cbIndex].GetAnswers()[i].second);
}
} }
cbChAns->setCurrentIndex(ansIndex);
leChSettingsRead->setText( ans + " [ " + ans2 + " ]");
sbChSettingsWrite->setEnabled(false); sbChSettingsWrite->setEnabled(false);
sbChSettingsWrite->setStyleSheet("");
sbChSettingsWrite->setValue(0); sbChSettingsWrite->setValue(0);
leChSettingsWrite->setEnabled(false); leChSettingsWrite->setEnabled(false);
leChSettingsWrite->clear(); leChSettingsWrite->setText(ans2);
} }
if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){ if( haha == ANSTYPE::STR || haha == ANSTYPE::BYTE || haha == ANSTYPE::BINARY){
cbChAns->clear(); cbChAns->clear();
@ -2158,12 +2184,14 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
leChSettingsWrite->setEnabled(true); leChSettingsWrite->setEnabled(true);
leChSettingsWrite->clear(); leChSettingsWrite->clear();
sbChSettingsWrite->setEnabled(false); sbChSettingsWrite->setEnabled(false);
sbChSettingsWrite->setStyleSheet("");
sbChSettingsWrite->setValue(0); sbChSettingsWrite->setValue(0);
} }
}else{ }else{
cbChAns->clear(); cbChAns->clear();
cbChAns->setEnabled(false); cbChAns->setEnabled(false);
sbChSettingsWrite->setEnabled(false); sbChSettingsWrite->setEnabled(false);
sbChSettingsWrite->setStyleSheet("");
sbChSettingsWrite->cleanText(); sbChSettingsWrite->cleanText();
leChSettingsWrite->setEnabled(false); leChSettingsWrite->setEnabled(false);
leChSettingsWrite->clear(); leChSettingsWrite->clear();

View File

@ -160,6 +160,7 @@ private:
RComboBox * cbAllEvtTrigger; RComboBox * cbAllEvtTrigger;
RComboBox * cbAllWaveTrigger; RComboBox * cbAllWaveTrigger;
RComboBox * cbAllCoinMask; RComboBox * cbAllCoinMask;
RComboBox * cbAllAntiCoinMask;
RSpinBox * sbAllCoinLength; RSpinBox * sbAllCoinLength;
QPushButton * trgMap[MaxNumberOfChannel][MaxNumberOfChannel]; QPushButton * trgMap[MaxNumberOfChannel][MaxNumberOfChannel];
bool trgMapClickStatus[MaxNumberOfChannel][MaxNumberOfChannel]; bool trgMapClickStatus[MaxNumberOfChannel][MaxNumberOfChannel];