bug fix on BoardVetoPolarity and InputDelay Display

This commit is contained in:
Ryan Tang 2023-11-06 13:13:42 -05:00
parent e3edb4e9d7
commit 876ae26450
6 changed files with 59 additions and 46 deletions

View File

@ -173,6 +173,7 @@ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
// chSettings[ch_index][index].GetFullPara(ch_index).c_str(), // chSettings[ch_index][index].GetFullPara(ch_index).c_str(),
// chSettings[ch_index][index].GetValue().c_str()); // chSettings[ch_index][index].GetValue().c_str());
}break; }break;
case TYPE::VGA : { case TYPE::VGA : {
VGASetting[ch_index].SetValue(value); VGASetting[ch_index].SetValue(value);
@ -180,14 +181,24 @@ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
// VGASetting[ch_index].GetFullPara(ch_index).c_str(), // VGASetting[ch_index].GetFullPara(ch_index).c_str(),
// VGASetting[ch_index].GetValue().c_str()); // VGASetting[ch_index].GetValue().c_str());
}break; }break;
case TYPE::DIG : { case TYPE::DIG : {
boardSettings[index].SetValue(value); boardSettings[index].SetValue(value);
//printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(), //printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
// boardSettings[index].GetFullPara(ch_index).c_str(), // boardSettings[index].GetFullPara(ch_index).c_str(),
// boardSettings[index].GetValue().c_str()); // boardSettings[index].GetValue().c_str());
}break; }break;
case TYPE::LVDS : LVDSSettings[ch_index][index].SetValue(value); break;
case TYPE::GROUP : InputDelay[ch_index].SetValue(value); break; case TYPE::LVDS : {
LVDSSettings[ch_index][index].SetValue(value);
}break;
case TYPE::GROUP : {
InputDelay[ch_index].SetValue(value);
// printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
// InputDelay[ch_index].GetFullPara(ch_index).c_str(),
// InputDelay[ch_index].GetValue().c_str());
}break;
} }
} }
@ -1375,7 +1386,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
} }
std::string Digitizer2Gen::GetSettingValue(const Reg para, unsigned int ch_index) { std::string Digitizer2Gen::GetSettingValueFromMemory(const Reg para, unsigned int ch_index) {
int index = FindIndex(para); int index = FindIndex(para);
switch (para.GetType()){ switch (para.GetType()){
case TYPE::DIG: return boardSettings[index].GetValue(); case TYPE::DIG: return boardSettings[index].GetValue();

View File

@ -101,7 +101,7 @@ class Digitizer2Gen {
void SendCommand(std::string shortPara); void SendCommand(std::string shortPara);
int FindIndex(const Reg para); // get index from DIGIPARA int FindIndex(const Reg para); // get index from DIGIPARA
std::string GetSettingValue(const Reg para, unsigned int ch_index = 0); // read from memory std::string GetSettingValueFromMemory(const Reg para, unsigned int ch_index = 0); // read from memory
std::string ErrorMsg(const char * funcName); std::string ErrorMsg(const char * funcName);

1
Hit.h
View File

@ -14,6 +14,7 @@ enum DataFormat{
OneTrace = 0x01, OneTrace = 0x01,
NoTrace = 0x02, NoTrace = 0x02,
Minimum = 0x03, Minimum = 0x03,
MiniWithFineTime = 0x04,
Raw = 0x0A, Raw = 0x0A,
}; };

View File

@ -567,17 +567,17 @@ void SOLARISpanel::UpdatePanelFromMemory(){
for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){ for( int chID = 0; chID < (int) mapping[DigiID].size(); chID++){
if( mapping[DigiID][chID] < 0 ) continue; if( mapping[DigiID][chID] < 0 ) continue;
std::string haha = digi[DigiID]->GetSettingValue(SettingItems[SettingID], chID); std::string haha = digi[DigiID]->GetSettingValueFromMemory(SettingItems[SettingID], chID);
sbSetting[SettingID][DigiID][chID]->setValue( atof(haha.c_str())); sbSetting[SettingID][DigiID][chID]->setValue( atof(haha.c_str()));
if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){ if( SettingItems[SettingID].GetPara() == PHA::CH::TriggerThreshold.GetPara() ){
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID); std::string haha = digi[DigiID]->GetSettingValueFromMemory(PHA::CH::SelfTrgRate, chID);
leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) ); leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) );
}else{ }else{
leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) ); leDisplay[SettingID][DigiID][chID]->setText(QString::number(atof(haha.c_str()), 'f', 2) );
} }
haha = digi[DigiID]->GetSettingValue(PHA::CH::ChannelEnable, chID); haha = digi[DigiID]->GetSettingValueFromMemory(PHA::CH::ChannelEnable, chID);
chkOnOff[SettingID][DigiID][chID]->setChecked( haha == "True" ? true : false); chkOnOff[SettingID][DigiID][chID]->setChecked( haha == "True" ? true : false);
leDisplay[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false); leDisplay[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
sbSetting[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false); sbSetting[SettingID][DigiID][chID]->setEnabled(haha == "True" ? true : false);
@ -609,11 +609,11 @@ void SOLARISpanel::UpdatePanelFromMemory(){
} }
int chID = (detIDArrayList[k][h] & 0xFF); int chID = (detIDArrayList[k][h] & 0xFF);
triggerMap.push_back(Utility::TenBase(digi[digiID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, chID))); triggerMap.push_back(Utility::TenBase(digi[digiID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, chID)));
coincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceMask, chID)); coincidentMask.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::CoincidenceMask, chID));
antiCoincidentMask.push_back(digi[digiID]->GetSettingValue(PHA::CH::AntiCoincidenceMask, chID)); antiCoincidentMask.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::AntiCoincidenceMask, chID));
eventTriggerSource.push_back(digi[digiID]->GetSettingValue(PHA::CH::EventTriggerSource, chID)); eventTriggerSource.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::EventTriggerSource, chID));
waveTriggerSource.push_back(digi[digiID]->GetSettingValue(PHA::CH::WaveTriggerSource, chID)); waveTriggerSource.push_back(digi[digiID]->GetSettingValueFromMemory(PHA::CH::WaveTriggerSource, chID));
} }
if(skipFlag) continue; if(skipFlag) continue;
@ -704,7 +704,7 @@ void SOLARISpanel::UpdatePanelFromMemory(){
int chID = (detIDArrayList[i][j] & 0xFF); int chID = (detIDArrayList[i][j] & 0xFF);
if( digiID >= nDigi ) continue; if( digiID >= nDigi ) continue;
if( digi[digiID]->IsDummy() || !digi[digiID]->IsConnected() ) continue; if( digi[digiID]->IsDummy() || !digi[digiID]->IsConnected() ) continue;
coinTime.push_back( atoi(digi[digiID]->GetSettingValue(PHA::CH::CoincidenceLength, chID).c_str())); coinTime.push_back( atoi(digi[digiID]->GetSettingValueFromMemory(PHA::CH::CoincidenceLength, chID).c_str()));
} }
} }
@ -738,7 +738,7 @@ void SOLARISpanel::UpdateThreshold(){
if( mapping[DigiID][chID] < 0 ) continue; if( mapping[DigiID][chID] < 0 ) continue;
std::string haha = digi[DigiID]->GetSettingValue(PHA::CH::SelfTrgRate, chID); std::string haha = digi[DigiID]->GetSettingValueFromMemory(PHA::CH::SelfTrgRate, chID);
leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha)); leDisplay[SettingID][DigiID][chID]->setText(QString::fromStdString(haha));
///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str()); ///printf("====== %d %d %d |%s|\n", SettingID, DigiID, chID, haha.c_str());

View File

@ -443,7 +443,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QString msg; QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoPolarity.GetPara()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoPolarity.GetPara());
msg += " = " + cbbBdVetoPolarity[ID]->currentData().toString(); msg += " = " + cbbBdVetoPolarity[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoPolarity, cbbStatEvents[ID]->currentData().toString().toStdString()) ){ if( digi[ID]->WriteValue(PHA::DIG::BoardVetoPolarity, cbbBdVetoPolarity[ID]->currentData().toString().toStdString()) ){
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
cbbBdVetoPolarity[ID]->setStyleSheet(""); cbbBdVetoPolarity[ID]->setStyleSheet("");
}else{ }else{
@ -1077,7 +1077,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
msg += " = " + cbBdAns->currentData().toString(); msg += " = " + cbBdAns->currentData().toString();
if( digi[ID]->WriteValue(para, value) ){ if( digi[ID]->WriteValue(para, value) ){
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
cbBdAns->setStyleSheet(""); cbBdAns->setStyleSheet("");
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1107,7 +1107,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
msg += " = " + QString::number(sbBdSettingsWrite->value()); msg += " = " + QString::number(sbBdSettingsWrite->value());
if( digi[ID]->WriteValue(para, std::to_string(sbBdSettingsWrite->value()))){ if( digi[ID]->WriteValue(para, std::to_string(sbBdSettingsWrite->value()))){
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
sbBdSettingsWrite->setStyleSheet(""); sbBdSettingsWrite->setStyleSheet("");
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1133,7 +1133,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
msg += " = " + QString::number(sbBdSettingsWrite->value()); msg += " = " + QString::number(sbBdSettingsWrite->value());
if( digi[ID]->WriteValue(para, value)){ if( digi[ID]->WriteValue(para, value)){
leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leBdSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
sbBdSettingsWrite->setStyleSheet(""); sbBdSettingsWrite->setStyleSheet("");
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1203,7 +1203,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
msg += ",CH:" + QString::number(ch_index); msg += ",CH:" + QString::number(ch_index);
msg += " = " + cbChSettingsWrite->currentData().toString(); msg += " = " + cbChSettingsWrite->currentData().toString();
if( digi[ID]->WriteValue(para, value, ch_index) ){ if( digi[ID]->WriteValue(para, value, ch_index) ){
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
cbChSettingsWrite->setStyleSheet(""); cbChSettingsWrite->setStyleSheet("");
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1235,7 +1235,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
msg += ",CH:" + QString::number(ch_index); msg += ",CH:" + QString::number(ch_index);
msg += " = " + QString::number(sbChSettingsWrite->value()); msg += " = " + QString::number(sbChSettingsWrite->value());
if( digi[ID]->WriteValue(para, std::to_string(sbChSettingsWrite->value()), ch_index)){ if( digi[ID]->WriteValue(para, std::to_string(sbChSettingsWrite->value()), ch_index)){
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
sbChSettingsWrite->setStyleSheet(""); sbChSettingsWrite->setStyleSheet("");
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1261,7 +1261,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara()); msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(para.GetPara());
msg += " = " + QString::number(sbChSettingsWrite->value()); msg += " = " + QString::number(sbChSettingsWrite->value());
if( digi[ID]->WriteValue(para, value, ch_index)){ if( digi[ID]->WriteValue(para, value, ch_index)){
leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValue(para))); leChSettingsRead->setText( QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para)));
SendLogMsg(msg + "|OK."); SendLogMsg(msg + "|OK.");
sbChSettingsWrite->setStyleSheet(""); sbChSettingsWrite->setStyleSheet("");
UpdatePanelFromMemory(); UpdatePanelFromMemory();
@ -1488,7 +1488,7 @@ void DigiSettingsPanel::SetupPHAChannels(unsigned short digiID){
FillSpinBoxValueFromMemory(spbCoinLength[ID][ch], PHA::CH::CoincidenceLength, index); FillSpinBoxValueFromMemory(spbCoinLength[ID][ch], PHA::CH::CoincidenceLength, index);
FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index); FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index);
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt())); unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper()); leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper());
//-------- PHA //-------- PHA
@ -1876,7 +1876,7 @@ void DigiSettingsPanel::SetupPSDChannels(unsigned short digiID){
FillSpinBoxValueFromMemory(spbCoinLength[ID][ch], PHA::CH::CoincidenceLength, index); FillSpinBoxValueFromMemory(spbCoinLength[ID][ch], PHA::CH::CoincidenceLength, index);
FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index); FillSpinBoxValueFromMemory(spbADCVetoWidth[ID][ch], PHA::CH::ADCVetoWidth, index);
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt())); unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper()); leTriggerMask[ID][ch]->setText("0x" + QString::number(mask, 16).toUpper());
//-------- PSD //-------- PSD
@ -2306,8 +2306,8 @@ void DigiSettingsPanel::ReadTriggerMap(){
for( int ch = 0; ch < (int) digi[ID]->GetNChannels(); ch ++){ for( int ch = 0; ch < (int) digi[ID]->GetNChannels(); ch ++){
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, ch)); unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, ch));
//printf("Trigger Mask of ch-%2d : 0x%s |%s| \n", ch, QString::number(mask, 16).toStdString().c_str(), digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, ch).c_str()); //printf("Trigger Mask of ch-%2d : 0x%s |%s| \n", ch, QString::number(mask, 16).toStdString().c_str(), digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, ch).c_str());
for( int k = 0; k < (int) digi[ID]->GetNChannels(); k ++ ){ for( int k = 0; k < (int) digi[ID]->GetNChannels(); k ++ ){
trgMapClickStatus[ID][ch][k] = ( (mask >> k) & 0x1 ); trgMapClickStatus[ID][ch][k] = ( (mask >> k) & 0x1 );
@ -2490,7 +2490,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
} }
//--------- LED Status //--------- LED Status
unsigned int ledStatus = atoi(digi[ID]->GetSettingValue(PHA::DIG::LED_status).c_str()); unsigned int ledStatus = atoi(digi[ID]->GetSettingValueFromMemory(PHA::DIG::LED_status).c_str());
for( int i = 0; i < 19; i++){ for( int i = 0; i < 19; i++){
if( (ledStatus >> i) & 0x1 ) { if( (ledStatus >> i) & 0x1 ) {
LEDStatus[ID][i]->setStyleSheet("background-color:green;"); LEDStatus[ID][i]->setStyleSheet("background-color:green;");
@ -2500,7 +2500,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
} }
//--------- ACQ Status //--------- ACQ Status
unsigned int acqStatus = atoi(digi[ID]->GetSettingValue(PHA::DIG::ACQ_status).c_str()); unsigned int acqStatus = atoi(digi[ID]->GetSettingValueFromMemory(PHA::DIG::ACQ_status).c_str());
for( int i = 0; i < 7; i++){ for( int i = 0; i < 7; i++){
if( (acqStatus >> i) & 0x1 ) { if( (acqStatus >> i) & 0x1 ) {
ACQStatus[ID][i]->setStyleSheet("background-color:green;"); ACQStatus[ID][i]->setStyleSheet("background-color:green;");
@ -2511,7 +2511,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
//-------- temperature //-------- temperature
for( int i = 0; i < 8; i++){ for( int i = 0; i < 8; i++){
leTemp[ID][i]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::TempSensADC[i]))); leTemp[ID][i]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::TempSensADC[i])));
} }
if( onlyStatus ) { if( onlyStatus ) {
@ -2531,7 +2531,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
//-------- board settings //-------- board settings
FillComboBoxValueFromMemory(cbbClockSource[ID], PHA::DIG::ClockSource); FillComboBoxValueFromMemory(cbbClockSource[ID], PHA::DIG::ClockSource);
QString result = QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::StartSource)); QString result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::StartSource));
QStringList resultList = result.remove(QChar(' ')).split("|"); QStringList resultList = result.remove(QChar(' ')).split("|");
//qDebug() << resultList << "," << resultList.count(); //qDebug() << resultList << "," << resultList.count();
for( int j = 0; j < (int) PHA::DIG::StartSource.GetAnswers().size(); j++){ for( int j = 0; j < (int) PHA::DIG::StartSource.GetAnswers().size(); j++){
@ -2542,7 +2542,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
} }
} }
result = QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::GlobalTriggerSource)); result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::GlobalTriggerSource));
resultList = result.remove(QChar(' ')).split("|"); resultList = result.remove(QChar(' ')).split("|");
bdTestPulse[ID]->setEnabled(false); bdTestPulse[ID]->setEnabled(false);
for( int j = 0; j < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); j++){ for( int j = 0; j < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); j++){
@ -2594,7 +2594,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
FillComboBoxValueFromMemory(cbLVDSMode[ID][k], PHA::LVDS::LVDSMode, k); FillComboBoxValueFromMemory(cbLVDSMode[ID][k], PHA::LVDS::LVDSMode, k);
FillComboBoxValueFromMemory(cbLVDSDirection[ID][k], PHA::LVDS::LVDSDirection, k); FillComboBoxValueFromMemory(cbLVDSDirection[ID][k], PHA::LVDS::LVDSDirection, k);
} }
leLVDSIOReg[ID]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::LVDSIOReg))); leLVDSIOReg[ID]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::DIG::LVDSIOReg)));
//------------- DAC //------------- DAC
FillComboBoxValueFromMemory(cbDACoutMode[ID], PHA::DIG::DACoutMode); FillComboBoxValueFromMemory(cbDACoutMode[ID], PHA::DIG::DACoutMode);
@ -2625,7 +2625,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){
unsigned int status = atoi(digi[ID]->GetSettingValue(PHA::CH::ChannelStatus).c_str()); unsigned int status = atoi(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelStatus).c_str());
for( int i = 0; i < 9; i++){ for( int i = 0; i < 9; i++){
if( (status >> i) & 0x1 ) { if( (status >> i) & 0x1 ) {
chStatus[ID][ch][i]->setStyleSheet("background-color:green;"); chStatus[ID][ch][i]->setStyleSheet("background-color:green;");
@ -2633,8 +2633,8 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
chStatus[ID][ch][i]->setStyleSheet(""); chStatus[ID][ch][i]->setStyleSheet("");
} }
} }
chGainFactor[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::CH::GainFactor, ch))); chGainFactor[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::CH::GainFactor, ch)));
chADCToVolts[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValue(PHA::CH::ADCToVolts, ch))); chADCToVolts[ID][ch]->setText(QString::fromStdString(digi[ID]->GetSettingValueFromMemory(PHA::CH::ADCToVolts, ch)));
FillComboBoxValueFromMemory(cbbOnOff[ID][ch], PHA::CH::ChannelEnable, ch); FillComboBoxValueFromMemory(cbbOnOff[ID][ch], PHA::CH::ChannelEnable, ch);
FillSpinBoxValueFromMemory(spbRecordLength[ID][ch], PHA::CH::RecordLength, ch); FillSpinBoxValueFromMemory(spbRecordLength[ID][ch], PHA::CH::RecordLength, ch);
@ -2668,7 +2668,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
FillComboBoxValueFromMemory(cbbDigProbe2[ID][ch], PHA::CH::WaveDigitalProbe2, ch); FillComboBoxValueFromMemory(cbbDigProbe2[ID][ch], PHA::CH::WaveDigitalProbe2, ch);
FillComboBoxValueFromMemory(cbbDigProbe3[ID][ch], PHA::CH::WaveDigitalProbe3, ch); FillComboBoxValueFromMemory(cbbDigProbe3[ID][ch], PHA::CH::WaveDigitalProbe3, ch);
std::string itlConnect = digi[ID]->GetSettingValue(PHA::CH::ITLConnect, ch); std::string itlConnect = digi[ID]->GetSettingValueFromMemory(PHA::CH::ITLConnect, ch);
if( itlConnect == "Disabled" ) { if( itlConnect == "Disabled" ) {
ITLConnectStatus[ID][ch] = 0; ITLConnectStatus[ID][ch] = 0;
chITLConnect[ID][ch][0]->setStyleSheet(""); chITLConnect[ID][ch][0]->setStyleSheet("");
@ -2736,11 +2736,11 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
//------ Trigger Mask //------ Trigger Mask
if( cbChPick[ID]->currentData().toInt() < 0 ) { if( cbChPick[ID]->currentData().toInt() < 0 ) {
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, 0)); unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, 0));
bool isSame = true; bool isSame = true;
for(int ch = 1; ch < digi[ID]->GetNChannels() ; ch ++){ for(int ch = 1; ch < digi[ID]->GetNChannels() ; ch ++){
unsigned long haha = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, ch)); unsigned long haha = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, ch));
if( mask != haha) { if( mask != haha) {
isSame = false; isSame = false;
leTriggerMask[ID][MaxNumberOfChannel]->setText("Diff. value"); leTriggerMask[ID][MaxNumberOfChannel]->setText("Diff. value");
@ -2750,7 +2750,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16).toUpper()); if( isSame ) leTriggerMask[ID][MaxNumberOfChannel]->setText("0x" + QString::number(mask, 16).toUpper());
}else{ }else{
unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValue(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt())); unsigned long mask = Utility::TenBase(digi[ID]->GetSettingValueFromMemory(PHA::CH::ChannelsTriggerMask, cbChPick[ID]->currentData().toInt()));
leTriggerMask[ID][digi[ID]->GetNChannels()]->setText("0x" + QString::number(mask, 16).toUpper()); leTriggerMask[ID][digi[ID]->GetNChannels()]->setText("0x" + QString::number(mask, 16).toUpper());
leTriggerMask[ID][digi[ID]->GetNChannels()]->setStyleSheet(""); leTriggerMask[ID][digi[ID]->GetNChannels()]->setStyleSheet("");
} }
@ -2999,6 +2999,7 @@ void DigiSettingsPanel::SetupSpinBox(RSpinBox *&spb, const Reg para, int ch_inde
spb->setStyleSheet("color:red;"); spb->setStyleSheet("color:red;");
} }
// printf("============%d| %s \n", index, digi[ID]->GetSettingValueFromMemory(PHA::GROUP::InputDelay, index).c_str());
}else{ }else{
@ -3100,7 +3101,7 @@ void DigiSettingsPanel::SetupComboBoxTab(RComboBox *(&cbb)[][MaxNumberOfChannel
} }
void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, const Reg para, int ch_index){ void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, const Reg para, int ch_index){
QString result = QString::fromStdString(digi[ID]->GetSettingValue(para, ch_index)); QString result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para, ch_index));
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, cbb); //printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, cbb);
int index = cbb->findData(result); int index = cbb->findData(result);
if( index >= 0 && index < cbb->count()) { if( index >= 0 && index < cbb->count()) {
@ -3111,11 +3112,11 @@ void DigiSettingsPanel::FillComboBoxValueFromMemory(RComboBox *&cbb, const Reg p
} }
void DigiSettingsPanel::FillSpinBoxValueFromMemory(RSpinBox *&spb, const Reg para, int ch_index){ void DigiSettingsPanel::FillSpinBoxValueFromMemory(RSpinBox *&spb, const Reg para, int ch_index){
QString result = QString::fromStdString(digi[ID]->GetSettingValue(para, ch_index)); QString result = QString::fromStdString(digi[ID]->GetSettingValueFromMemory(para, ch_index));
//printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, spb); //printf("%s === %s, %d, %p\n", __func__, result.toStdString().c_str(), ID, spb);
if( para.GetPara() == PHA::GROUP::InputDelay.GetPara() && digi[ID]->GetCupVer() >= MIN_VERSION_GROUP) { if( para.GetPara() == PHA::GROUP::InputDelay.GetPara() && digi[ID]->GetCupVer() >= MIN_VERSION_GROUP) {
spb->setValue(result.toInt()*8); spb->setValue(result.toDouble()*8);
}else{ }else{
spb->setValue(result.toDouble()); spb->setValue(result.toDouble());
} }
@ -3372,7 +3373,7 @@ bool DigiSettingsPanel::CopyChannelSettings(int digiFrom, int chFrom, int digiTo
SendLogMsg("Copy Settings from DIG:" + QString::number(digi[digiFrom]->GetSerialNumber()) + ", CH:" + QString::number(chFrom) + " ---> DIG:" + QString::number(digi[digiTo]->GetSerialNumber()) + ", CH:" + QString::number(chTo)); SendLogMsg("Copy Settings from DIG:" + QString::number(digi[digiFrom]->GetSerialNumber()) + ", CH:" + QString::number(chFrom) + " ---> DIG:" + QString::number(digi[digiTo]->GetSerialNumber()) + ", CH:" + QString::number(chTo));
for( int k = 0; k < (int) PHA::CH::AllSettings.size(); k ++){ for( int k = 0; k < (int) PHA::CH::AllSettings.size(); k ++){
if( PHA::CH::AllSettings[k].ReadWrite() != RW::ReadWrite ) continue; if( PHA::CH::AllSettings[k].ReadWrite() != RW::ReadWrite ) continue;
std::string haha = digi[digiFrom]->GetSettingValue(PHA::CH::AllSettings[k], chFrom); std::string haha = digi[digiFrom]->GetSettingValueFromMemory(PHA::CH::AllSettings[k], chFrom);
if( !digi[digiTo]->WriteValue( PHA::CH::AllSettings[k], haha , chTo ) ){ if( !digi[digiTo]->WriteValue( PHA::CH::AllSettings[k], haha , chTo ) ){
SendLogMsg("something wrong when copying setting : " + QString::fromStdString( PHA::CH::AllSettings[k].GetPara())) ; SendLogMsg("something wrong when copying setting : " + QString::fromStdString( PHA::CH::AllSettings[k].GetPara())) ;
return false; return false;
@ -3394,7 +3395,7 @@ bool DigiSettingsPanel::CopyBoardSettings(){
//Copy setting //Copy setting
for( int k = 0; k < (int) PHA::DIG::AllSettings.size(); k ++){ for( int k = 0; k < (int) PHA::DIG::AllSettings.size(); k ++){
if( PHA::DIG::AllSettings[k].ReadWrite() != RW::ReadWrite ) continue; if( PHA::DIG::AllSettings[k].ReadWrite() != RW::ReadWrite ) continue;
if( ! digi[digiToIndex]->WriteValue( PHA::DIG::AllSettings[k], digi[digiFromIndex]->GetSettingValue(PHA::DIG::AllSettings[k])) ){ if( ! digi[digiToIndex]->WriteValue( PHA::DIG::AllSettings[k], digi[digiFromIndex]->GetSettingValueFromMemory(PHA::DIG::AllSettings[k])) ){
SendLogMsg("something wrong when copying setting : " + QString::fromStdString( PHA::DIG::AllSettings[k].GetPara())) ; SendLogMsg("something wrong when copying setting : " + QString::fromStdString( PHA::DIG::AllSettings[k].GetPara())) ;
return false; return false;
break; break;

View File

@ -671,7 +671,7 @@ void Scope::UpdateScope(){
leTriggerRate->setText(QString::fromStdString(haha)); leTriggerRate->setText(QString::fromStdString(haha));
//unsigned int traceLength = qMin((int) digi[iDigi]->hit->traceLenght, MaxDisplayTraceDataLength); //unsigned int traceLength = qMin((int) digi[iDigi]->hit->traceLenght, MaxDisplayTraceDataLength);
unsigned int traceLength = qMin( atoi(digi[iDigi]->GetSettingValue(PHA::CH::RecordLength, ch).c_str())/sample2ns, MaxDisplayTraceDataLength ); unsigned int traceLength = qMin( atoi(digi[iDigi]->GetSettingValueFromMemory(PHA::CH::RecordLength, ch).c_str())/sample2ns, MaxDisplayTraceDataLength );
if( atoi(haha.c_str()) == 0 ) { if( atoi(haha.c_str()) == 0 ) {
digiMTX[iDigi].unlock(); digiMTX[iDigi].unlock();
@ -800,12 +800,12 @@ void Scope::ScopeControlOnOff(bool on){
} }
void Scope::ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara){ void Scope::ScopeReadSpinBoxValue(int iDigi, int ch, RSpinBox *sb, const Reg digPara){
std::string ans = digi[iDigi]->GetSettingValue(digPara, ch); std::string ans = digi[iDigi]->GetSettingValueFromMemory(digPara, ch);
sb->setValue(atoi(ans.c_str())); sb->setValue(atoi(ans.c_str()));
} }
void Scope::ScopeReadComboBoxValue(int iDigi, int ch, RComboBox *cb, const Reg digPara){ void Scope::ScopeReadComboBoxValue(int iDigi, int ch, RComboBox *cb, const Reg digPara){
std::string ans = digi[iDigi]->GetSettingValue(digPara, ch); std::string ans = digi[iDigi]->GetSettingValueFromMemory(digPara, ch);
int index = cb->findData(QString::fromStdString(ans)); int index = cb->findData(QString::fromStdString(ans));
if( index >= 0 && index < cb->count()) { if( index >= 0 && index < cb->count()) {
cb->setCurrentIndex(index); cb->setCurrentIndex(index);