From a8167f5431b73ea67b82b84740b48646a4b6e35a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 17:02:08 +0200 Subject: [PATCH] added another helper function --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 8 ++++++++ src/fsfw/devicehandlers/DeviceHandlerBase.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index e7de914b..b14a46e9 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -1573,3 +1573,11 @@ MessageQueueId_t DeviceHandlerBase::getCommanderQueueId(DeviceCommandId_t replyI } return commandIter->second.sendReplyTo; } + +void DeviceHandlerBase::finishCommandExecution(DeviceCommandId_t replyId) { + auto commandIter = deviceCommandMap.find(replyId); + if(commandIter == deviceCommandMap.end()) { + return; + } + commandIter->second.isExecuting = false; +} diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index e8ef9ada..aaf9d4ab 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -405,6 +405,8 @@ protected: virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) = 0; MessageQueueId_t getCommanderQueueId(DeviceCommandId_t replyId) const; + void finishCommandExecution(DeviceCommandId_t replyId); + /** * Helper function to get pending command. This is useful for devices * like SPI sensors to identify the last sent command.