From 01081cbb29849d450afd0260b8ed4185557c3c7d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 4 Apr 2023 14:45:09 +0200 Subject: [PATCH] set health overrides --- CHANGELOG.md | 6 ++++++ mission/power/GomspaceDeviceHandler.cpp | 8 ++++++++ mission/power/GomspaceDeviceHandler.h | 3 +++ mission/tcs/Tmp1075Handler.cpp | 8 ++++++++ mission/tcs/Tmp1075Handler.h | 1 + 5 files changed, 26 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 206b2fff..4b0832b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,12 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- PCDU components only allow setting `NEEDS_RECOVERY`, `HEALTHY` and `EXTERNAL_CONTROL` health + states now. TMP sensor components only allow `HEALTHY` , `EXTERNAL_CONTROL`, `FAULTY` and + `PERMANENT_FAULTY`. + # [v1.43.0] 2023-04-04 - q7s-package: v2.4.0 diff --git a/mission/power/GomspaceDeviceHandler.cpp b/mission/power/GomspaceDeviceHandler.cpp index 3bed8d73..80caba0c 100644 --- a/mission/power/GomspaceDeviceHandler.cpp +++ b/mission/power/GomspaceDeviceHandler.cpp @@ -642,3 +642,11 @@ ReturnValue_t GomspaceDeviceHandler::parsePduHkTable(PDU::PduCoreHk& coreHk, PDU } return returnvalue::OK; } + +ReturnValue_t GomspaceDeviceHandler::setHealth(HealthState health) { + if(health != HealthState::HEALTHY and health != HealthState::EXTERNAL_CONTROL and + health != HealthState::NEEDS_RECOVERY) { + return returnvalue::FAILED; + } + return returnvalue::OK; +} diff --git a/mission/power/GomspaceDeviceHandler.h b/mission/power/GomspaceDeviceHandler.h index c1db9044..758cc5a3 100644 --- a/mission/power/GomspaceDeviceHandler.h +++ b/mission/power/GomspaceDeviceHandler.h @@ -80,6 +80,9 @@ class GomspaceDeviceHandler : public DeviceHandlerBase { ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; void setNormalDatapoolEntriesInvalid() override; uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; + + ReturnValue_t setHealth(HealthState health) override; + /** * @brief The command to generate a request to receive the full housekeeping table is device * specific. Thus the child has to build this command. diff --git a/mission/tcs/Tmp1075Handler.cpp b/mission/tcs/Tmp1075Handler.cpp index d1f144f0..92ac8a5c 100644 --- a/mission/tcs/Tmp1075Handler.cpp +++ b/mission/tcs/Tmp1075Handler.cpp @@ -132,3 +132,11 @@ ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &local } void Tmp1075Handler::setModeNormal() { setMode(_MODE_TO_NORMAL); } + +ReturnValue_t Tmp1075Handler::setHealth(HealthState health) { + if(health != FAULTY and health != PERMANENT_FAULTY and health != HEALTHY and + health != EXTERNAL_CONTROL) { + return returnvalue::FAILED; + } + return returnvalue::OK; +} diff --git a/mission/tcs/Tmp1075Handler.h b/mission/tcs/Tmp1075Handler.h index 8d039446..02fd6823 100644 --- a/mission/tcs/Tmp1075Handler.h +++ b/mission/tcs/Tmp1075Handler.h @@ -37,6 +37,7 @@ class Tmp1075Handler : public DeviceHandlerBase { uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; + ReturnValue_t setHealth(HealthState health) override; private: /**