From 24c050765b73e10849f1c98505385cac2fbb7e8d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 Oct 2022 10:51:34 +0200 Subject: [PATCH] countdown to ensure periodic lock checking --- linux/obc/PdecHandler.cpp | 5 +++++ linux/obc/PdecHandler.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/linux/obc/PdecHandler.cpp b/linux/obc/PdecHandler.cpp index 1530a59a..54f0e1ff 100644 --- a/linux/obc/PdecHandler.cpp +++ b/linux/obc/PdecHandler.cpp @@ -167,6 +167,7 @@ ReturnValue_t PdecHandler::irqOperation() { if (ret == 0) { // No TCs for timeout period checkLocks(); + lockCheckCd.resetTimer(); } else if (ret >= 1) { nb = read(fd, &info, sizeof(info)); if (nb == static_cast(sizeof(info))) { @@ -182,6 +183,10 @@ ReturnValue_t PdecHandler::irqOperation() { // Read FAR here CURRENT_FAR = readFar(); } + if (lockCheckCd.hasTimedOut()) { + checkLocks(); + lockCheckCd.resetTimer(); + } // Clear interrupts with dummy read ret = *(registerBaseAddress + PDEC_PIR_OFFSET); } diff --git a/linux/obc/PdecHandler.h b/linux/obc/PdecHandler.h index aad3cbdf..be6299fb 100644 --- a/linux/obc/PdecHandler.h +++ b/linux/obc/PdecHandler.h @@ -1,6 +1,8 @@ #ifndef LINUX_OBC_PDECHANDLER_H_ #define LINUX_OBC_PDECHANDLER_H_ +#include + #include "OBSWConfig.h" #include "PdecConfig.h" #include "fsfw/action/ActionHelper.h" @@ -200,6 +202,7 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc static uint32_t CURRENT_FAR; + Countdown lockCheckCd = Countdown(IRQ_TIMEOUT_MS); object_id_t tcDestinationId; AcceptsTelecommandsIF* tcDestination = nullptr;