Skip to content
Snippets Groups Projects
Commit 454e834a authored by Jens Georg's avatar Jens Georg
Browse files

Fix sending out 0 event ids on data_matching none

Also, for the "trivial" datatypes such as scalar, array, IFFF enable
attaching a macropulse number on incoming variables so we can send out
updates from e.g. JDDD panels out via ZMQ
parent bebdad0b
No related branches found
No related tags found
No related merge requests found
......@@ -171,7 +171,6 @@ namespace ChimeraTK {
void publishZeroMQ() { publishZMQ = true; }
void setMacroPulseNumberSource(boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) {
if(_processArray->isReadable()) {
_macroPulseNumberSource = macroPulseNumberSource;
if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) {
_consistencyGroup.add(macroPulseNumberSource);
......@@ -179,7 +178,13 @@ namespace ChimeraTK {
std::bind(&DoocsProcessArray<DOOCS_T, DOOCS_PRIMITIVE_T>::updateDoocsBuffer, this,
macroPulseNumberSource->getId()));
}
}
else {
// We don't need to match up anything with it when it changes, but we have to register this at least once
// so the macropulse number will be included in the readAnyGroup in the updater if
// <data_matching> is none everywhere
_doocsUpdater.addVariable(
ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {});
}
}
boost::shared_ptr<ChimeraTK::NDRegisterAccessor<DOOCS_PRIMITIVE_T>> _processArray;
......
......@@ -175,6 +175,7 @@ namespace ChimeraTK {
info.sec = seconds;
info.usec = microseconds;
if(_macroPulseNumberSource != nullptr) {
this->set_mpnum(_macroPulseNumberSource->accessData(0));
info.ident = _macroPulseNumberSource->accessData(0);
}
else {
......@@ -206,14 +207,19 @@ namespace ChimeraTK {
void publishZeroMQ() { _publishZMQ = true; }
void setMacroPulseNumberSource(boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) {
if(_processScalar->isReadable()) {
_macroPulseNumberSource = macroPulseNumberSource;
if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) {
_consistencyGroup.add(macroPulseNumberSource);
_doocsUpdater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct,
std::bind(&DoocsProcessScalar<T, DOOCS_T>::updateDoocsBuffer, this, macroPulseNumberSource->getId()));
}
}
else {
// We don't need to match up anything with it when it changes, but we have to register this at least once
// so the macropulse number will be included in the readAnyGroup in the updater if
// <data_matching> is none everywhere
_doocsUpdater.addVariable(
ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {});
}
}
boost::shared_ptr<ChimeraTK::NDRegisterAccessor<T>> _processScalar;
......
......@@ -187,18 +187,16 @@ namespace ChimeraTK {
void DoocsIfff::setMacroPulseNumberSource(
boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) {
// FIXME: Assuming macroPulseNumberSource is relavent only when all 4
// components are readable; correct behavior later if this assumption
// does not hold.
bool isIfffReadable =
(_i1Value->isReadable() && _f1Value->isReadable() && _f2Value->isReadable() && _f3Value->isReadable());
if(not isIfffReadable) {
return;
}
_macroPulseNumberSource = macroPulseNumberSource;
if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) {
registerVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(_macroPulseNumberSource));
}
else {
// We don't need to match up anything with it when it changes, but we have to register this at least once
// so the macropulse number will be included in the readAnyGroup in the updater if
// <data_matching> is none everywhere
_updater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {});
}
}
void DoocsIfff::registerVariable(const ChimeraTK::TransferElementAbstractor& var) {
......
......@@ -222,13 +222,17 @@ namespace ChimeraTK {
void DoocsSpectrum::setMacroPulseNumberSource(
boost::shared_ptr<ChimeraTK::NDRegisterAccessor<int64_t>> macroPulseNumberSource) {
if(_processArray->isReadable()) {
_macroPulseNumberSource = macroPulseNumberSource;
if(_consistencyGroup.getMatchingMode() != DataConsistencyGroup::MatchingMode::none) {
_consistencyGroup.add(macroPulseNumberSource);
_doocsUpdater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct,
std::bind(&DoocsSpectrum::updateDoocsBuffer, this, macroPulseNumberSource->getId()));
}
else {
// We don't need to match up anything with it when it changes, but we have to register this at least once
// so the macropulse number will be included in the readAnyGroup in the updater if
// <data_matching> is none everywhere
_doocsUpdater.addVariable(ChimeraTK::ScalarRegisterAccessor<int64_t>(macroPulseNumberSource), _eqFct, []() {});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment