diff --git a/src/CCDSpectrometer.h b/src/CCDSpectrometer.h index d079186503d41d4e821ef42d651bd8f75dfa3ed1..28068b2d59d16ec4f616e637e54c96aa5a7a3b67 100644 --- a/src/CCDSpectrometer.h +++ b/src/CCDSpectrometer.h @@ -57,6 +57,7 @@ #define EXPOSURE_ATTR "Exposure" #define TRIGGER_ATTR "Trigger" #define COUNTER_ATTR "AcquisitionCounter" +#define BUNCHNUM_ATTR "BunchNumber" #define ROI_ATTR "HwRoiParam" #define START_CMD "Start" #define STOP_CMD "Stop" diff --git a/src/readthread.cpp b/src/readthread.cpp index 9e5ddfd5a93d8bb834d3b2dec26fdfad515dd2b1..d27d40b5c391835e75394661fd8646847b7b042f 100644 --- a/src/readthread.cpp +++ b/src/readthread.cpp @@ -358,6 +358,8 @@ void readthread::run(void *) char check; rnm_bunch_number_get_value(0, 1, &buf_bunch_num, &check); //buf_bunch_num = fit_counter; +#else + buf_bunch_num = GetBunchnumber(); #endif if(old_bunch_number != buf_bunch_num-1) { @@ -1093,6 +1095,26 @@ void readthread::StopMeas() { } +Tango::DevLong readthread::GetBunchnumber() +{ + CCDSpectrometer *_device = static_cast<CCDSpectrometer *>(device); + Tango::DevLong bunch_number=0; + try { + //Tango::DevDouble data; + _device->dpmutex->lock(); + _device->dp->read_attribute(BUNCHNUM_ATTR)>>bunch_number; + _device->dpmutex->unlock(); + } + catch(Tango::DevFailed &e) + { + _device->dpmutex->unlock(); + INFO_STREAM << __func__ << ": error reading BN =" << e.errors[0].desc; + abort_sleep(0.05); + return 0; + } + return bunch_number; +} + } diff --git a/src/readthread.h b/src/readthread.h index 46bf6d838d637750742607c278aa893e8ee464c6..28b4b99a889466dc8763879198d1c287b5b6f1c4 100644 --- a/src/readthread.h +++ b/src/readthread.h @@ -38,6 +38,7 @@ class readthread : public omni_thread, public Tango::TangoMonitor, public Tango: uint32_t numavg; int PrepareMeas(); int Measure(double *l_pSpectrum); + Tango::DevLong GetBunchnumber(); void StopMeas(); int Heartbeat();