From 432b400835324357ba8409e81d02800f5e024c6f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Apr 2023 10:28:01 +0200 Subject: [PATCH 01/25] bump tmtc --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index 0c6a9677..5fbd19bb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 0c6a9677e1b9b86456efff2e11ba31f99e15ac2a +Subproject commit 5fbd19bb6cca0790373a809d78f2307adca9d0c8 From 097be17a2900e64021fcbb457c89d6d4756ab697 Mon Sep 17 00:00:00 2001 From: meggert Date: Wed, 19 Apr 2023 15:07:21 +0200 Subject: [PATCH 02/25] added remaining acs modes as system modes --- mission/sysDefs.h | 11 +- mission/system/EiveSystem.cpp | 12 +- mission/system/systemTree.cpp | 254 ++++++++++++++++++++++++++++++---- 3 files changed, 247 insertions(+), 30 deletions(-) diff --git a/mission/sysDefs.h b/mission/sysDefs.h index e8303524..a74cf369 100644 --- a/mission/sysDefs.h +++ b/mission/sysDefs.h @@ -9,8 +9,15 @@ extern std::atomic_uint16_t I2C_FATAL_ERRORS; namespace satsystem { -enum Mode : Mode_t { BOOT = 5, SAFE = acs::AcsMode::SAFE, PTG_IDLE = acs::AcsMode::PTG_IDLE }; - +enum Mode : Mode_t { + BOOT = 5, + SAFE = acs::AcsMode::SAFE, + PTG_IDLE = acs::AcsMode::PTG_IDLE, + PTG_NADIR = acs::AcsMode::PTG_NADIR, + PTG_TARGET = acs::AcsMode::PTG_TARGET, + PTG_TARGET_GS = acs::AcsMode::PTG_TARGET_GS, + PTG_INERTIAL = acs::AcsMode::PTG_INERTIAL, +}; } namespace xsc { diff --git a/mission/system/EiveSystem.cpp b/mission/system/EiveSystem.cpp index 53bf7a32..f17b82cb 100644 --- a/mission/system/EiveSystem.cpp +++ b/mission/system/EiveSystem.cpp @@ -39,18 +39,22 @@ void EiveSystem::announceMode(bool recursive) { modeStr = "POINTING IDLE"; break; } - case (acs::AcsMode::PTG_INERTIAL): { - modeStr = "POINTING INERTIAL"; + case (satsystem::Mode::PTG_NADIR): { + modeStr = "POINTING NADIR"; break; } - case (acs::AcsMode::PTG_TARGET): { + case (satsystem::Mode::PTG_TARGET): { modeStr = "POINTING TARGET"; break; } - case (acs::AcsMode::PTG_TARGET_GS): { + case (satsystem::Mode::PTG_TARGET_GS): { modeStr = "POINTING TARGET GS"; break; } + case (satsystem::Mode::PTG_INERTIAL): { + modeStr = "POINTING INERTIAL"; + break; + } } sif::info << "EIVE system is now in " << modeStr << " mode" << std::endl; return Subsystem::announceMode(recursive); diff --git a/mission/system/systemTree.cpp b/mission/system/systemTree.cpp index 37adbaf5..1b5b6c4b 100644 --- a/mission/system/systemTree.cpp +++ b/mission/system/systemTree.cpp @@ -22,6 +22,10 @@ const auto check = subsystem::checkInsert; void buildBootSequence(Subsystem& ss, ModeListEntry& eh); void buildSafeSequence(Subsystem& ss, ModeListEntry& eh); void buildIdleSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh); +void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh); } // namespace static const auto OFF = HasModesIF::MODE_OFF; @@ -40,6 +44,10 @@ void satsystem::init() { buildBootSequence(EIVE_SYSTEM, entry); buildSafeSequence(EIVE_SYSTEM, entry); buildIdleSequence(EIVE_SYSTEM, entry); + buildPtgNadirSequence(EIVE_SYSTEM, entry); + buildPtgTargetSequence(EIVE_SYSTEM, entry); + buildPtgTargetGsSequence(EIVE_SYSTEM, entry); + buildPtgInertialSequence(EIVE_SYSTEM, entry); EIVE_SYSTEM.setInitialMode(satsystem::Mode::BOOT, 0); } @@ -68,8 +76,89 @@ auto EIVE_TABLE_IDLE_TRANS_0 = auto EIVE_TABLE_IDLE_TRANS_1 = std::make_pair((satsystem::Mode::PTG_IDLE << 24) | 3, FixedArrayList()); +auto EIVE_SEQUENCE_PTG_NADIR = + std::make_pair(satsystem::Mode::PTG_NADIR, FixedArrayList()); +auto EIVE_TABLE_PTG_NADIR_TGT = + std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_NADIR_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_NADIR_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_NADIR << 24) | 3, FixedArrayList()); + +auto EIVE_SEQUENCE_PTG_TARGET = + std::make_pair(satsystem::Mode::PTG_TARGET, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_TGT = + std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_TARGET << 24) | 3, FixedArrayList()); + +auto EIVE_SEQUENCE_PTG_TARGET_GS = + std::make_pair(satsystem::Mode::PTG_TARGET_GS, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_GS_TGT = + std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_GS_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_TARGET_GS_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_TARGET_GS << 24) | 3, FixedArrayList()); + +auto EIVE_SEQUENCE_PTG_INERTIAL = + std::make_pair(satsystem::Mode::PTG_INERTIAL, FixedArrayList()); +auto EIVE_TABLE_PTG_INERTIAL_TGT = + std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 1, FixedArrayList()); +auto EIVE_TABLE_PTG_INERTIAL_TRANS_0 = + std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 2, FixedArrayList()); +auto EIVE_TABLE_PTG_INERTIAL_TRANS_1 = + std::make_pair((satsystem::Mode::PTG_INERTIAL << 24) | 3, FixedArrayList()); + namespace { +void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildBootSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table, + bool allowAllSubmodes = false) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + if (allowAllSubmodes) { + eh.allowAllSubmodes(); + } + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TGT.second, true); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); + iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TGT.second); + iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); + check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TGT.first, &EIVE_TABLE_BOOT_TGT.second)), ctxc); + + // Build SAFE transition 0. + iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); + iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second, true); + check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TRANS_0.first, &EIVE_TABLE_BOOT_TRANS_0.second)), + ctxc); + + // Build Safe sequence + ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_BOOT.first, &EIVE_SEQUENCE_BOOT.second, + EIVE_SEQUENCE_SAFE.first)), + ctxc); +} + void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { std::string context = "satsystem::buildSafeSequence"; auto ctxc = context.c_str(); @@ -150,18 +239,14 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { ctxc); } -void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { - std::string context = "satsystem::buildBootSequence"; +void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgNadirSequence"; auto ctxc = context.c_str(); // Insert Helper Table - auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table, - bool allowAllSubmodes = false) { + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { eh.setObject(obj); eh.setMode(mode); eh.setSubmode(submode); - if (allowAllSubmodes) { - eh.allowAllSubmodes(); - } check(table.insert(eh), ctxc); }; // Insert Helper Sequence @@ -173,25 +258,146 @@ void buildBootSequence(Subsystem& ss, ModeListEntry& eh) { check(sequence.insert(eh), ctxc); }; - iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TGT.second, true); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); - iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TGT.second); - iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TGT.second); - check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TGT.first, &EIVE_TABLE_BOOT_TGT.second)), ctxc); - - // Build SAFE transition 0. - iht(objects::TCS_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); - iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_BOOT_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second); - iht(objects::ACS_SUBSYSTEM, acs::AcsMode::OFF, 0, EIVE_TABLE_BOOT_TRANS_0.second, true); - check(ss.addTable(TableEntry(EIVE_TABLE_BOOT_TRANS_0.first, &EIVE_TABLE_BOOT_TRANS_0.second)), + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TGT.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_NADIR_TGT.first, &EIVE_TABLE_PTG_NADIR_TGT.second)), ctxc); - // Build Safe sequence - ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TGT.first, 0, false); - ihs(EIVE_SEQUENCE_BOOT.second, EIVE_TABLE_BOOT_TRANS_0.first, 0, false); - check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_BOOT.first, &EIVE_SEQUENCE_BOOT.second, - EIVE_SEQUENCE_SAFE.first)), + // Build PTG_NADIR transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_NADIR_TRANS_0.first, &EIVE_TABLE_PTG_NADIR_TRANS_0.second)), + ctxc); + + // Build PTG_NADIR sequence + ihs(EIVE_SEQUENCE_PTG_NADIR.second, EIVE_TABLE_PTG_NADIR_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_NADIR.second, EIVE_TABLE_PTG_NADIR_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_NADIR.first, &EIVE_SEQUENCE_PTG_NADIR.second, + EIVE_SEQUENCE_IDLE.first)), ctxc); } + +void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgTargetSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TGT.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_TGT.first, &EIVE_TABLE_PTG_TARGET_TGT.second)), + ctxc); + + // Build PTG_TARGET transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_TARGET_TRANS_0.first, &EIVE_TABLE_PTG_TARGET_TRANS_0.second)), + ctxc); + + // Build PTG_TARGET sequence + ihs(EIVE_SEQUENCE_PTG_TARGET.second, EIVE_TABLE_PTG_TARGET_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_TARGET.second, EIVE_TABLE_PTG_TARGET_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_TARGET.first, + &EIVE_SEQUENCE_PTG_TARGET.second, EIVE_SEQUENCE_IDLE.first)), + ctxc); +} + +void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgTargetGsSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, EIVE_TABLE_PTG_TARGET_GS_TGT.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_TARGET_GS_TGT.first, &EIVE_TABLE_PTG_TARGET_GS_TGT.second)), + ctxc); + + // Build PTG_TARGET_GS transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, + EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, + &EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second)), + ctxc); + + // Build PTG_TARGET_GS sequence + ihs(EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_TABLE_PTG_TARGET_GS_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, 0, false); + check( + ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_TARGET_GS.first, + &EIVE_SEQUENCE_PTG_TARGET_GS.second, EIVE_SEQUENCE_IDLE.first)), + ctxc); +} + +void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh) { + std::string context = "satsystem::buildPtgInertialSequence"; + auto ctxc = context.c_str(); + // Insert Helper Table + auto iht = [&](object_id_t obj, Mode_t mode, Submode_t submode, ArrayList& table) { + eh.setObject(obj); + eh.setMode(mode); + eh.setSubmode(submode); + check(table.insert(eh), ctxc); + }; + // Insert Helper Sequence + auto ihs = [&](ArrayList& sequence, Mode_t tableId, uint32_t waitSeconds, + bool checkSuccess) { + eh.setTableId(tableId); + eh.setWaitSeconds(waitSeconds); + eh.setCheckSuccess(checkSuccess); + check(sequence.insert(eh), ctxc); + }; + + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, EIVE_TABLE_PTG_INERTIAL_TGT.second); + check(ss.addTable( + TableEntry(EIVE_TABLE_PTG_INERTIAL_TGT.first, &EIVE_TABLE_PTG_INERTIAL_TGT.second)), + ctxc); + + // Build PTG_INERTIAL transition 0 + iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); + iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); + iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, + EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); + check(ss.addTable(TableEntry(EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, + &EIVE_TABLE_PTG_INERTIAL_TRANS_0.second)), + ctxc); + + // Build PTG_INERTIAL sequence + ihs(EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_TABLE_PTG_INERTIAL_TGT.first, 0, false); + ihs(EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, 0, false); + check(ss.addSequence(SequenceEntry(EIVE_SEQUENCE_PTG_INERTIAL.first, + &EIVE_SEQUENCE_PTG_INERTIAL.second, EIVE_SEQUENCE_IDLE.first)), + ctxc); +} + } // namespace From befa84a74b7a3d7b3363492bda0c3cf0d689a376 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 19 Apr 2023 18:09:57 +0200 Subject: [PATCH 03/25] the hottest fix --- mission/acs/GyrAdis1650XHandler.cpp | 1 + mission/acs/GyrL3gCustomHandler.cpp | 1 + mission/acs/MgmLis3CustomHandler.cpp | 1 + mission/acs/MgmRm3100CustomHandler.cpp | 1 + mission/acs/SusHandler.cpp | 1 + 5 files changed, 5 insertions(+) diff --git a/mission/acs/GyrAdis1650XHandler.cpp b/mission/acs/GyrAdis1650XHandler.cpp index b9e0b049..c61187ce 100644 --- a/mission/acs/GyrAdis1650XHandler.cpp +++ b/mission/acs/GyrAdis1650XHandler.cpp @@ -37,6 +37,7 @@ void GyrAdis1650XHandler::doStartUp() { void GyrAdis1650XHandler::doShutDown() { if (internalState != InternalState::SHUTDOWN) { commandExecuted = false; + PoolReadGuard pg(&primaryDataset); primaryDataset.setValidity(false, true); internalState = InternalState::SHUTDOWN; } diff --git a/mission/acs/GyrL3gCustomHandler.cpp b/mission/acs/GyrL3gCustomHandler.cpp index 934fba99..ebc6ba42 100644 --- a/mission/acs/GyrL3gCustomHandler.cpp +++ b/mission/acs/GyrL3gCustomHandler.cpp @@ -33,6 +33,7 @@ void GyrL3gCustomHandler::doStartUp() { void GyrL3gCustomHandler::doShutDown() { if (internalState != InternalState::SHUTDOWN) { internalState = InternalState::SHUTDOWN; + PoolReadGuard pg(&dataset); dataset.setValidity(false, true); commandExecuted = false; } diff --git a/mission/acs/MgmLis3CustomHandler.cpp b/mission/acs/MgmLis3CustomHandler.cpp index d1dd5eff..4b2e992d 100644 --- a/mission/acs/MgmLis3CustomHandler.cpp +++ b/mission/acs/MgmLis3CustomHandler.cpp @@ -29,6 +29,7 @@ void MgmLis3CustomHandler::doStartUp() { void MgmLis3CustomHandler::doShutDown() { if (internalState != InternalState::SHUTDOWN) { + PoolReadGuard pg(&dataset); dataset.setValidity(false, true); internalState = InternalState::SHUTDOWN; commandExecuted = false; diff --git a/mission/acs/MgmRm3100CustomHandler.cpp b/mission/acs/MgmRm3100CustomHandler.cpp index e57effda..24c94938 100644 --- a/mission/acs/MgmRm3100CustomHandler.cpp +++ b/mission/acs/MgmRm3100CustomHandler.cpp @@ -33,6 +33,7 @@ void MgmRm3100CustomHandler::doStartUp() { void MgmRm3100CustomHandler::doShutDown() { if (internalState != InternalState::SHUTDOWN) { commandExecuted = false; + PoolReadGuard pg(&primaryDataset); primaryDataset.setValidity(false, true); internalState = InternalState::SHUTDOWN; } diff --git a/mission/acs/SusHandler.cpp b/mission/acs/SusHandler.cpp index 0032a11d..c347020f 100644 --- a/mission/acs/SusHandler.cpp +++ b/mission/acs/SusHandler.cpp @@ -29,6 +29,7 @@ void SusHandler::doStartUp() { void SusHandler::doShutDown() { if (internalState != InternalState::SHUTDOWN) { + PoolReadGuard pg(&dataset); dataset.setValidity(false, true); internalState = InternalState::SHUTDOWN; commandExecuted = false; From f46a705900a67c981a4afefa267a2c7fd38896a1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 19 Apr 2023 18:12:32 +0200 Subject: [PATCH 04/25] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 756b0709..2731eb8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,13 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v2.0.4] 2023-04-19 + +## Fixed + +- The dual lane assembly device handlers did not properly set their datasets + to invalid on off transitions + # [v2.0.3] 2023-04-17 - eive-tmtc: v3.1.1 From 1756b5edcc4293892d2aef7a30d5b58c8c40db33 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 19 Apr 2023 18:14:28 +0200 Subject: [PATCH 05/25] patch revision --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f632d2d..358dd8ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR 2) set(OBSW_VERSION_MINOR 0) -set(OBSW_VERSION_REVISION 3) +set(OBSW_VERSION_REVISION 4) # set(CMAKE_VERBOSE TRUE) From 4040304ef09a172f9d2bef42547d6b1effb8ca76 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 13:15:42 +0200 Subject: [PATCH 06/25] this is annoying --- bsp_hosted/ObjectFactory.cpp | 2 +- mission/genericFactory.cpp | 5 +++-- mission/genericFactory.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index 3d618cdb..bdbd577b 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -64,7 +64,7 @@ void ObjectFactory::produce(void* args) { PersistentTmStores persistentStores; auto sdcMan = new DummySdCardManager("/tmp"); ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore, - &tmStore, persistentStores); + &tmStore, persistentStores, 120); auto* dummyGpioIF = new DummyGpioIF(); auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0); diff --git a/mission/genericFactory.cpp b/mission/genericFactory.cpp index 06f1220e..2dd00ee6 100644 --- a/mission/genericFactory.cpp +++ b/mission/genericFactory.cpp @@ -96,9 +96,10 @@ std::atomic_bool tcs::TCS_BOARD_SHORTLY_UNAVAILABLE = false; void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFunnel** pusFunnel, CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan, StorageManagerIF** ipcStore, StorageManagerIF** tmStore, - PersistentTmStores& stores) { + PersistentTmStores& stores, + uint32_t eventManagerQueueDepth) { // Framework objects - new EventManager(objects::EVENT_MANAGER, 160); + new EventManager(objects::EVENT_MANAGER, eventManagerQueueDepth); auto healthTable = new HealthTable(objects::HEALTH_TABLE); if (healthTable_ != nullptr) { *healthTable_ = healthTable; diff --git a/mission/genericFactory.h b/mission/genericFactory.h index 6cd2068d..a3a52704 100644 --- a/mission/genericFactory.h +++ b/mission/genericFactory.h @@ -45,7 +45,7 @@ namespace ObjectFactory { void produceGenericObjects(HealthTableIF** healthTable, PusTmFunnel** pusFunnel, CfdpTmFunnel** cfdpFunnel, SdCardMountedIF& sdcMan, StorageManagerIF** ipcStore, StorageManagerIF** tmStore, - PersistentTmStores& stores); + PersistentTmStores& stores, uint32_t eventManagerQueueDepth); void createGenericHeaterComponents(GpioIF& gpioIF, PowerSwitchIF& pwrSwitcher, HeaterHandler*& heaterHandler); From 13142686823bedee1a79ae5f851f124968822a54 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 16:23:50 +0200 Subject: [PATCH 07/25] host build requires dedicated live TM task.. --- bsp_hosted/scheduling.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bsp_hosted/scheduling.cpp b/bsp_hosted/scheduling.cpp index 0a5f1c35..5b9177f3 100644 --- a/bsp_hosted/scheduling.cpp +++ b/bsp_hosted/scheduling.cpp @@ -59,19 +59,15 @@ void scheduling::initTasks() { "DIST", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc); ReturnValue_t result = tmtcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR); if (result != returnvalue::OK) { - sif::error << "adding CCSDS distributor failed" << std::endl; + sif::error << "Adding CCSDS distributor failed" << std::endl; } result = tmtcDistributor->addComponent(objects::PUS_PACKET_DISTRIBUTOR); if (result != returnvalue::OK) { - sif::error << "adding PUS distributor failed" << std::endl; - } - result = tmtcDistributor->addComponent(objects::TM_FUNNEL); - if (result != returnvalue::OK) { - sif::error << "adding TM funnel failed" << std::endl; + sif::error << "Adding PUS distributor failed" << std::endl; } result = tmtcDistributor->addComponent(objects::CFDP_DISTRIBUTOR); if (result != returnvalue::OK) { - sif::error << "adding CFDP distributor failed" << std::endl; + sif::error << "Adding CFDP distributor failed" << std::endl; } result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER); if (result != returnvalue::OK) { @@ -94,6 +90,13 @@ void scheduling::initTasks() { if (result != returnvalue::OK) { sif::error << "Add component UDP Polling failed" << std::endl; } + // All the TM store tasks run in permanent loops, frequency does not matter + PeriodicTaskIF* liveTmTask = factory->createPeriodicTask( + "LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr, &RR_SCHEDULING); + result = liveTmTask->addComponent(objects::LIVE_TM_TASK); + if (result != returnvalue::OK) { + scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK); + } PeriodicTaskIF* pusHighPrio = factory->createPeriodicTask( "PUS_HIGH_PRIO", 60, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.200, missedDeadlineFunc); @@ -149,7 +152,7 @@ void scheduling::initTasks() { "THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); result = thermalTask->addComponent(objects::CORE_CONTROLLER); if (result != returnvalue::OK) { - scheduling::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER); + scheduling::printAddObjectError("CORE_CTRL", objects::CORE_CONTROLLER); } result = thermalTask->addComponent(objects::THERMAL_CONTROLLER); if (result != returnvalue::OK) { @@ -217,6 +220,7 @@ void scheduling::initTasks() { tmtcDistributor->startTask(); udpPollingTask->startTask(); tcpPollingTask->startTask(); + liveTmTask->startTask(); pusHighPrio->startTask(); pusMedPrio->startTask(); From 641b8e847d2b63ad11f28c4a37434a6161443690 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 16:41:40 +0200 Subject: [PATCH 08/25] add back tm funnel handler for hosted build --- bsp_hosted/ObjectFactory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/bsp_hosted/ObjectFactory.cpp b/bsp_hosted/ObjectFactory.cpp index bdbd577b..d792b57b 100644 --- a/bsp_hosted/ObjectFactory.cpp +++ b/bsp_hosted/ObjectFactory.cpp @@ -66,6 +66,7 @@ void ObjectFactory::produce(void* args) { ObjectFactory::produceGenericObjects(nullptr, &pusFunnel, &cfdpFunnel, *sdcMan, &ipcStore, &tmStore, persistentStores, 120); + new TmFunnelHandler(objects::LIVE_TM_TASK, *pusFunnel, *cfdpFunnel); auto* dummyGpioIF = new DummyGpioIF(); auto* dummySwitcher = new DummyPowerSwitcher(objects::PCDU_HANDLER, 18, 0); std::vector switcherList; From 7d630ebcf3894a9a9896d1c3f05548d5ef230333 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:00:04 +0200 Subject: [PATCH 09/25] EM adaptions --- bsp_q7s/em/emObjectFactory.cpp | 3 +++ dummies/helperFactory.cpp | 4 +++- dummies/helperFactory.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 05a3fee0..96f541da 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -57,6 +57,9 @@ void ObjectFactory::produce(void* args) { #if OBSW_ADD_GOMSPACE_PCDU == 1 dummyCfg.addPowerDummies = false; #endif +#if OBSW_ADD_BPX_BATTERY_HANDLER == 1 + dummyCfg.addBpxBattDummy = false; +#endif #if OBSW_ADD_ACS_BOARD == 1 dummyCfg.addAcsBoardDummies = false; #endif diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 98d2ecfa..ff18370a 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -45,7 +45,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpioIF) { new ComIFDummy(objects::DUMMY_COM_IF); auto* comCookieDummy = new ComCookieDummy(); - new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + if (cfg.addBpxBattDummy) { + new BpxDummy(objects::BPX_BATT_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + } if (cfg.addCoreCtrlCfg) { new CoreControllerDummy(objects::CORE_CONTROLLER); } diff --git a/dummies/helperFactory.h b/dummies/helperFactory.h index 2181c79c..dc272650 100644 --- a/dummies/helperFactory.h +++ b/dummies/helperFactory.h @@ -9,6 +9,7 @@ namespace dummy { struct DummyCfg { bool addCoreCtrlCfg = true; bool addPowerDummies = true; + bool addBpxBattDummy = true; bool addSyrlinksDummies = true; bool addAcsBoardDummies = true; bool addSusDummies = true; From 83f07a6e16cbbf5fc4a9ccb2e7d92c3fdffb172b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:26:32 +0200 Subject: [PATCH 10/25] configurable event manager queue depth --- bsp_q7s/em/emObjectFactory.cpp | 3 ++- bsp_q7s/fmObjectFactory.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 96f541da..0859b520 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -36,7 +36,8 @@ void ObjectFactory::produce(void* args) { PersistentTmStores stores; ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, - *SdCardManager::instance(), &ipcStore, &tmStore, stores); + *SdCardManager::instance(), &ipcStore, &tmStore, stores, + 200); LinuxLibgpioIF* gpioComIF = nullptr; SerialComIF* uartComIF = nullptr; diff --git a/bsp_q7s/fmObjectFactory.cpp b/bsp_q7s/fmObjectFactory.cpp index 5cb7c751..927c807e 100644 --- a/bsp_q7s/fmObjectFactory.cpp +++ b/bsp_q7s/fmObjectFactory.cpp @@ -32,7 +32,8 @@ void ObjectFactory::produce(void* args) { PersistentTmStores stores; ObjectFactory::produceGenericObjects(&healthTable, &pusFunnel, &cfdpFunnel, - *SdCardManager::instance(), &ipcStore, &tmStore, stores); + *SdCardManager::instance(), &ipcStore, &tmStore, stores, + 200); LinuxLibgpioIF* gpioComIF = nullptr; SerialComIF* uartComIF = nullptr; From a296f16e5ce9d803ce5db54d9602e396dad7ebce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:36:38 +0200 Subject: [PATCH 11/25] host SW works properly again --- dummies/helperFactory.cpp | 8 ++++---- mission/scheduling.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index ff18370a..e517426a 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -197,10 +197,10 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio objects::TMP1075_HANDLER_PLPCDU_0, new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_0, objects::DUMMY_COM_IF, comCookieDummy)); // damaged. - // tmpSensorDummies.emplace( - // objects::TMP1075_HANDLER_PLPCDU_1, - // new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, - // comCookieDummy)); + // tmpSensorDummies.emplace( + // objects::TMP1075_HANDLER_PLPCDU_1, + // new Tmp1075Dummy(objects::TMP1075_HANDLER_PLPCDU_1, objects::DUMMY_COM_IF, + // comCookieDummy)); tmpSensorDummies.emplace( objects::TMP1075_HANDLER_IF_BOARD, new Tmp1075Dummy(objects::TMP1075_HANDLER_IF_BOARD, objects::DUMMY_COM_IF, comCookieDummy)); diff --git a/mission/scheduling.cpp b/mission/scheduling.cpp index f89ce711..27a6417c 100644 --- a/mission/scheduling.cpp +++ b/mission/scheduling.cpp @@ -5,10 +5,12 @@ #include "fsfw/tasks/PeriodicTaskIF.h" void scheduling::scheduleTmpTempSensors(PeriodicTaskIF* tmpTask) { - const std::array tmpIds = { - objects::TMP1075_HANDLER_TCS_0, objects::TMP1075_HANDLER_TCS_1, - objects::TMP1075_HANDLER_PLPCDU_0, objects::TMP1075_HANDLER_PLPCDU_1, - objects::TMP1075_HANDLER_IF_BOARD}; + const std::array tmpIds = {objects::TMP1075_HANDLER_TCS_0, + objects::TMP1075_HANDLER_TCS_1, + objects::TMP1075_HANDLER_PLPCDU_0, + // damaged. + // objects::TMP1075_HANDLER_PLPCDU_1, + objects::TMP1075_HANDLER_IF_BOARD}; for (const auto& tmpId : tmpIds) { tmpTask->addComponent(tmpId, DeviceHandlerIF::PERFORM_OPERATION); tmpTask->addComponent(tmpId, DeviceHandlerIF::SEND_WRITE); From 03762f962020b55188d445ee3dd429b6e1a32135 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 Apr 2023 17:38:06 +0200 Subject: [PATCH 12/25] lower live TM handler frequency --- bsp_hosted/scheduling.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bsp_hosted/scheduling.cpp b/bsp_hosted/scheduling.cpp index 5b9177f3..5fd53906 100644 --- a/bsp_hosted/scheduling.cpp +++ b/bsp_hosted/scheduling.cpp @@ -90,9 +90,9 @@ void scheduling::initTasks() { if (result != returnvalue::OK) { sif::error << "Add component UDP Polling failed" << std::endl; } - // All the TM store tasks run in permanent loops, frequency does not matter + PeriodicTaskIF* liveTmTask = factory->createPeriodicTask( - "LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, nullptr, &RR_SCHEDULING); + "LIVE_TM", 55, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.4, nullptr, &RR_SCHEDULING); result = liveTmTask->addComponent(objects::LIVE_TM_TASK); if (result != returnvalue::OK) { scheduling::printAddObjectError("LIVE_TM", objects::LIVE_TM_TASK); From 2daca272f8f0397125349c0f6c193e22d0a26383 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 Apr 2023 11:29:18 +0200 Subject: [PATCH 13/25] changelog --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5127ae..6658e0b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,16 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- Event Manager queue depth is configurable now. +- Do not construct and schedule broken TMP1075 device anymore. + +## Fixed + +- Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP + funnel. + # [v2.0.4] 2023-04-19 ## Fixed From 6c326489cbc59f2d70993542f05676472ca0102f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 10:18:46 +0200 Subject: [PATCH 14/25] adapt EM SW: GS PCDU added, but use dummy for ACU --- CMakeLists.txt | 5 ++++- bsp_q7s/OBSWConfig.h.in | 3 +++ bsp_q7s/core/ObjectFactory.cpp | 7 +++++-- bsp_q7s/em/emObjectFactory.cpp | 4 +++- dummies/helperFactory.cpp | 3 ++- dummies/helperFactory.h | 3 +++ 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f632d2d..6f67e669 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,8 +146,11 @@ set(OBSW_ADD_TMP_DEVICES ${INIT_VAL} CACHE STRING "Add TMP devices") set(OBSW_ADD_GOMSPACE_PCDU - ${INIT_VAL} + 1 CACHE STRING "Add GomSpace PCDU modules") +set(OBSW_ADD_GOMSPACE_ACU + ${INIT_VAL} + CACHE STRING "Add GomSpace ACU submodule") set(OBSW_ADD_RW ${INIT_VAL} CACHE STRING "Add RW modules") diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index 3502a7bb..51ed8828 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -22,6 +22,9 @@ #define OBSW_COMMAND_SAFE_MODE_AT_STARTUP 1 #define OBSW_ADD_GOMSPACE_PCDU @OBSW_ADD_GOMSPACE_PCDU@ +// This define is necessary because the EM setup has the P60 dock module, but no ACU on the P60 +// module because it broke. +#define OBSW_ADD_GOMSPACE_ACU @OBSW_ADD_GOMSPACE_ACU@ #define OBSW_ADD_MGT @OBSW_ADD_MGT@ #define OBSW_ADD_BPX_BATTERY_HANDLER @OBSW_ADD_BPX_BATTERY_HANDLER@ #define OBSW_ADD_STAR_TRACKER @OBSW_ADD_STAR_TRACKER@ diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 964d728b..dd363e3d 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -189,7 +189,6 @@ void ObjectFactory::createCommunicationInterfaces(LinuxLibgpioIF** gpioComIF, *i2cComIF = new I2cComIF(objects::I2C_COM_IF); *uartComIF = new SerialComIF(objects::UART_COM_IF); *spiMainComIF = new SpiComIF(objects::SPI_MAIN_COM_IF, q7s::SPI_DEFAULT_DEV, **gpioComIF); - //*spiRWComIF = new SpiComIF(objects::SPI_RW_COM_IF, q7s::SPI_RW_DEV, **gpioComIF); } void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchIF** pwrSwitcher, @@ -197,7 +196,6 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI CspCookie* p60DockCspCookie = new CspCookie(P60Dock::MAX_REPLY_SIZE, addresses::P60DOCK, 500); CspCookie* pdu1CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU1, 500); CspCookie* pdu2CspCookie = new CspCookie(PDU::MAX_REPLY_SIZE, addresses::PDU2, 500); - CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500); auto p60Fdir = new GomspacePowerFdir(objects::P60DOCK_HANDLER); P60DockHandler* p60dockhandler = new P60DockHandler(objects::P60DOCK_HANDLER, objects::CSP_COM_IF, @@ -211,9 +209,12 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI Pdu2Handler* pdu2handler = new Pdu2Handler(objects::PDU2_HANDLER, objects::CSP_COM_IF, pdu2CspCookie, pdu2Fdir, enableHkSets); +#if OBSW_ADD_GOMSPACE_ACU == 1 + CspCookie* acuCspCookie = new CspCookie(ACU::MAX_REPLY_SIZE, addresses::ACU, 500); auto acuFdir = new GomspacePowerFdir(objects::ACU_HANDLER); ACUHandler* acuhandler = new ACUHandler(objects::ACU_HANDLER, objects::CSP_COM_IF, acuCspCookie, acuFdir, enableHkSets); +#endif auto pcduHandler = new PcduHandler(objects::PCDU_HANDLER, 50); /** @@ -223,7 +224,9 @@ void ObjectFactory::createPcduComponents(LinuxLibgpioIF* gpioComIF, PowerSwitchI p60dockhandler->setModeNormal(); pdu1handler->setModeNormal(); pdu2handler->setModeNormal(); +#if OBSW_ADD_GOMSPACE_ACU == 1 acuhandler->setModeNormal(); +#endif if (pwrSwitcher != nullptr) { *pwrSwitcher = pcduHandler; } diff --git a/bsp_q7s/em/emObjectFactory.cpp b/bsp_q7s/em/emObjectFactory.cpp index 05a3fee0..c0211478 100644 --- a/bsp_q7s/em/emObjectFactory.cpp +++ b/bsp_q7s/em/emObjectFactory.cpp @@ -56,6 +56,8 @@ void ObjectFactory::produce(void* args) { #endif #if OBSW_ADD_GOMSPACE_PCDU == 1 dummyCfg.addPowerDummies = false; + // The ACU broke. + dummyCfg.addOnlyAcuDummy = true; #endif #if OBSW_ADD_ACS_BOARD == 1 dummyCfg.addAcsBoardDummies = false; @@ -89,7 +91,7 @@ void ObjectFactory::produce(void* args) { // createRadSensorComponent(gpioComIF); #if OBSW_ADD_ACS_BOARD == 1 - createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher); + createAcsBoardComponents(*spiMainComIF, gpioComIF, uartComIF, *pwrSwitcher, true); #else // Still add all GPIOs for EM. GpioCookie* acsBoardGpios = new GpioCookie(); diff --git a/dummies/helperFactory.cpp b/dummies/helperFactory.cpp index 98d2ecfa..bda847d7 100644 --- a/dummies/helperFactory.cpp +++ b/dummies/helperFactory.cpp @@ -75,8 +75,9 @@ void dummy::createDummies(DummyCfg cfg, PowerSwitchIF& pwrSwitcher, GpioIF* gpio auto* imtqDummy = new ImtqDummy(objects::IMTQ_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); imtqDummy->enableThermalModule(ThermalStateCfg()); imtqDummy->connectModeTreeParent(*imtqAssy); - if (cfg.addPowerDummies) { + if (cfg.addOnlyAcuDummy) { new AcuDummy(objects::ACU_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); + } else if (cfg.addPowerDummies) { new PduDummy(objects::PDU1_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new PduDummy(objects::PDU2_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); new P60DockDummy(objects::P60DOCK_HANDLER, objects::DUMMY_COM_IF, comCookieDummy); diff --git a/dummies/helperFactory.h b/dummies/helperFactory.h index 2181c79c..e4953a32 100644 --- a/dummies/helperFactory.h +++ b/dummies/helperFactory.h @@ -6,8 +6,11 @@ class GpioIF; namespace dummy { +// Default values targeted towards EM. struct DummyCfg { bool addCoreCtrlCfg = true; + // Special variant because the ACU broke. Overrides addPowerDummies, only ACU dummy will be added. + bool addOnlyAcuDummy = false; bool addPowerDummies = true; bool addSyrlinksDummies = true; bool addAcsBoardDummies = true; From a12794281bfc2ebb27a02bbc151696023e69a9f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 10:20:31 +0200 Subject: [PATCH 15/25] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c5127ae..5de8f514 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +- Adapt EM configuration to include all GomSpace PCDU devices except the ACU. For the ACU + (which broke), a dummy will still be used. + # [v2.0.4] 2023-04-19 ## Fixed From 74d5d70973b46c70d1483077e71e2820d3ca4ad6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 13:58:08 +0200 Subject: [PATCH 16/25] this bugfix might be super important --- mission/system/acs/DualLaneAssemblyBase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index 7d22fbd1..dd9cef3c 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -183,11 +183,11 @@ void DualLaneAssemblyBase::handleModeTransitionFailed(ReturnValue_t result) { // transition to dual mode. if (not tryingOtherSide) { triggerEvent(CANT_KEEP_MODE, mode, submode); - startTransition(mode, nextSubmode); + startTransition(targetMode, nextSubmode); tryingOtherSide = true; } else { - triggerEvent(transitionOtherSideFailedEvent, mode, targetSubmode); - startTransition(mode, Submodes::DUAL_MODE); + triggerEvent(transitionOtherSideFailedEvent, targetMode, targetSubmode); + startTransition(targetMode, Submodes::DUAL_MODE); } } From 02ea8a7298ff14c8acab55b2f693e8593c277624 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:22:21 +0200 Subject: [PATCH 17/25] changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6658e0b5..6bc511cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,11 @@ will consitute of a breaking change warranting a new major release: - Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP funnel. +- The dual lane assembly transition failed handler started new transitions towards the current mode + instead of the target mode. This means that if the dual lane assembly never reached the initial + submode (e.g. mode normal and submode dual side), it will transition back to the current mode, + which is `MODE_OFF`. Furthermore, this lead to invalid internal states, so the subsequent + recovery handling becomes stuck in the custom recovery sequence when swichting power back on. # [v2.0.4] 2023-04-19 From c66cef9129586e8708a8f2679ff86b3c9977c5f5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:23:21 +0200 Subject: [PATCH 18/25] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bc511cd..dbd5fbdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,7 +28,7 @@ will consitute of a breaking change warranting a new major release: - The dual lane assembly transition failed handler started new transitions towards the current mode instead of the target mode. This means that if the dual lane assembly never reached the initial submode (e.g. mode normal and submode dual side), it will transition back to the current mode, - which is `MODE_OFF`. Furthermore, this lead to invalid internal states, so the subsequent + which miht be `MODE_OFF`. Furthermore, this can lead to invalid internal states, so the subsequent recovery handling becomes stuck in the custom recovery sequence when swichting power back on. # [v2.0.4] 2023-04-19 From 383849c5cb62b1543037ab07c904b2725c91be13 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:25:14 +0200 Subject: [PATCH 19/25] that is more robust --- mission/system/acs/DualLaneAssemblyBase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mission/system/acs/DualLaneAssemblyBase.cpp b/mission/system/acs/DualLaneAssemblyBase.cpp index dd9cef3c..dc97908f 100644 --- a/mission/system/acs/DualLaneAssemblyBase.cpp +++ b/mission/system/acs/DualLaneAssemblyBase.cpp @@ -205,7 +205,8 @@ bool DualLaneAssemblyBase::checkAndHandleRecovery() { opCode = pwrStateMachine.fsm(); if (opCode == OpCodes::TO_OFF_DONE or opCode == OpCodes::TIMEOUT_OCCURED) { customRecoveryStates = RecoveryCustomStates::POWER_SWITCHING_ON; - pwrStateMachine.start(targetMode, targetSubmode); + // Command power back on in any case. + pwrStateMachine.start(HasModesIF::MODE_ON, targetSubmode); } } if (customRecoveryStates == POWER_SWITCHING_ON) { From b10275ca43f13ee68be013c7ece3b63acf762130 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 14:28:05 +0200 Subject: [PATCH 20/25] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dbd5fbdd..a0d085bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ will consitute of a breaking change warranting a new major release: submode (e.g. mode normal and submode dual side), it will transition back to the current mode, which miht be `MODE_OFF`. Furthermore, this can lead to invalid internal states, so the subsequent recovery handling becomes stuck in the custom recovery sequence when swichting power back on. +- The dual lane custom recovery handling was adapted to always perform proper power switch handling + irrespective of current or target modes. # [v2.0.4] 2023-04-19 From 23796345d966787f6f43c1d89b9555413bfe583a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:04:30 +0200 Subject: [PATCH 21/25] changelog and stop payload tracking --- CHANGELOG.md | 1 + mission/system/systemTree.cpp | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6658e0b5..6c170ca0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ will consitute of a breaking change warranting a new major release: - Event Manager queue depth is configurable now. - Do not construct and schedule broken TMP1075 device anymore. +- Do not track payload modes in system mode tables. ## Fixed diff --git a/mission/system/systemTree.cpp b/mission/system/systemTree.cpp index 1b5b6c4b..41bf3216 100644 --- a/mission/system/systemTree.cpp +++ b/mission/system/systemTree.cpp @@ -184,7 +184,6 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { // Do no track submode to allow transitions to DETUMBLE submode. iht(objects::ACS_SUBSYSTEM, acs::AcsMode::SAFE, 0, EIVE_TABLE_SAFE_TGT.second, true); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_SAFE_TGT.second); check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TGT.first, &EIVE_TABLE_SAFE_TGT.second)), ctxc); // Build SAFE transition 0. @@ -226,7 +225,6 @@ void buildIdleSequence(Subsystem& ss, ModeListEntry& eh) { // Build IDLE transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_IDLE_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_IDLE_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_IDLE, 0, EIVE_TABLE_IDLE_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_IDLE_TRANS_0.first, &EIVE_TABLE_IDLE_TRANS_0.second)), ctxc); @@ -264,7 +262,6 @@ void buildPtgNadirSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_NADIR transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_NADIR, 0, EIVE_TABLE_PTG_NADIR_TRANS_0.second); check(ss.addTable( TableEntry(EIVE_TABLE_PTG_NADIR_TRANS_0.first, &EIVE_TABLE_PTG_NADIR_TRANS_0.second)), @@ -303,7 +300,6 @@ void buildPtgTargetSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_TARGET transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET, 0, EIVE_TABLE_PTG_TARGET_TRANS_0.second); check(ss.addTable( TableEntry(EIVE_TABLE_PTG_TARGET_TRANS_0.first, &EIVE_TABLE_PTG_TARGET_TRANS_0.second)), @@ -343,7 +339,6 @@ void buildPtgTargetGsSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_TARGET_GS transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_TARGET_GS, 0, EIVE_TABLE_PTG_TARGET_GS_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_PTG_TARGET_GS_TRANS_0.first, @@ -385,7 +380,6 @@ void buildPtgInertialSequence(Subsystem& ss, ModeListEntry& eh) { // Build PTG_INERTIAL transition 0 iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); - iht(objects::PL_SUBSYSTEM, OFF, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); iht(objects::ACS_SUBSYSTEM, acs::AcsMode::PTG_INERTIAL, 0, EIVE_TABLE_PTG_INERTIAL_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_PTG_INERTIAL_TRANS_0.first, From 37b9615525637294118266910979236127f8a8ce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:18:16 +0200 Subject: [PATCH 22/25] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c170ca0..712facce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,10 @@ will consitute of a breaking change warranting a new major release: - Do not construct and schedule broken TMP1075 device anymore. - Do not track payload modes in system mode tables. +## Added + +- Add the remaining system modes derives from the ACS modes. + ## Fixed - Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP From 7045b6034afdb819f4978f91f697d7f23806ab89 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:18:47 +0200 Subject: [PATCH 23/25] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 712facce..307f5f74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ will consitute of a breaking change warranting a new major release: ## Added -- Add the remaining system modes derives from the ACS modes. +- Add the remaining system modes derived from the ACS modes. ## Fixed From 14baa3563c3dc6499bac49bb83c08ba98bfad171 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:30:09 +0200 Subject: [PATCH 24/25] hello --- CHANGELOG.md | 3 ++- mission/acs/defs.h | 13 +++++++------ mission/sysDefs.h | 21 +++++++++++++-------- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 307f5f74..b4e6659e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,10 +21,11 @@ will consitute of a breaking change warranting a new major release: - Event Manager queue depth is configurable now. - Do not construct and schedule broken TMP1075 device anymore. - Do not track payload modes in system mode tables. +- ACS modes derived from system modes. ## Added -- Add the remaining system modes derived from the ACS modes. +- Add the remaining system modes. ## Fixed diff --git a/mission/acs/defs.h b/mission/acs/defs.h index 7748562d..41d09976 100644 --- a/mission/acs/defs.h +++ b/mission/acs/defs.h @@ -3,6 +3,7 @@ #include #include +#include namespace acs { @@ -11,12 +12,12 @@ enum class SimpleSensorMode { NORMAL = 0, OFF = 1 }; // These modes are the modes of the ACS controller and of the ACS subsystem. enum AcsMode : Mode_t { OFF = HasModesIF::MODE_OFF, - SAFE = 10, - PTG_IDLE = 11, - PTG_NADIR = 12, - PTG_TARGET = 13, - PTG_TARGET_GS = 14, - PTG_INERTIAL = 15, + SAFE = satsystem::Mode::SAFE, + PTG_IDLE = satsystem::Mode::PTG_IDLE, + PTG_NADIR = satsystem::Mode::PTG_NADIR, + PTG_TARGET = satsystem::Mode::PTG_TARGET, + PTG_TARGET_GS = satsystem::Mode::PTG_TARGET_GS, + PTG_INERTIAL = satsystem::Mode::PTG_INERTIAL, }; enum SafeSubmode : Submode_t { DEFAULT = 0, DETUMBLE = 1 }; diff --git a/mission/sysDefs.h b/mission/sysDefs.h index a74cf369..c84c237f 100644 --- a/mission/sysDefs.h +++ b/mission/sysDefs.h @@ -1,9 +1,13 @@ #ifndef MISSION_SYSDEFS_H_ #define MISSION_SYSDEFS_H_ -#include +#include +#include +#include +#include -#include "acs/defs.h" +#include +#include extern std::atomic_uint16_t I2C_FATAL_ERRORS; @@ -11,12 +15,13 @@ namespace satsystem { enum Mode : Mode_t { BOOT = 5, - SAFE = acs::AcsMode::SAFE, - PTG_IDLE = acs::AcsMode::PTG_IDLE, - PTG_NADIR = acs::AcsMode::PTG_NADIR, - PTG_TARGET = acs::AcsMode::PTG_TARGET, - PTG_TARGET_GS = acs::AcsMode::PTG_TARGET_GS, - PTG_INERTIAL = acs::AcsMode::PTG_INERTIAL, + // DO NOT CHANGE THE ORDER starting from here, breaks ACS mode checks. + SAFE = 10, + PTG_IDLE = 11, + PTG_NADIR = 12, + PTG_TARGET = 13, + PTG_TARGET_GS = 14, + PTG_INERTIAL = 15, }; } From a17f57cbb587f960366baae7059309d18619cdc4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 Apr 2023 15:34:45 +0200 Subject: [PATCH 25/25] changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0d085bd..ba80d0fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +# [v2.2.0] to be released + +# [v2.1.0] to be released + ## Changed - Event Manager queue depth is configurable now. @@ -25,6 +29,9 @@ will consitute of a breaking change warranting a new major release: - Host build is working again. Added reduced live TM helper which schedules the PUS and CFDP funnel. + +# [v2.0.5] to be released + - The dual lane assembly transition failed handler started new transitions towards the current mode instead of the target mode. This means that if the dual lane assembly never reached the initial submode (e.g. mode normal and submode dual side), it will transition back to the current mode,