Skip to content

Commit e9673e1

Browse files
authored
Merge pull request #68 from Mu2e/pgirotti/slowcontrol
Fixed invalid board ID logic
2 parents 3180f6a + 5b77541 commit e9673e1

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

otsdaq-mu2e-calorimeter/FEInterfaces/ROCCalorimeterInterface.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,12 @@ class ROCCalorimeterInterface : public ROCPolarFireCoreInterface {
161161

162162
bool haveBoardIdFromSerial_ = false;
163163
uint16_t cachedSerialReg147_ = 0;
164-
uint16_t cachedBoardIdFromDB_ = 0;
164+
uint16_t cachedBoardIdFromDB_ = 9999;
165165
void updateBoardIdFromSerial_();
166166

167167
static constexpr int MAX_BOARD_ID = 160; // Maximum valid board ID for calorimeter DIRACs, see also CaloConst::_nDIRAC from Offline/DataProducts/inc/CaloConst.hh
168168
static const std::set<DTCLib::roc_address_t> SPECIAL_BLOCK_READ_ADDRS_;
169+
static constexpr int INVALID_BOARDID = 9999;
169170

170171
std::set<int> _pin_diode_list;
171172

otsdaq-mu2e-calorimeter/FEInterfaces/ROCCalorimeterInterface_interface.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ void ROCCalorimeterInterface::ROCSlowControl(__ARGS__) {
291291
const int boardID = static_cast<int>(cachedBoardIdFromDB_);
292292
__COUT_INFO__ << "Target BoardID = " << boardID << __E__;
293293

294-
if(!cachedBoardIdFromDB_) {
294+
if(cachedBoardIdFromDB_ == INVALID_BOARDID) {
295295
__FE_SS__ << "Skipping tag slow control for board " << boardID << ", boardID not initialized correctly!" << __E__;
296296
__FE_SS_THROW__;
297297
return;
@@ -782,7 +782,7 @@ void ots::ROCCalorimeterInterface::FindBoardIDFromSerial(__ARGS__) {
782782
void ROCCalorimeterInterface::updateBoardIdFromSerial_() {
783783
haveBoardIdFromSerial_ = false;
784784
cachedSerialReg147_ = 0;
785-
cachedBoardIdFromDB_ = 0;
785+
cachedBoardIdFromDB_ = INVALID_BOARDID;
786786

787787
cachedSerialReg147_ = readRegister(147);
788788

@@ -1145,9 +1145,9 @@ void ROCCalorimeterInterface::ConfigureLink(std::string conf, std::string confFi
11451145
const int boardID = static_cast<int>(cachedBoardIdFromDB_);
11461146
__COUT_INFO__ << "Target BoardID = " << boardID << __E__;
11471147

1148-
if(!cachedBoardIdFromDB_) {
1148+
if(cachedBoardIdFromDB_ == INVALID_BOARDID) {
11491149
updateBoardIdFromSerial_();
1150-
if(!cachedBoardIdFromDB_) {
1150+
if(cachedBoardIdFromDB_ == INVALID_BOARDID) {
11511151
__FE_SS__ << "Skipping configuring board " << boardID << ", boardID not initialized correctly!" << __E__;
11521152
__FE_SS_THROW__;
11531153
return;
@@ -1184,7 +1184,7 @@ void ROCCalorimeterInterface::CalibrateMZB() {
11841184
const int boardID = static_cast<int>(cachedBoardIdFromDB_);
11851185
__COUT_INFO__ << "Target BoardID = " << boardID << __E__;
11861186

1187-
if(!cachedBoardIdFromDB_) {
1187+
if(cachedBoardIdFromDB_ == INVALID_BOARDID) {
11881188
__FE_SS__ << "Skipping upload MZB parameters to board " << boardID << ", boardID not initialized correctly!" << __E__;
11891189
__FE_SS_THROW__;
11901190
return;
@@ -1257,7 +1257,7 @@ void ROCCalorimeterInterface::SetADCsThresholds(int offset) {
12571257
return;
12581258
}
12591259

1260-
if(!cachedBoardIdFromDB_) {
1260+
if(cachedBoardIdFromDB_ == INVALID_BOARDID) {
12611261
__COUT_ERR__ << "Skipping setting thresholds to board " << boardID << ", boardID not initialized correctly!" << __E__;
12621262
return;
12631263
}

0 commit comments

Comments
 (0)