diff --git a/CHANGELOG.md b/CHANGELOG.md index 08f904a9..40622385 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ will consitute of a breaking change warranting a new major release: - TMP1075: Set dataset invalid on shutdown explicitely - Small fixes for TMP1075 FDIR: Use strange and missed reply counters. +- TMP1075: Devices did not go to OFF mode when being set faulty. +- Update PL PCDU 1 in TCS mode tree on the EM. +- TMP1075: Possibly ignored health commands. # [v6.0.0] 2023-07-02 diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 28fabe7a..085d5184 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -168,5 +168,5 @@ void ObjectFactory::produce(void* args) { HeaterHandler* heaterHandler; createHeaterComponents(gpioComIF, pwrSwitcher, healthTable, heaterHandler); createThermalController(*heaterHandler, true); - satsystem::init(); + satsystem::init(true); } diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index fa6e7220..5e2cdb59 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -133,5 +133,5 @@ void ObjectFactory::produce(void* args) { createMiscComponents(); createThermalController(*heaterHandler, false); createAcsController(true, enableHkSets); - satsystem::init(); + satsystem::init(false); } diff --git a/bsp_q7s/objectFactory.cpp b/bsp_q7s/objectFactory.cpp index cd4dd32c..a96051f2 100644 --- a/bsp_q7s/objectFactory.cpp +++ b/bsp_q7s/objectFactory.cpp @@ -172,10 +172,6 @@ void ObjectFactory::createTmpComponents(std::vectorsetCustomFdir(new TmpDevFdir(tmpDevsToAdd[idx].first)); tmpDevHandler->connectModeTreeParent(satsystem::tcs::SUBSYSTEM); - // TODO: Remove this after TCS subsystem was added - // These devices are connected to the 3V3 stack and should be powered permanently. Therefore, - // we set them to normal mode immediately here. - tmpDevHandler->setModeNormal(); } } diff --git a/dummies/Max31865Dummy.cpp b/dummies/Max31865Dummy.cpp index 6ec1a716..99fc336a 100644 --- a/dummies/Max31865Dummy.cpp +++ b/dummies/Max31865Dummy.cpp @@ -7,15 +7,21 @@ using namespace returnvalue; Max31865Dummy::Max31865Dummy(object_id_t objectId, object_id_t comif, CookieIF *comCookie) : DeviceHandlerBase(objectId, comif, comCookie), set(this, EiveMax31855::EXCHANGE_SET_ID) {} void Max31865Dummy::doStartUp() { setMode(MODE_ON); } -void Max31865Dummy::doShutDown() { setMode(_MODE_POWER_DOWN); } +void Max31865Dummy::doShutDown() { + PoolReadGuard pg(&set); + set.setValidity(false, true); + setMode(MODE_OFF); +} ReturnValue_t Max31865Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; } -ReturnValue_t Max31865Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { return OK; } +ReturnValue_t Max31865Dummy::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} ReturnValue_t Max31865Dummy::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen) { - return 0; + return NOTHING_TO_SEND; } ReturnValue_t Max31865Dummy::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { diff --git a/dummies/Tmp1075Dummy.cpp b/dummies/Tmp1075Dummy.cpp index 96d1f775..7e61acef 100644 --- a/dummies/Tmp1075Dummy.cpp +++ b/dummies/Tmp1075Dummy.cpp @@ -9,7 +9,11 @@ Tmp1075Dummy::Tmp1075Dummy(object_id_t objectId, object_id_t comif, CookieIF *co : DeviceHandlerBase(objectId, comif, comCookie), set(this) {} void Tmp1075Dummy::doStartUp() { setMode(MODE_ON); } -void Tmp1075Dummy::doShutDown() { setMode(MODE_OFF); } +void Tmp1075Dummy::doShutDown() { + PoolReadGuard pg(&set); + set.setValidity(false, true); + setMode(MODE_OFF); +} ReturnValue_t Tmp1075Dummy::buildNormalDeviceCommand(DeviceCommandId_t *id) { return NOTHING_TO_SEND; @@ -50,4 +54,11 @@ ReturnValue_t Tmp1075Dummy::initializeLocalDataPool(localpool::DataPool &localDa return OK; } +ReturnValue_t Tmp1075Dummy::setHealth(HealthState health) { + if (health == FAULTY or health == PERMANENT_FAULTY) { + setMode(_MODE_SHUT_DOWN); + } + return DeviceHandlerBase::setHealth(health); +} + LocalPoolDataSetBase *Tmp1075Dummy::getDataSetHandle(sid_t sid) { return &set; } diff --git a/dummies/Tmp1075Dummy.h b/dummies/Tmp1075Dummy.h index 570fcd42..feab4f98 100644 --- a/dummies/Tmp1075Dummy.h +++ b/dummies/Tmp1075Dummy.h @@ -26,6 +26,7 @@ class Tmp1075Dummy : 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; protected: LocalPoolDataSetBase *getDataSetHandle(sid_t sid) override; diff --git a/mission/system/systemTree.cpp b/mission/system/systemTree.cpp index 41bf3216..10c40617 100644 --- a/mission/system/systemTree.cpp +++ b/mission/system/systemTree.cpp @@ -31,12 +31,12 @@ void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh); static const auto OFF = HasModesIF::MODE_OFF; static const auto NML = DeviceHandlerIF::MODE_NORMAL; -void satsystem::init() { +void satsystem::init(bool commandPlPcdu1) { auto& acsSubsystem = acs::init(); acsSubsystem.connectModeTreeParent(EIVE_SYSTEM); auto& payloadSubsystem = payload::init(); payloadSubsystem.connectModeTreeParent(EIVE_SYSTEM); - auto& tcsSubsystem = tcs::init(); + auto& tcsSubsystem = tcs::init(commandPlPcdu1); tcsSubsystem.connectModeTreeParent(EIVE_SYSTEM); auto& comSubsystem = com::init(); comSubsystem.connectModeTreeParent(EIVE_SYSTEM); diff --git a/mission/system/systemTree.h b/mission/system/systemTree.h index 9d769277..0ed73a89 100644 --- a/mission/system/systemTree.h +++ b/mission/system/systemTree.h @@ -5,7 +5,7 @@ namespace satsystem { -void init(); +void init(bool commandPlPcdu1); extern EiveSystem EIVE_SYSTEM; diff --git a/mission/system/tcs/tcsModeTree.cpp b/mission/system/tcs/tcsModeTree.cpp index 6cc57c6f..09a4fa61 100644 --- a/mission/system/tcs/tcsModeTree.cpp +++ b/mission/system/tcs/tcsModeTree.cpp @@ -10,8 +10,8 @@ TcsSubsystem satsystem::tcs::SUBSYSTEM(objects::TCS_SUBSYSTEM, 12, 24); namespace { // Alias for checker function const auto check = subsystem::checkInsert; -void buildOffSequence(Subsystem& ss, ModeListEntry& eh); -void buildNormalSequence(Subsystem& ss, ModeListEntry& eh); +void buildOffSequence(Subsystem& ss, ModeListEntry& eh, bool commandPlPcdu1); +void buildNormalSequence(Subsystem& ss, ModeListEntry& eh, bool commandPlPcdu1); } // namespace static const auto OFF = HasModesIF::MODE_OFF; @@ -27,17 +27,17 @@ auto TCS_TABLE_NORMAL_TGT = std::make_pair((NML << 24) | 1, FixedArrayList()); auto TCS_TABLE_NORMAL_TRANS_1 = std::make_pair((NML << 24) | 3, FixedArrayList()); -Subsystem& satsystem::tcs::init() { +Subsystem& satsystem::tcs::init(bool commandPlPcdu1) { ModeListEntry entry; - buildOffSequence(SUBSYSTEM, entry); - buildNormalSequence(SUBSYSTEM, entry); + buildOffSequence(SUBSYSTEM, entry, commandPlPcdu1); + buildNormalSequence(SUBSYSTEM, entry, commandPlPcdu1); SUBSYSTEM.setInitialMode(OFF); return SUBSYSTEM; } namespace { -void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { +void buildOffSequence(Subsystem& ss, ModeListEntry& eh, bool commandPlPcdu1) { std::string context = "satsystem::tcs::buildOffSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -67,7 +67,9 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { iht(objects::TMP1075_HANDLER_TCS_0, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); iht(objects::TMP1075_HANDLER_TCS_1, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); iht(objects::TMP1075_HANDLER_PLPCDU_0, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); - // TMP PL PCDU 1 is damaged + if (commandPlPcdu1) { + iht(objects::TMP1075_HANDLER_PLPCDU_1, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); + } iht(objects::TMP1075_HANDLER_IF_BOARD, OFF, 0, TCS_TABLE_OFF_TRANS_1.second); check(ss.addTable(TableEntry(TCS_TABLE_OFF_TRANS_1.first, &TCS_TABLE_OFF_TRANS_1.second)), ctxc); @@ -79,7 +81,7 @@ void buildOffSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); } -void buildNormalSequence(Subsystem& ss, ModeListEntry& eh) { +void buildNormalSequence(Subsystem& ss, ModeListEntry& eh, bool commandPlPcdu1) { std::string context = "satsystem::tcs::buildNormalSequence"; auto ctxc = context.c_str(); // Insert Helper Table @@ -105,7 +107,9 @@ void buildNormalSequence(Subsystem& ss, ModeListEntry& eh) { iht(objects::TMP1075_HANDLER_TCS_0, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); iht(objects::TMP1075_HANDLER_TCS_1, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); iht(objects::TMP1075_HANDLER_PLPCDU_0, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); - // TMP PL PCDU 1 is damaged + if (commandPlPcdu1) { + iht(objects::TMP1075_HANDLER_PLPCDU_1, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); + } iht(objects::TMP1075_HANDLER_IF_BOARD, NML, 0, TCS_TABLE_NORMAL_TRANS_0.second); check(ss.addTable(TableEntry(TCS_TABLE_NORMAL_TRANS_0.first, &TCS_TABLE_NORMAL_TRANS_0.second)), ctxc); diff --git a/mission/system/tcs/tcsModeTree.h b/mission/system/tcs/tcsModeTree.h index e5973641..4370ae73 100644 --- a/mission/system/tcs/tcsModeTree.h +++ b/mission/system/tcs/tcsModeTree.h @@ -7,7 +7,7 @@ namespace satsystem { namespace tcs { extern TcsSubsystem SUBSYSTEM; -Subsystem& init(); +Subsystem& init(bool commandPlPcdu1); } // namespace tcs } // namespace satsystem diff --git a/mission/tcs/Tmp1075Handler.cpp b/mission/tcs/Tmp1075Handler.cpp index 575a5fdf..7e8569b6 100644 --- a/mission/tcs/Tmp1075Handler.cpp +++ b/mission/tcs/Tmp1075Handler.cpp @@ -133,12 +133,14 @@ ReturnValue_t Tmp1075Handler::initializeLocalDataPool(localpool::DataPool &local return returnvalue::OK; } -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; + // Required because we do not have an assembly. + if (health == FAULTY or health == PERMANENT_FAULTY) { + setMode(_MODE_SHUT_DOWN); + } + return DeviceHandlerBase::setHealth(health); } diff --git a/mission/tcs/Tmp1075Handler.h b/mission/tcs/Tmp1075Handler.h index 02fd6823..4badca39 100644 --- a/mission/tcs/Tmp1075Handler.h +++ b/mission/tcs/Tmp1075Handler.h @@ -20,8 +20,6 @@ class Tmp1075Handler : public DeviceHandlerBase { Tmp1075Handler(object_id_t objectId, object_id_t comIF, CookieIF *comCookie); virtual ~Tmp1075Handler(); - void setModeNormal(); - protected: void doStartUp() override; void doShutDown() override; diff --git a/tmtc b/tmtc index c48f04ee..6d5bde40 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit c48f04eed5152f319b217870292968fb67b763d4 +Subproject commit 6d5bde40db69534a8cea923f96145bdeb62b79af