From 7e9d095ed16264786480e648465efa7d44abe8d8 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 28 Sep 2020 22:38:36 +0200 Subject: [PATCH] important bugfixes --- datapool/PoolDataSetBase.cpp | 5 +++++ datapoollocal/LocalDataPoolManager.h | 11 +++++++++-- internalError/InternalErrorReporter.cpp | 7 ++++++- internalError/InternalErrorReporter.h | 1 + 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/datapool/PoolDataSetBase.cpp b/datapool/PoolDataSetBase.cpp index 1acd3fd3..cb2348f7 100644 --- a/datapool/PoolDataSetBase.cpp +++ b/datapool/PoolDataSetBase.cpp @@ -59,6 +59,11 @@ uint16_t PoolDataSetBase::getFillCount() const { ReturnValue_t PoolDataSetBase::readVariable(uint16_t count) { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + if(registeredVariables[count] == nullptr) { + // configuration error. + return HasReturnvaluesIF::RETURN_FAILED; + } + // These checks are often performed by the respective // variable implementation too, but I guess a double check does not hurt. if (registeredVariables[count]->getReadWriteMode() != diff --git a/datapoollocal/LocalDataPoolManager.h b/datapoollocal/LocalDataPoolManager.h index e55efa9c..c3b385e8 100644 --- a/datapoollocal/LocalDataPoolManager.h +++ b/datapoollocal/LocalDataPoolManager.h @@ -58,6 +58,7 @@ public: static constexpr ReturnValue_t WRONG_HK_PACKET_TYPE = MAKE_RETURN_CODE(0x03); static constexpr ReturnValue_t REPORTING_STATUS_UNCHANGED = MAKE_RETURN_CODE(0x04); static constexpr ReturnValue_t PERIODIC_HELPER_INVALID = MAKE_RETURN_CODE(0x05); + /** * This constructor is used by a class which wants to implement * a personal local data pool. The queueToUse can be supplied if it @@ -73,14 +74,20 @@ public: virtual~ LocalDataPoolManager(); /** - * Initializes the map by calling the map initialization function of the - * owner and assigns the queue to use. + * Assigns the queue to use. * @param queueToUse * @param nonDiagInvlFactor See #setNonDiagnosticIntervalFactor doc * @return */ ReturnValue_t initialize(MessageQueueIF* queueToUse); + /** + * Initializes the map by calling the map initialization function and + * setting the periodic factor for non-diagnostic packets. + * Don't forget to call this, otherwise the map will be invalid! + * @param nonDiagInvlFactor + * @return + */ ReturnValue_t initializeAfterTaskCreation(uint8_t nonDiagInvlFactor = 5); /** diff --git a/internalError/InternalErrorReporter.cpp b/internalError/InternalErrorReporter.cpp index 4cdab9e7..943ae8b3 100644 --- a/internalError/InternalErrorReporter.cpp +++ b/internalError/InternalErrorReporter.cpp @@ -158,7 +158,7 @@ ReturnValue_t InternalErrorReporter::initializeLocalDataPool( // todo: Only send HK if values have changed, will be supported by // pool manager soon. poolManager.subscribeForPeriodicPacket(internalErrorSid, false, - getPeriodicOperationFrequency(), false); + getPeriodicOperationFrequency(), true); return HasReturnvaluesIF::RETURN_OK; } @@ -185,3 +185,8 @@ ReturnValue_t InternalErrorReporter::initialize() { } return SystemObject::initialize(); } + +ReturnValue_t InternalErrorReporter::initializeAfterTaskCreation() { + return poolManager.initializeAfterTaskCreation(); +} + diff --git a/internalError/InternalErrorReporter.h b/internalError/InternalErrorReporter.h index c715f7a0..8d33c06e 100644 --- a/internalError/InternalErrorReporter.h +++ b/internalError/InternalErrorReporter.h @@ -46,6 +46,7 @@ public: virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; virtual ReturnValue_t initialize() override; + virtual ReturnValue_t initializeAfterTaskCreation() override; virtual ReturnValue_t performOperation(uint8_t opCode) override; virtual void queueMessageNotSent();