diff --git a/src/slave/CBV1724.cc b/src/slave/CBV1724.cc index 73e1c70..cae8df1 100644 --- a/src/slave/CBV1724.cc +++ b/src/slave/CBV1724.cc @@ -143,7 +143,7 @@ int CBV1724::Initialize(koOptions *options) // Reload VME options int tries = 0; - while( LoadVMEOptions( options ) != 0 && tries < 5) { + while( LoadVMEOptions( options, false ) != 0 && tries < 5) { tries ++; usleep(100); if( tries == 5 ) @@ -160,6 +160,16 @@ int CBV1724::Initialize(koOptions *options) fBufferOccCount = 0; fReadoutReports.clear(); + // Load user registers for boards with a unique ID only + // this is to avoid user settings to be overwritten + tries = 0; + while( LoadVMEOptions( options,true ) != 0 && tries < 5) { + tries ++; + usleep(100); + if( tries == 5 ) + retVal = -1; + } + // Report whether we succeeded or not stringstream messstr; if( retVal == 0 ){ @@ -923,13 +933,17 @@ int CBV1724::LoadDAC(vector baselines){ return 0; } - int CBV1724::LoadVMEOptions( koOptions *options ) + int CBV1724::LoadVMEOptions( koOptions *options, bool unique ) { int retVal = 0; // Reload VME options for(int x=0;xGetVMEOptions();x++) { - if((options->GetVMEOption(x).board==-1 || + if( ( (options->GetVMEOption(x).board==-1 && unique == false) || options->GetVMEOption(x).board==fBID.id)){ + + // only reload registers for DAC + if( (options->GetVMEOption(x).address & 0x98)!=0x98) + continue; int success = WriteReg32(options->GetVMEOption(x).address, options->GetVMEOption(x).value); if( options->GetVMEOption(x).address == 0xEF24 ) // give time to reset diff --git a/src/slave/CBV1724.hh b/src/slave/CBV1724.hh index 4b70012..5903a13 100644 --- a/src/slave/CBV1724.hh +++ b/src/slave/CBV1724.hh @@ -75,7 +75,7 @@ class CBV1724 : public VMEBoard { int LoadDAC(vector baselines); int LoadBaselines(); //Load baselines to boards int GetBaselines(vector &baselines, bool bQuiet=false); //Get baselines from file - int LoadVMEOptions( koOptions *options ); + int LoadVMEOptions( koOptions *options, bool unique ); unsigned int fReadoutThresh; pthread_mutex_t fDataLock;