From ebbd6c1373ca0e58ad6eee8a13dc399bbd054388 Mon Sep 17 00:00:00 2001 From: d-rothe <39566710+d-rothe@users.noreply.github.com> Date: Wed, 18 May 2022 10:57:12 +0200 Subject: [PATCH] partial fix for #9836 (#69) * partial fix for #9836 This fixes that cleared error codes appear in DOOCS history where error is not yet cleared. It is only a partial fix since the history still contains more data than was intended; intended was only first invalid data point * remove comments about outdated concept Co-authored-by: Dietrich Rothe <dietrich.rothe@desy.de> --- include/DoocsProcessScalar.h | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/include/DoocsProcessScalar.h b/include/DoocsProcessScalar.h index a79f813..dc0a439 100644 --- a/include/DoocsProcessScalar.h +++ b/include/DoocsProcessScalar.h @@ -47,11 +47,8 @@ namespace ChimeraTK { // DoocsUpdater auto data = _processScalar->accessData(0); - bool storeInHistory = true; auto archiverStatus = ArchiveStatus::sts_ok; if(_processScalar->dataValidity() != ChimeraTK::DataValidity::ok) { - if(this->d_error()) // data are alredy invalid, do not store in history - storeInHistory = false; archiverStatus = ArchiveStatus::sts_err; //set data invalid in DOOCS for current data @@ -75,28 +72,9 @@ namespace ChimeraTK { set_global_timestamp(timestamp); } - // we must not call set_and_archive if there is no history (otherwise it - // will be activated), but we have to if it is there. -> Abstraction, - // please! - // - // We should also checked if data should be stored (flag storeInHistory). Invalid data should NOT be stored except first invalid data point. - // (https://github.com/ChimeraTK/ControlSystemAdapter-DoocsAdapter/issues/40) - if(this->get_histPointer() && storeInHistory) { - // Set eventId - doocs::EventId eventId; - if(_macroPulseNumberSource) eventId = doocs::EventId(_macroPulseNumberSource->accessData(0)); - - // The timestamp we give with set_and_archive is for the archiver only. - this->set_and_archive(data, archiverStatus, timestamp, eventId); - } - else { - this->set_value(data); - } - - // We must set the timestamp again so it is correctly attached to the variable. set_and_archive does not to it. - // This must happen after set_and_archive, otherwise the global time stamp is taken. - this->set_timestamp(timestamp); - if(_macroPulseNumberSource) this->set_mpnum(_macroPulseNumberSource->accessData(0)); + doocs::EventId eventId; + if(_macroPulseNumberSource) eventId = doocs::EventId(_macroPulseNumberSource->accessData(0)); + this->set_value(data, timestamp, eventId, archiverStatus); // send data via ZeroMQ if enabled and if DOOCS initialisation is complete if(_publishZMQ && ChimeraTK::DoocsAdapter::isInitialised) { -- GitLab