add support for 32 channel board in the DigiParameters.h

This commit is contained in:
Ryan Tang 2024-09-27 14:17:22 -04:00
parent 7c16a69466
commit 7092ceaa84
3 changed files with 7 additions and 8 deletions

View File

@ -127,7 +127,7 @@ std::string Digitizer2Gen::ReadValue(const char * parameter, bool verbose){
} }
std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose){ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose){
std:: string ans = ReadValue(para.GetFullPara(ch_index).c_str(), verbose); std:: string ans = ReadValue(para.GetFullPara(ch_index, nChannels).c_str(), verbose);
int index = FindIndex(para); int index = FindIndex(para);
switch( para.GetType()){ switch( para.GetType()){
@ -157,7 +157,7 @@ bool Digitizer2Gen::WriteValue(const char * parameter, std::string value, bool v
} }
bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
if( WriteValue(para.GetFullPara(ch_index).c_str(), value) || isDummy){ if( WriteValue(para.GetFullPara(ch_index, nChannels).c_str(), value) || isDummy){
int index = FindIndex(para); int index = FindIndex(para);
if( index != -1 ){ if( index != -1 ){
switch(para.GetType()){ switch(para.GetType()){
@ -1169,7 +1169,7 @@ void Digitizer2Gen::PrintChannelSettings(unsigned short ch){
for( int i = 0; i < (int) chSettings[0].size(); i++){ for( int i = 0; i < (int) chSettings[0].size(); i++){
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue; if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
printf("%-45s %d %s\n", chSettings[ch][i].GetFullPara(ch).c_str(), printf("%-45s %d %s\n", chSettings[ch][i].GetFullPara(ch, nChannels).c_str(),
chSettings[ch][i].ReadWrite(), chSettings[ch][i].ReadWrite(),
chSettings[ch][i].GetValue().c_str()); chSettings[ch][i].GetValue().c_str());
} }
@ -1333,7 +1333,7 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
printf("[%i] No value for %s , ch-%02d\n", i, chSettings[ch][i].GetPara().c_str(), ch); printf("[%i] No value for %s , ch-%02d\n", i, chSettings[ch][i].GetPara().c_str(), ch);
continue; continue;
} }
fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch).c_str(), fprintf(saveFile, "%-45s!%d!%4d!%s\n", chSettings[ch][i].GetFullPara(ch, nChannels).c_str(),
chSettings[ch][i].ReadWrite(), chSettings[ch][i].ReadWrite(),
ch*100 + i, ch*100 + i,
chSettings[ch][i].GetValue().c_str()); chSettings[ch][i].GetValue().c_str());

View File

@ -60,7 +60,7 @@ class Reg {
std::vector<std::pair<std::string,std::string>> GetAnswers() const {return answer;} std::vector<std::pair<std::string,std::string>> GetAnswers() const {return answer;}
std::string GetPara() const {return name;} std::string GetPara() const {return name;}
std::string GetFullPara(int ch_index = -1) const { std::string GetFullPara(int ch_index = -1, int nChannals = MaxNumberOfChannel) const {
switch (type){ switch (type){
case TYPE::DIG:{ case TYPE::DIG:{
if( isCmd){ if( isCmd){
@ -75,7 +75,7 @@ class Reg {
haha = "/cmd/"; // for SendChSWTrigger, not in GUI haha = "/cmd/"; // for SendChSWTrigger, not in GUI
} }
if( ch_index == -1 ){ if( ch_index == -1 ){
return "/ch/0..63" + haha + name; return "/ch/0.." + std::to_string(nChannals) + haha + name;
}else{ }else{
return "/ch/" + std::to_string(ch_index) + haha + name; return "/ch/" + std::to_string(ch_index) + haha + name;
} }
@ -107,7 +107,6 @@ class Reg {
} }
} }
operator std::string () const {return name;} // this allow Reg kaka("XYZ", true); std::string haha = kaka; operator std::string () const {return name;} // this allow Reg kaka("XYZ", true); std::string haha = kaka;
}; };

View File

@ -673,7 +673,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
cLayout->addWidget(horizontalSeparator, 3, 0, 1, 33); cLayout->addWidget(horizontalSeparator, 3, 0, 1, 33);
for( int i = 0; i < 64; i++){ for( int i = 0; i < digi[iDigi]->GetNChannels() ; i++){
chITLConnect[iDigi][i][0] = new QPushButton(bdITL[iDigi]); chITLConnect[iDigi][i][0] = new QPushButton(bdITL[iDigi]);
chITLConnect[iDigi][i][0]->setFixedSize(15, 15); chITLConnect[iDigi][i][0]->setFixedSize(15, 15);
cLayout->addWidget(chITLConnect[iDigi][i][0], 1 + i/32, i%32 + 1); cLayout->addWidget(chITLConnect[iDigi][i][0], 1 + i/32, i%32 + 1);