From b89e440fc4a015995a42c56e20550fc36a329ead Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Dec 2022 10:19:28 +0100 Subject: [PATCH] added health getter function --- bsp_hosted/scheduling.cpp | 2 +- mission/controller/ThermalController.cpp | 1 - mission/controller/ThermalController.h | 3 ++- mission/devices/HeaterHandler.cpp | 9 +++++++++ mission/devices/HeaterHandler.h | 2 ++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bsp_hosted/scheduling.cpp b/bsp_hosted/scheduling.cpp index ba393e3a..843b2892 100644 --- a/bsp_hosted/scheduling.cpp +++ b/bsp_hosted/scheduling.cpp @@ -186,7 +186,7 @@ void scheduling::initTasks() { #endif /* OBSW_ADD_TEST_CODE == 1 */ PeriodicTaskIF* dummyTask = factory->createPeriodicTask( - "DUMMY_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); + "DUMMY_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); scheduling::scheduleTmpTempSensors(dummyTask); scheduling::scheduleRtdSensors(dummyTask); dummyTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF); diff --git a/mission/controller/ThermalController.cpp b/mission/controller/ThermalController.cpp index b2845c69..a8c378df 100644 --- a/mission/controller/ThermalController.cpp +++ b/mission/controller/ThermalController.cpp @@ -106,7 +106,6 @@ void ThermalController::performControlOperation() { // TODO: Heater control ctrl4KCamera(); - } ReturnValue_t ThermalController::initializeLocalDataPool(localpool::DataPool& localDataPoolMap, diff --git a/mission/controller/ThermalController.h b/mission/controller/ThermalController.h index dd60524b..a6d6a3b3 100644 --- a/mission/controller/ThermalController.h +++ b/mission/controller/ThermalController.h @@ -19,7 +19,8 @@ * limit is exceeded to avoid reaching NOP limit */ struct TempLimits { - TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit, float nopUpperLimit) + TempLimits(float nopLowerLimit, float opLowerLimit, float cutOffLimit, float opUpperLimit, + float nopUpperLimit) : opLowerLimit(opLowerLimit), opUpperLimit(opUpperLimit), cutOffLimit(cutOffLimit), diff --git a/mission/devices/HeaterHandler.cpp b/mission/devices/HeaterHandler.cpp index a2e4a451..8fd166f0 100644 --- a/mission/devices/HeaterHandler.cpp +++ b/mission/devices/HeaterHandler.cpp @@ -361,3 +361,12 @@ ReturnValue_t HeaterHandler::getSwitchState(uint8_t switchNr) const { ReturnValue_t HeaterHandler::getFuseState(uint8_t fuseNr) const { return 0; } uint32_t HeaterHandler::getSwitchDelayMs(void) const { return 2000; } + +HasHealthIF::HealthState HeaterHandler::getHealth(heater::Switchers heater) { + auto* healthDev = heaterVec.at(heater).healthDevice; + if (healthDev != nullptr) { + MutexGuard mg(heaterMutex); + return healthDev->getHealth(); + } + return HasHealthIF::HealthState::FAULTY; +} diff --git a/mission/devices/HeaterHandler.h b/mission/devices/HeaterHandler.h index ede7c422..ac4f94f4 100644 --- a/mission/devices/HeaterHandler.h +++ b/mission/devices/HeaterHandler.h @@ -68,6 +68,8 @@ class HeaterHandler : public ExecutableObjectIF, enum SwitchAction : uint8_t { SET_SWITCH_OFF, SET_SWITCH_ON, NONE }; ReturnValue_t switchHeater(heater::Switchers heater, SwitchState switchState); + HasHealthIF::HealthState getHealth(heater::Switchers heater); + ReturnValue_t performOperation(uint8_t operationCode = 0) override; ReturnValue_t sendSwitchCommand(uint8_t switchNr, ReturnValue_t onOff) override;