From 7092ceaa8469fef69972f418f58a810bd016569c Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Fri, 27 Sep 2024 14:17:22 -0400 Subject: [PATCH] add support for 32 channel board in the DigiParameters.h --- ClassDigitizer2Gen.cpp | 8 ++++---- DigiParameters.h | 5 ++--- digiSettingsPanel.cpp | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ClassDigitizer2Gen.cpp b/ClassDigitizer2Gen.cpp index 56f779a..6b183c9 100644 --- a/ClassDigitizer2Gen.cpp +++ b/ClassDigitizer2Gen.cpp @@ -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 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); 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){ - 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); if( index != -1 ){ switch(para.GetType()){ @@ -1169,7 +1169,7 @@ void Digitizer2Gen::PrintChannelSettings(unsigned short ch){ for( int i = 0; i < (int) chSettings[0].size(); i++){ 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].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); 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(), ch*100 + i, chSettings[ch][i].GetValue().c_str()); diff --git a/DigiParameters.h b/DigiParameters.h index 8b893c6..246e690 100644 --- a/DigiParameters.h +++ b/DigiParameters.h @@ -60,7 +60,7 @@ class Reg { std::vector> GetAnswers() const {return answer;} 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){ case TYPE::DIG:{ if( isCmd){ @@ -75,7 +75,7 @@ class Reg { haha = "/cmd/"; // for SendChSWTrigger, not in GUI } if( ch_index == -1 ){ - return "/ch/0..63" + haha + name; + return "/ch/0.." + std::to_string(nChannals) + haha + name; }else{ 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; }; diff --git a/digiSettingsPanel.cpp b/digiSettingsPanel.cpp index f885194..4700e36 100644 --- a/digiSettingsPanel.cpp +++ b/digiSettingsPanel.cpp @@ -673,7 +673,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi 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]->setFixedSize(15, 15); cLayout->addWidget(chITLConnect[iDigi][i][0], 1 + i/32, i%32 + 1);