From 6f67bd500b330bee228d301cfd453d367b34f0ee Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 13 Apr 2023 23:31:33 +0200 Subject: [PATCH 1/4] add new heater health device --- linux/acs/StrComHandler.cpp | 2 +- mission/genericFactory.cpp | 18 ++++++++++-------- mission/tcs/CMakeLists.txt | 5 +++-- mission/tcs/HeaterHandler.h | 3 ++- mission/tcs/HeaterHealthDev.cpp | 12 ++++++++++++ mission/tcs/HeaterHealthDev.h | 12 ++++++++++++ unittest/controller/testThermalController.cpp | 4 ++-- 7 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 mission/tcs/HeaterHealthDev.cpp create mode 100644 mission/tcs/HeaterHealthDev.h diff --git a/linux/acs/StrComHandler.cpp b/linux/acs/StrComHandler.cpp index 3c88a71b..51c66f18 100644 --- a/linux/acs/StrComHandler.cpp +++ b/linux/acs/StrComHandler.cpp @@ -451,7 +451,7 @@ ReturnValue_t StrComHandler::performFlashWrite() { return returnvalue::OK; } result = writeNextSegment(idx); - if(result != returnvalue::OK) { + if (result != returnvalue::OK) { return result; } if (idx % 50 == 0) { diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index 9889fe9e..b0b8e8f5 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -287,15 +287,17 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun void ObjectFactory::createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, HeaterHandler*& heaterHandler) { HeaterHelper helper({{ - {new HealthDevice(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE), + {new HeaterHealthDev(objects::HEATER_0_PLOC_PROC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_0}, - {new HealthDevice(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_1}, - {new HealthDevice(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2}, - {new HealthDevice(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3}, - {new HealthDevice(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4}, - {new HealthDevice(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5}, - {new HealthDevice(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6}, - {new HealthDevice(objects::HEATER_7_SYRLINKS, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_7}, + {new HeaterHealthDev(objects::HEATER_1_PCDU_BRD, MessageQueueIF::NO_QUEUE), + gpioIds::HEATER_1}, + {new HeaterHealthDev(objects::HEATER_2_ACS_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_2}, + {new HeaterHealthDev(objects::HEATER_3_OBC_BRD, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_3}, + {new HeaterHealthDev(objects::HEATER_4_CAMERA, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_4}, + {new HeaterHealthDev(objects::HEATER_5_STR, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_5}, + {new HeaterHealthDev(objects::HEATER_6_DRO, MessageQueueIF::NO_QUEUE), gpioIds::HEATER_6}, + {new HeaterHealthDev(objects::HEATER_7_SYRLINKS, MessageQueueIF::NO_QUEUE), + gpioIds::HEATER_7}, }}); heaterHandler = new HeaterHandler(objects::HEATER_HANDLER, &gpioIF, helper, &pwrSwitcher, power::Switches::PDU2_CH3_TCS_BOARD_HEATER_IN_8V); diff --git a/mission/tcs/CMakeLists.txt b/mission/tcs/CMakeLists.txt index ea077050..c23e9c18 100644 --- a/mission/tcs/CMakeLists.txt +++ b/mission/tcs/CMakeLists.txt @@ -1,3 +1,4 @@ target_sources( - ${LIB_EIVE_MISSION} PRIVATE HeaterHandler.cpp max1227.cpp - Max31865EiveHandler.cpp Tmp1075Handler.cpp) + ${LIB_EIVE_MISSION} + PRIVATE HeaterHandler.cpp max1227.cpp Max31865EiveHandler.cpp + Tmp1075Handler.cpp HeaterHealthDev.cpp) diff --git a/mission/tcs/HeaterHandler.h b/mission/tcs/HeaterHandler.h index c3ea4afa..609ac725 100644 --- a/mission/tcs/HeaterHandler.h +++ b/mission/tcs/HeaterHandler.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -27,7 +28,7 @@ class PowerSwitchIF; class HealthTableIF; -using HeaterPair = std::pair; +using HeaterPair = std::pair; struct HeaterHelper { public: diff --git a/mission/tcs/HeaterHealthDev.cpp b/mission/tcs/HeaterHealthDev.cpp new file mode 100644 index 00000000..6be56a09 --- /dev/null +++ b/mission/tcs/HeaterHealthDev.cpp @@ -0,0 +1,12 @@ +#include "HeaterHealthDev.h" + +HeaterHealthDev::HeaterHealthDev(object_id_t setObjectId, MessageQueueId_t parentQueue) + : HealthDevice(setObjectId, parentQueue) {} + +ReturnValue_t HeaterHealthDev::setHealth(HealthState health) { + // Does not make sense for a simple heater. + if (health == HealthState::NEEDS_RECOVERY) { + return returnvalue::FAILED; + } + return HealthDevice::setHealth(health); +} diff --git a/mission/tcs/HeaterHealthDev.h b/mission/tcs/HeaterHealthDev.h new file mode 100644 index 00000000..8d15836c --- /dev/null +++ b/mission/tcs/HeaterHealthDev.h @@ -0,0 +1,12 @@ +#ifndef MISSION_TCS_HEATERHEALTHDEV_H_ +#define MISSION_TCS_HEATERHEALTHDEV_H_ +#include + +class HeaterHealthDev : public HealthDevice { + public: + HeaterHealthDev(object_id_t setObjectId, MessageQueueId_t parentQueue); + + ReturnValue_t setHealth(HealthState health) override; +}; + +#endif /* MISSION_TCS_HEATERHEALTHDEV_H_ */ diff --git a/unittest/controller/testThermalController.cpp b/unittest/controller/testThermalController.cpp index 0e12d94d..c2166ca0 100644 --- a/unittest/controller/testThermalController.cpp +++ b/unittest/controller/testThermalController.cpp @@ -47,8 +47,8 @@ TEST_CASE("Thermal Controller", "[ThermalController]") { CommandMessage modeMessage; - ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND, - HasModesIF::MODE_ON, HasModesIF::SUBMODE_NONE); + ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND, HasModesIF::MODE_ON, + HasModesIF::SUBMODE_NONE); MessageQueueIF* commandQueue = QueueFactory::instance()->createMessageQueue(5, MessageQueueMessage::MAX_MESSAGE_SIZE); From 28eaf8461aa173898a95749def4bf759073ae775 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 13 Apr 2023 23:32:08 +0200 Subject: [PATCH 2/4] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1166f514..36d64a72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,10 @@ will consitute of a breaking change warranting a new major release: - Bugfix for STR where an invalid reply was received for special requests like firmware updates. +## Changed + +- Reject `NEEDS_RECOVERY` health commands for the heater health devices. + ## Added - Add a way for the MAX31865 RTD handlers to recognize faulty/broken/off sensor devices. From 38b9a9b34e652ecc6eb556d9d8480a0e323a69bf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 14:45:02 +0200 Subject: [PATCH 3/4] bump sagittactl --- thirdparty/sagittactl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/sagittactl b/thirdparty/sagittactl index 64332216..29e87667 160000 --- a/thirdparty/sagittactl +++ b/thirdparty/sagittactl @@ -1 +1 @@ -Subproject commit 64332216c193fa6483258060b53fc2842c08dcf4 +Subproject commit 29e876671a72fcdb0b393e2f692303725f00724f From b0a2b5886fe8e91af2d12c62387e1322c4b83adf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 14 Apr 2023 18:45:58 +0200 Subject: [PATCH 4/4] hotfix ACS/SUS --- CHANGELOG.md | 3 +++ linux/acs/AcsBoardPolling.cpp | 12 ++++++++---- linux/acs/SusPolling.cpp | 4 +++- tmtc | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78b2a491..2c7d6ac7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ will consitute of a breaking change warranting a new major release: - Bugfix for STR where an invalid reply was received for special requests like firmware updates. - Bugfix for shell command executors in command controller which lead to a crash. +- Fixed regression where the reply result for ACS board and SUS board devices was set to FAILED + even when going to OFF mode. In that case, it has to be set to OK so the device handler can + complete the OFF transition. ## Changed diff --git a/linux/acs/AcsBoardPolling.cpp b/linux/acs/AcsBoardPolling.cpp index bc3dff74..e525bf53 100644 --- a/linux/acs/AcsBoardPolling.cpp +++ b/linux/acs/AcsBoardPolling.cpp @@ -122,13 +122,14 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send } else { sif::warning << "AcsBoardPolling: Unknown ADIS type" << std::endl; } + adis.replyResult = returnvalue::FAILED; adis.performStartup = true; } else if (req->mode == acs::SimpleSensorMode::OFF) { adis.performStartup = false; adis.ownReply.cfgWasSet = false; adis.ownReply.dataWasSet = false; + adis.replyResult = returnvalue::OK; } - adis.replyResult = returnvalue::FAILED; adis.mode = req->mode; } return returnvalue::OK; @@ -144,10 +145,11 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode == acs::SimpleSensorMode::NORMAL) { std::memcpy(gyro.sensorCfg, req->ctrlRegs, 5); gyro.performStartup = true; + gyro.replyResult = returnvalue::FAILED; } else { gyro.ownReply.cfgWasSet = false; + gyro.replyResult = returnvalue::OK; } - gyro.replyResult = returnvalue::FAILED; gyro.mode = req->mode; } return returnvalue::OK; @@ -162,11 +164,12 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode != mgm.mode) { if (req->mode == acs::SimpleSensorMode::NORMAL) { mgm.performStartup = true; + mgm.replyResult = returnvalue::FAILED; } else { mgm.ownReply.dataWasSet = false; + mgm.replyResult = returnvalue::OK; mgm.ownReply.temperatureWasSet = false; } - mgm.replyResult = returnvalue::FAILED; mgm.mode = req->mode; } return returnvalue::OK; @@ -181,10 +184,11 @@ ReturnValue_t AcsBoardPolling::sendMessage(CookieIF* cookie, const uint8_t* send if (req->mode != mgm.mode) { if (req->mode == acs::SimpleSensorMode::NORMAL) { mgm.performStartup = true; + mgm.replyResult = returnvalue::FAILED; } else { mgm.ownReply.dataWasRead = false; + mgm.replyResult = returnvalue::OK; } - mgm.replyResult = returnvalue::FAILED; mgm.mode = req->mode; } return returnvalue::OK; diff --git a/linux/acs/SusPolling.cpp b/linux/acs/SusPolling.cpp index 1da5ef5e..2ef02f43 100644 --- a/linux/acs/SusPolling.cpp +++ b/linux/acs/SusPolling.cpp @@ -69,11 +69,13 @@ ReturnValue_t SusPolling::sendMessage(CookieIF* cookie, const uint8_t* sendData, if (susDevs[susIdx].mode != susReq->mode) { if (susReq->mode == acs::SimpleSensorMode::NORMAL) { susDevs[susIdx].performStartup = true; + susDevs[susIdx].replyResult = returnvalue::FAILED; } else { susDevs[susIdx].ownReply.cfgWasSet = false; susDevs[susIdx].ownReply.dataWasSet = false; + // We are off now, but DHB wants a proper reply. + susDevs[susIdx].replyResult = returnvalue::OK; } - susDevs[susIdx].replyResult = returnvalue::FAILED; susDevs[susIdx].mode = susReq->mode; } if (state == InternalState::IDLE) { diff --git a/tmtc b/tmtc index f8da9cff..f5734260 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit f8da9cff7c5d6d6bdd483f90ccefb67b2d1e11a4 +Subproject commit f57342602da3232c0bfecaecb0c10be6d692b384