From e5271a9ca5bff379ba2e61b9b88a4be8252ef1de Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 16 Feb 2023 13:40:15 +0100 Subject: [PATCH 01/12] cast of submodes --- mission/system/objects/ComSubsystem.cpp | 8 ++++++-- mission/system/tree/comModeTree.cpp | 24 ++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/mission/system/objects/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp index bbe14af0..8e3f253e 100644 --- a/mission/system/objects/ComSubsystem.cpp +++ b/mission/system/objects/ComSubsystem.cpp @@ -10,7 +10,9 @@ #include extern std::pair> COM_SEQUENCE_RX_ONLY; +//extern std::pair> COM_TABLE_RX_ONLY_TGT; extern std::pair> COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE; +extern std::pair> COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT; extern std::pair> COM_SEQUENCE_RX_AND_TX_LOW_RATE; extern std::pair> COM_SEQUENCE_RX_AND_TX_HIGH_RATE; @@ -26,7 +28,9 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence void ComSubsystem::performChildOperation() { readEventQueue(); - checkTransmitterCountdown(); + if (mode != COM_SEQUENCE_RX_ONLY.first) { + checkTransmitterCountdown(); + } } MessageQueueId_t ComSubsystem::getCommandQueue() const { return Subsystem::getCommandQueue(); } @@ -104,7 +108,7 @@ ReturnValue_t ComSubsystem::initialize() { } void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) { - // Depending on the mode the transmitter timeout is enabled or + // Depending on the submode the transmitter timeout is enabled or // disabled here if (mode == COM_SEQUENCE_RX_ONLY.first) { transmitterCountdown.timeOut(); diff --git a/mission/system/tree/comModeTree.cpp b/mission/system/tree/comModeTree.cpp index 22f51379..7e771892 100644 --- a/mission/system/tree/comModeTree.cpp +++ b/mission/system/tree/comModeTree.cpp @@ -19,38 +19,38 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto COM_SEQUENCE_RX_ONLY = std::make_pair(::com::Submode::RX_ONLY, FixedArrayList()); auto COM_TABLE_RX_ONLY_TGT = - std::make_pair((::com::Submode::RX_ONLY << 24) | 1, FixedArrayList()); + std::make_pair(static_cast(::com::Submode::RX_ONLY << 24) | 1, FixedArrayList()); auto COM_TABLE_RX_ONLY_TRANS_0 = - std::make_pair((::com::Submode::RX_ONLY << 24) | 2, FixedArrayList()); + std::make_pair(static_cast(::com::Submode::RX_ONLY << 24) | 2, FixedArrayList()); auto COM_TABLE_RX_ONLY_TRANS_1 = - std::make_pair((::com::Submode::RX_ONLY << 24) | 3, FixedArrayList()); + std::make_pair(static_cast(::com::Submode::RX_ONLY << 24) | 3, FixedArrayList()); auto COM_SEQUENCE_RX_AND_TX_LOW_RATE = std::make_pair(::com::Submode::RX_AND_TX_LOW_DATARATE, FixedArrayList()); auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT = std::make_pair( - (::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, FixedArrayList()); auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 = std::make_pair( - (::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, FixedArrayList()); auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 = std::make_pair( - (::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, FixedArrayList()); auto COM_SEQUENCE_RX_AND_TX_HIGH_RATE = std::make_pair(::com::Submode::RX_AND_TX_HIGH_DATARATE, FixedArrayList()); auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT = std::make_pair( - (::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, FixedArrayList()); auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 = std::make_pair( - (::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, FixedArrayList()); auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = std::make_pair( - (::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList()); auto COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE = std::make_pair(::com::Submode::RX_AND_TX_DEFAULT_DATARATE, FixedArrayList()); auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT = std::make_pair( - (::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 1, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 1, FixedArrayList()); auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0 = std::make_pair( - (::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 2, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 2, FixedArrayList()); auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1 = std::make_pair( - (::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 3, FixedArrayList()); + static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 3, FixedArrayList()); namespace { From bf65d13849e22dd8745bbc8cf159bfe2be9f92ec Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sat, 18 Feb 2023 11:53:01 +0100 Subject: [PATCH 02/12] pdec handler check locks during init --- linux/ipcore/PdecHandler.cpp | 1 + mission/system/tree/comModeTree.cpp | 2 +- mission/system/tree/system.cpp | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index b6b684e9..b59dc904 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -164,6 +164,7 @@ ReturnValue_t PdecHandler::irqOperation() { state = State::WAIT_FOR_RECOVERY; return result; } + checkLocks(); state = State::RUNNING; break; case State::RUNNING: { diff --git a/mission/system/tree/comModeTree.cpp b/mission/system/tree/comModeTree.cpp index 7e771892..222d1f7d 100644 --- a/mission/system/tree/comModeTree.cpp +++ b/mission/system/tree/comModeTree.cpp @@ -67,7 +67,7 @@ Subsystem& satsystem::com::init() { buildTxAndRxLowRateSequence(SUBSYSTEM, entry); buildTxAndRxHighRateSequence(SUBSYSTEM, entry); buildTxAndRxDefaultRateSequence(SUBSYSTEM, entry); - SUBSYSTEM.setInitialMode(NML, ::com::Submode::RX_ONLY); + SUBSYSTEM.setInitialMode(COM_SEQUENCE_RX_ONLY.first); return SUBSYSTEM; } diff --git a/mission/system/tree/system.cpp b/mission/system/tree/system.cpp index 69345bf3..cb6202f1 100644 --- a/mission/system/tree/system.cpp +++ b/mission/system/tree/system.cpp @@ -3,7 +3,7 @@ #include #include #include - +#include "mission/comDefs.h" #include "acsModeTree.h" #include "comModeTree.h" #include "eive/objects.h" @@ -85,6 +85,7 @@ void buildSafeSequence(Subsystem& ss, ModeListEntry& eh) { // Build SAFE transition 0. Two transitions to reduce number of consecutive events and because // consecutive commanding of TCS and ACS can lead to SPI issues. iht(objects::TCS_SUBSYSTEM, NML, 0, EIVE_TABLE_SAFE_TRANS_0.second); + iht(objects::COM_SUBSYSTEM, com::RX_ONLY, 0, EIVE_TABLE_SAFE_TRANS_0.second); check(ss.addTable(TableEntry(EIVE_TABLE_SAFE_TRANS_0.first, &EIVE_TABLE_SAFE_TRANS_0.second)), ctxc); From 4c079b7d333428383c0a34f2939c3c2fa2a324a6 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 20 Feb 2023 15:13:58 +0100 Subject: [PATCH 03/12] removed init lock check --- linux/ipcore/PdecHandler.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 8acbce16..3244280e 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -164,7 +164,6 @@ ReturnValue_t PdecHandler::irqOperation() { state = State::WAIT_FOR_RECOVERY; return result; } - checkLocks(); state = State::RUNNING; break; case State::RUNNING: { From 018f93cfbe5b59ecb6b6b1740b6e3e3b6efc6f86 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 22 Feb 2023 09:53:09 +0100 Subject: [PATCH 04/12] fixed bugs in com subsystem --- mission/system/objects/ComSubsystem.cpp | 6 +++++- mission/system/objects/ComSubsystem.h | 4 ++++ mission/system/tree/comModeTree.h | 5 ++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/mission/system/objects/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp index 8e3f253e..3ca78904 100644 --- a/mission/system/objects/ComSubsystem.cpp +++ b/mission/system/objects/ComSubsystem.cpp @@ -28,9 +28,10 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence void ComSubsystem::performChildOperation() { readEventQueue(); - if (mode != COM_SEQUENCE_RX_ONLY.first) { + if (countdownActive) { checkTransmitterCountdown(); } + Subsystem::performChildOperation(); } MessageQueueId_t ComSubsystem::getCommandQueue() const { return Subsystem::getCommandQueue(); } @@ -112,10 +113,12 @@ void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) { // disabled here if (mode == COM_SEQUENCE_RX_ONLY.first) { transmitterCountdown.timeOut(); + countdownActive = false; } else if ((mode == COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first) || (mode == COM_SEQUENCE_RX_AND_TX_LOW_RATE.first) || (mode == COM_SEQUENCE_RX_AND_TX_HIGH_RATE.first)) { transmitterCountdown.resetTimer(); + countdownActive = true; } Subsystem::startTransition(mode, submode); } @@ -170,5 +173,6 @@ void ComSubsystem::startRxAndTxDefaultSeq() { void ComSubsystem::checkTransmitterCountdown() { if (transmitterCountdown.hasTimedOut()) { startTransition(COM_SEQUENCE_RX_ONLY.first, SUBMODE_NONE); + countdownActive = false; } } diff --git a/mission/system/objects/ComSubsystem.h b/mission/system/objects/ComSubsystem.h index ac8cc60f..84ac081a 100644 --- a/mission/system/objects/ComSubsystem.h +++ b/mission/system/objects/ComSubsystem.h @@ -58,6 +58,10 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { // Countdown will be started as soon as the transmitter was enabled Countdown transmitterCountdown; + + // Transmitter countdown only active when sysrlinks transmitter is on (modes: + // rx and tx low rate, rx and tx high rate, rx and tx default rate) + bool countdownActive = false; }; #endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */ diff --git a/mission/system/tree/comModeTree.h b/mission/system/tree/comModeTree.h index 0f3c083f..0f57217c 100644 --- a/mission/system/tree/comModeTree.h +++ b/mission/system/tree/comModeTree.h @@ -11,7 +11,10 @@ extern ComSubsystem SUBSYSTEM; // The syrlinks must not transmitting longer then 15 minutes otherwise the // transceiver might be damaged due to overheating -static const uint32_t TRANSMITTER_TIMEOUT = 900000; // 15 minutes +// 15 minutes in milliseconds +//static const uint32_t TRANSMITTER_TIMEOUT = 900000; + +static const uint32_t TRANSMITTER_TIMEOUT = 60000; Subsystem& init(); } // namespace com From 82d428440b24ded062a4a45770b82799082cd69b Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 22 Feb 2023 09:53:39 +0100 Subject: [PATCH 05/12] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index a3a3aaa8..a06f703d 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a3a3aaa8836b425c923eb97e49ed29b452377bf6 +Subproject commit a06f703d6f6e882a15a745872cb42dac7f49f63b From fd1c090141f43dcab76544d80d628fa39c31115d Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 22 Feb 2023 13:02:04 +0100 Subject: [PATCH 06/12] tmtc update --- tmtc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtc b/tmtc index a06f703d..679df9eb 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit a06f703d6f6e882a15a745872cb42dac7f49f63b +Subproject commit 679df9ebe101ff93e36d8b58b5e0be04c5cc4cb2 From 3137ebb86eb82508c93789a21164196f6b92b431 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 22 Feb 2023 13:02:40 +0100 Subject: [PATCH 07/12] com subsystem complete --- bsp_q7s/core/ObjectFactory.cpp | 1 - linux/ipcore/PdecHandler.cpp | 1 + mission/system/objects/ComSubsystem.cpp | 123 ++++++++++++++---------- mission/system/objects/ComSubsystem.h | 17 +++- mission/system/tree/comModeTree.h | 4 +- 5 files changed, 89 insertions(+), 57 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 347cabdd..63539cc3 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -573,7 +573,6 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) { new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie, pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir); syrlinksHandler->setPowerSwitcher(pwrSwitcher); - syrlinksHandler->setStartUpImmediately(); syrlinksHandler->connectModeTreeParent(satsystem::com::SUBSYSTEM); #if OBSW_DEBUG_SYRLINKS == 1 syrlinksHandler->setDebugMode(true); diff --git a/linux/ipcore/PdecHandler.cpp b/linux/ipcore/PdecHandler.cpp index 3244280e..1cf21ce0 100644 --- a/linux/ipcore/PdecHandler.cpp +++ b/linux/ipcore/PdecHandler.cpp @@ -165,6 +165,7 @@ ReturnValue_t PdecHandler::irqOperation() { return result; } state = State::RUNNING; + checkLocks(); break; case State::RUNNING: { nb = write(fd, &info, sizeof(info)); diff --git a/mission/system/objects/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp index 3ca78904..3a79ac15 100644 --- a/mission/system/objects/ComSubsystem.cpp +++ b/mission/system/objects/ComSubsystem.cpp @@ -1,5 +1,3 @@ -#include - #include "ComSubsystem.h" #include @@ -7,14 +5,11 @@ #include #include #include +#include #include -extern std::pair> COM_SEQUENCE_RX_ONLY; -//extern std::pair> COM_TABLE_RX_ONLY_TGT; -extern std::pair> COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE; -extern std::pair> COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT; -extern std::pair> COM_SEQUENCE_RX_AND_TX_LOW_RATE; -extern std::pair> COM_SEQUENCE_RX_AND_TX_HIGH_RATE; +#include + ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables, uint32_t transmitterTimeout) @@ -28,8 +23,13 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence void ComSubsystem::performChildOperation() { readEventQueue(); + // Execute default rate sequence after transition has been completed + if (rememberBitLock and not isInTransition) { + startRxAndTxLowRateSeq(); + rememberBitLock = false; + } if (countdownActive) { - checkTransmitterCountdown(); + checkTransmitterCountdown(); } Subsystem::performChildOperation(); } @@ -51,17 +51,17 @@ ReturnValue_t ComSubsystem::getParameter(uint8_t domainId, uint8_t uniqueIdentif parameterWrapper->set(datarateCfg); com::setCurrentDatarate(static_cast(newVal)); return returnvalue::OK; - } - else if ((domainId == 0) and (uniqueIdentifier == static_cast(com::ParameterId::TRANSMITTER_TIMEOUT))) { - uint8_t newVal = 0; - ReturnValue_t result = newValues->getElement(&newVal); - if (result != returnvalue::OK) { - return result; - } - parameterWrapper->set(transmitterTimeout); - transmitterTimeout = newVal; - transmitterCountdown.setTimeout(transmitterTimeout); - return returnvalue::OK; + } else if ((domainId == 0) and + (uniqueIdentifier == static_cast(com::ParameterId::TRANSMITTER_TIMEOUT))) { + uint32_t newVal = 0; + ReturnValue_t result = newValues->getElement(&newVal); + if (result != returnvalue::OK) { + return result; + } + parameterWrapper->set(transmitterTimeout); + transmitterTimeout = newVal; + transmitterCountdown.setTimeout(transmitterTimeout); + return returnvalue::OK; } return returnvalue::OK; } @@ -79,46 +79,48 @@ ReturnValue_t ComSubsystem::initialize() { if (result != returnvalue::OK) { return result; } - EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); - if (manager == nullptr) { + EventManagerIF *manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); + if (manager == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "ComSubsystem::initialize: Invalid event manager" << std::endl; + sif::error << "ComSubsystem::initialize: Invalid event manager" << std::endl; #endif - return ObjectManagerIF::CHILD_INIT_FAILED; - } - result = manager->registerListener(eventQueue->getId()); - if (result != returnvalue::OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + result = manager->registerListener(eventQueue->getId()); + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "ComSubsystem::initialize: Failed to register Com Subsystem as event " - "listener" << std::endl; + sif::warning << "ComSubsystem::initialize: Failed to register Com Subsystem as event " + "listener" + << std::endl; #endif - return ObjectManagerIF::CHILD_INIT_FAILED; - } - result = manager->subscribeToEventRange(eventQueue->getId(), - event::getEventId(PdecHandler::CARRIER_LOCK), - event::getEventId(PdecHandler::BIT_LOCK_PDEC)); - if (result != returnvalue::OK) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } + result = manager->subscribeToEventRange(eventQueue->getId(), + event::getEventId(PdecHandler::CARRIER_LOCK), + event::getEventId(PdecHandler::BIT_LOCK_PDEC)); + if (result != returnvalue::OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "ComSubsystem::initialize: Failed to subscribe to events from PDEC " - "handler" - << std::endl; + sif::error << "ComSubsystem::initialize: Failed to subscribe to events from PDEC " + "handler" + << std::endl; #endif - return result; - } + return result; + } return Subsystem::initialize(); } void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) { // Depending on the submode the transmitter timeout is enabled or // disabled here - if (mode == COM_SEQUENCE_RX_ONLY.first) { + if (mode == com::Submode::RX_ONLY) { transmitterCountdown.timeOut(); countdownActive = false; - } else if ((mode == COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first) || - (mode == COM_SEQUENCE_RX_AND_TX_LOW_RATE.first) || - (mode == COM_SEQUENCE_RX_AND_TX_HIGH_RATE.first)) { - transmitterCountdown.resetTimer(); - countdownActive = true; + } else if (isTxMode(mode)) { + // Only start transmitter countdown if transmitter is not already on + if (not isTxMode(this->mode)) { + transmitterCountdown.resetTimer(); + countdownActive = true; + } } Subsystem::startTransition(mode, submode); } @@ -156,23 +158,42 @@ void ComSubsystem::handleEventMessage(EventMessage *eventMessage) { } } -void ComSubsystem::handleBitLockEvent() { startRxAndTxDefaultSeq(); } +void ComSubsystem::handleBitLockEvent() { + if (isTxMode(mode)) { + // Tx already on + return; + } + if (isInTransition) { + rememberBitLock = true; + return; + } + startRxAndTxLowRateSeq(); +} void ComSubsystem::handleCarrierLockEvent() { if (!enableTxWhenCarrierLock) { return; } - startRxAndTxDefaultSeq(); + startRxAndTxLowRateSeq(); } -void ComSubsystem::startRxAndTxDefaultSeq() { +void ComSubsystem::startRxAndTxLowRateSeq() { // Turns transmitter on - startTransition(COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first, SUBMODE_NONE); + startTransition(com::Submode::RX_AND_TX_LOW_DATARATE, SUBMODE_NONE); } void ComSubsystem::checkTransmitterCountdown() { if (transmitterCountdown.hasTimedOut()) { - startTransition(COM_SEQUENCE_RX_ONLY.first, SUBMODE_NONE); + startTransition(com::Submode::RX_ONLY, SUBMODE_NONE); countdownActive = false; } } + +bool ComSubsystem::isTxMode(Mode_t mode) { + if ((mode == com::Submode::RX_AND_TX_DEFAULT_DATARATE) || + (mode == com::Submode::RX_AND_TX_LOW_DATARATE) || + (mode == com::Submode::RX_AND_TX_HIGH_DATARATE)) { + return true; + } + return false; +} diff --git a/mission/system/objects/ComSubsystem.h b/mission/system/objects/ComSubsystem.h index 84ac081a..6b5b41dc 100644 --- a/mission/system/objects/ComSubsystem.h +++ b/mission/system/objects/ComSubsystem.h @@ -30,6 +30,9 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { virtual void performChildOperation() override; private: + + static const Mode_t INITIAL_MODE = 0; + ReturnValue_t handleCommandMessage(CommandMessage *message) override; ReturnValue_t initialize() override; @@ -42,9 +45,14 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { void handleCarrierLockEvent(); void checkTransmitterCountdown(); /** - * @brief Enables transmitter in default (low) rate mode + * @brief Enables transmitter in low rate mode */ - void startRxAndTxDefaultSeq(); + void startRxAndTxLowRateSeq(); + + /** + * @brief Returns true if mode is a mode where the transmitter is on + */ + bool isTxMode(Mode_t mode); uint8_t datarateCfg = static_cast(com::Datarate::LOW_RATE_MODULATION_BPSK); // Maximum time after which the transmitter will be turned of. This is a @@ -62,6 +70,11 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { // Transmitter countdown only active when sysrlinks transmitter is on (modes: // rx and tx low rate, rx and tx high rate, rx and tx default rate) bool countdownActive = false; + + // True when bit lock occurred while COM subsystem is in a transition. This + // variable is used to remember the bit lock and execute the default rate + // sequence after the active transition has been completed + bool rememberBitLock = false; }; #endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */ diff --git a/mission/system/tree/comModeTree.h b/mission/system/tree/comModeTree.h index 0f57217c..8641874e 100644 --- a/mission/system/tree/comModeTree.h +++ b/mission/system/tree/comModeTree.h @@ -12,9 +12,7 @@ extern ComSubsystem SUBSYSTEM; // The syrlinks must not transmitting longer then 15 minutes otherwise the // transceiver might be damaged due to overheating // 15 minutes in milliseconds -//static const uint32_t TRANSMITTER_TIMEOUT = 900000; - -static const uint32_t TRANSMITTER_TIMEOUT = 60000; +static const uint32_t TRANSMITTER_TIMEOUT = 900000; Subsystem& init(); } // namespace com From 19d04c0023d84f4df63fbcb32519c648900bc720 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Feb 2023 15:03:07 +0100 Subject: [PATCH 08/12] v1.30.0 --- CHANGELOG.md | 15 ++++++++++----- CMakeLists.txt | 4 ++-- bsp_hosted/fsfwconfig/events/translateEvents.cpp | 9 ++++++--- .../fsfwconfig/objects/translateObjects.cpp | 2 +- generators/bsp_hosted_events.csv | 5 +++-- generators/bsp_q7s_events.csv | 5 +++-- generators/events/translateEvents.cpp | 9 ++++++--- generators/objects/translateObjects.cpp | 2 +- linux/fsfwconfig/events/translateEvents.cpp | 9 ++++++--- linux/fsfwconfig/objects/translateObjects.cpp | 2 +- linux/ipcore/PdecHandler.h | 4 ++-- tmtc | 2 +- 12 files changed, 42 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8fd799e..02840492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,16 +8,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). The [milestone](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones) list yields a list of all related PRs for each release. -Starting at v2.0.0, the following changes will consitute of a breaking -change warranting a new major release: +Starting at v2.0.0, this project will adhere to semantic versioning and the the following changes +will consitute of a breaking change warranting a new major release: - The TMTC interface changes in any shape of form. -- The behavour of the OBSW changes in a major shape or form relevant - for operations +- The behavour of the OBSW changes in a major shape or form relevant for operations # [unreleased] -## Added +# [v1.30.0] + +eive-tmtc: v2.14.0 + +Event IDs for PDEC handler have changed in a breaking manner. + +## Added and Fixed - PDEC: Added basic FDIR to limit the number of allowed TC interrupts and to allow complete task lockups in the case an IRQ is immediately re-raised by the PDEC module. This is done by only diff --git a/CMakeLists.txt b/CMakeLists.txt index 076c9ae7..44dce9b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,8 +10,8 @@ cmake_minimum_required(VERSION 3.13) set(OBSW_VERSION_MAJOR 1) -set(OBSW_VERSION_MINOR 29) -set(OBSW_VERSION_REVISION 1) +set(OBSW_VERSION_MINOR 30) +set(OBSW_VERSION_REVISION 0) # set(CMAKE_VERBOSE TRUE) diff --git a/bsp_hosted/fsfwconfig/events/translateEvents.cpp b/bsp_hosted/fsfwconfig/events/translateEvents.cpp index 71f28a31..39d4c89a 100644 --- a/bsp_hosted/fsfwconfig/events/translateEvents.cpp +++ b/bsp_hosted/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 257 translations. + * @brief Auto-generated event translation file. Contains 258 translations. * @details - * Generated on: 2023-02-21 10:44:59 + * Generated on: 2023-02-22 15:00:34 */ #include "translateEvents.h" @@ -151,6 +151,7 @@ const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC"; const char *LOST_CARRIER_LOCK_PDEC_STRING = "LOST_CARRIER_LOCK_PDEC"; const char *LOST_BIT_LOCK_PDEC_STRING = "LOST_BIT_LOCK_PDEC"; +const char *TOO_MANY_IRQS_STRING = "TOO_MANY_IRQS"; const char *POLL_SYSCALL_ERROR_PDEC_STRING = "POLL_SYSCALL_ERROR_PDEC"; const char *WRITE_SYSCALL_ERROR_PDEC_STRING = "WRITE_SYSCALL_ERROR_PDEC"; const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED"; @@ -553,8 +554,10 @@ const char *translateEvents(Event event) { case (12406): return LOST_BIT_LOCK_PDEC_STRING; case (12407): - return POLL_SYSCALL_ERROR_PDEC_STRING; + return TOO_MANY_IRQS_STRING; case (12408): + return POLL_SYSCALL_ERROR_PDEC_STRING; + case (12409): return WRITE_SYSCALL_ERROR_PDEC_STRING; case (12500): return IMAGE_UPLOAD_FAILED_STRING; diff --git a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp index 08b7ac62..4a9083e3 100644 --- a/bsp_hosted/fsfwconfig/objects/translateObjects.cpp +++ b/bsp_hosted/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 148 translations. - * Generated on: 2023-02-21 10:44:59 + * Generated on: 2023-02-22 15:00:34 */ #include "translateObjects.h" diff --git a/generators/bsp_hosted_events.csv b/generators/bsp_hosted_events.csv index 09afd861..f1188b4e 100644 --- a/generators/bsp_hosted_events.csv +++ b/generators/bsp_hosted_events.csv @@ -145,8 +145,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/PdecHandler.h 12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/PdecHandler.h 12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/PdecHandler.h -12407;0x3077;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h -12408;0x3078;WRITE_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h +12407;0x3077;TOO_MANY_IRQS;MEDIUM;Too many IRQs over the time window of one second. P1: Allowed TCs;linux/ipcore/PdecHandler.h +12408;0x3078;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h +12409;0x3079;WRITE_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h 12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/devices/startracker/StrHelper.h 12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/devices/startracker/StrHelper.h 12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/devices/startracker/StrHelper.h diff --git a/generators/bsp_q7s_events.csv b/generators/bsp_q7s_events.csv index 09afd861..f1188b4e 100644 --- a/generators/bsp_q7s_events.csv +++ b/generators/bsp_q7s_events.csv @@ -145,8 +145,9 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path 12404;0x3074;BIT_LOCK_PDEC;INFO;Bit lock detected (data valid);linux/ipcore/PdecHandler.h 12405;0x3075;LOST_CARRIER_LOCK_PDEC;INFO;Lost carrier lock;linux/ipcore/PdecHandler.h 12406;0x3076;LOST_BIT_LOCK_PDEC;INFO;Lost bit lock;linux/ipcore/PdecHandler.h -12407;0x3077;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h -12408;0x3078;WRITE_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h +12407;0x3077;TOO_MANY_IRQS;MEDIUM;Too many IRQs over the time window of one second. P1: Allowed TCs;linux/ipcore/PdecHandler.h +12408;0x3078;POLL_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h +12409;0x3079;WRITE_SYSCALL_ERROR_PDEC;MEDIUM;No description;linux/ipcore/PdecHandler.h 12500;0x30d4;IMAGE_UPLOAD_FAILED;LOW;Image upload failed;linux/devices/startracker/StrHelper.h 12501;0x30d5;IMAGE_DOWNLOAD_FAILED;LOW;Image download failed;linux/devices/startracker/StrHelper.h 12502;0x30d6;IMAGE_UPLOAD_SUCCESSFUL;LOW;Uploading image to star tracker was successfulop;linux/devices/startracker/StrHelper.h diff --git a/generators/events/translateEvents.cpp b/generators/events/translateEvents.cpp index 71f28a31..39d4c89a 100644 --- a/generators/events/translateEvents.cpp +++ b/generators/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 257 translations. + * @brief Auto-generated event translation file. Contains 258 translations. * @details - * Generated on: 2023-02-21 10:44:59 + * Generated on: 2023-02-22 15:00:34 */ #include "translateEvents.h" @@ -151,6 +151,7 @@ const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC"; const char *LOST_CARRIER_LOCK_PDEC_STRING = "LOST_CARRIER_LOCK_PDEC"; const char *LOST_BIT_LOCK_PDEC_STRING = "LOST_BIT_LOCK_PDEC"; +const char *TOO_MANY_IRQS_STRING = "TOO_MANY_IRQS"; const char *POLL_SYSCALL_ERROR_PDEC_STRING = "POLL_SYSCALL_ERROR_PDEC"; const char *WRITE_SYSCALL_ERROR_PDEC_STRING = "WRITE_SYSCALL_ERROR_PDEC"; const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED"; @@ -553,8 +554,10 @@ const char *translateEvents(Event event) { case (12406): return LOST_BIT_LOCK_PDEC_STRING; case (12407): - return POLL_SYSCALL_ERROR_PDEC_STRING; + return TOO_MANY_IRQS_STRING; case (12408): + return POLL_SYSCALL_ERROR_PDEC_STRING; + case (12409): return WRITE_SYSCALL_ERROR_PDEC_STRING; case (12500): return IMAGE_UPLOAD_FAILED_STRING; diff --git a/generators/objects/translateObjects.cpp b/generators/objects/translateObjects.cpp index b8deca09..a5100ae1 100644 --- a/generators/objects/translateObjects.cpp +++ b/generators/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 153 translations. - * Generated on: 2023-02-21 10:44:59 + * Generated on: 2023-02-22 15:00:34 */ #include "translateObjects.h" diff --git a/linux/fsfwconfig/events/translateEvents.cpp b/linux/fsfwconfig/events/translateEvents.cpp index 71f28a31..39d4c89a 100644 --- a/linux/fsfwconfig/events/translateEvents.cpp +++ b/linux/fsfwconfig/events/translateEvents.cpp @@ -1,7 +1,7 @@ /** - * @brief Auto-generated event translation file. Contains 257 translations. + * @brief Auto-generated event translation file. Contains 258 translations. * @details - * Generated on: 2023-02-21 10:44:59 + * Generated on: 2023-02-22 15:00:34 */ #include "translateEvents.h" @@ -151,6 +151,7 @@ const char *CARRIER_LOCK_STRING = "CARRIER_LOCK"; const char *BIT_LOCK_PDEC_STRING = "BIT_LOCK_PDEC"; const char *LOST_CARRIER_LOCK_PDEC_STRING = "LOST_CARRIER_LOCK_PDEC"; const char *LOST_BIT_LOCK_PDEC_STRING = "LOST_BIT_LOCK_PDEC"; +const char *TOO_MANY_IRQS_STRING = "TOO_MANY_IRQS"; const char *POLL_SYSCALL_ERROR_PDEC_STRING = "POLL_SYSCALL_ERROR_PDEC"; const char *WRITE_SYSCALL_ERROR_PDEC_STRING = "WRITE_SYSCALL_ERROR_PDEC"; const char *IMAGE_UPLOAD_FAILED_STRING = "IMAGE_UPLOAD_FAILED"; @@ -553,8 +554,10 @@ const char *translateEvents(Event event) { case (12406): return LOST_BIT_LOCK_PDEC_STRING; case (12407): - return POLL_SYSCALL_ERROR_PDEC_STRING; + return TOO_MANY_IRQS_STRING; case (12408): + return POLL_SYSCALL_ERROR_PDEC_STRING; + case (12409): return WRITE_SYSCALL_ERROR_PDEC_STRING; case (12500): return IMAGE_UPLOAD_FAILED_STRING; diff --git a/linux/fsfwconfig/objects/translateObjects.cpp b/linux/fsfwconfig/objects/translateObjects.cpp index b8deca09..a5100ae1 100644 --- a/linux/fsfwconfig/objects/translateObjects.cpp +++ b/linux/fsfwconfig/objects/translateObjects.cpp @@ -2,7 +2,7 @@ * @brief Auto-generated object translation file. * @details * Contains 153 translations. - * Generated on: 2023-02-21 10:44:59 + * Generated on: 2023-02-22 15:00:34 */ #include "translateObjects.h" diff --git a/linux/ipcore/PdecHandler.h b/linux/ipcore/PdecHandler.h index 51cf750e..09093b88 100644 --- a/linux/ipcore/PdecHandler.h +++ b/linux/ipcore/PdecHandler.h @@ -90,9 +90,9 @@ class PdecHandler : public SystemObject, public ExecutableObjectIF, public HasAc //! [EXPORT] : [COMMENT] Too many IRQs over the time window of one second. P1: Allowed TCs static constexpr Event TOO_MANY_IRQS = MAKE_EVENT(7, severity::MEDIUM); static constexpr Event POLL_SYSCALL_ERROR_PDEC = - event::makeEvent(SUBSYSTEM_ID, 7, severity::MEDIUM); - static constexpr Event WRITE_SYSCALL_ERROR_PDEC = event::makeEvent(SUBSYSTEM_ID, 8, severity::MEDIUM); + static constexpr Event WRITE_SYSCALL_ERROR_PDEC = + event::makeEvent(SUBSYSTEM_ID, 9, severity::MEDIUM); private: static const uint8_t INTERFACE_ID = CLASS_ID::PDEC_HANDLER; diff --git a/tmtc b/tmtc index 4ced2d0b..be032ab9 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 4ced2d0b185f9949662c946ca71fe666ac25e411 +Subproject commit be032ab925cab58bc443dd877b8260d291894802 From 0d8cb295d9ca4acfeb2120e68d9f91b6e36ea013 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 22 Feb 2023 16:55:12 +0100 Subject: [PATCH 09/12] removed duplicate code --- mission/tmtc/CcsdsIpCoreHandler.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mission/tmtc/CcsdsIpCoreHandler.cpp b/mission/tmtc/CcsdsIpCoreHandler.cpp index 0b6a210d..b462f236 100644 --- a/mission/tmtc/CcsdsIpCoreHandler.cpp +++ b/mission/tmtc/CcsdsIpCoreHandler.cpp @@ -97,10 +97,6 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - if (result != returnvalue::OK) { - return ObjectManagerIF::CHILD_INIT_FAILED; - } - #if OBSW_SYRLINKS_SIMULATED == 1 // Update data on rising edge ptmeConfig->invertTxClock(false); From 5357de8da88b11b8c5068d58fcb3343654827ec3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Feb 2023 18:13:52 +0100 Subject: [PATCH 10/12] bump fsfe --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 2efff4d2..bd208038 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 2efff4d2c5ef82b5b62567ab1bb0ee53aeed6a5a +Subproject commit bd208038dd85a94dce8c763397ad5ac7eae76402 From a190d99f6d4e174f456948ded64baec1540bdc78 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Feb 2023 19:45:41 +0100 Subject: [PATCH 11/12] auto-formatter --- bsp_q7s/core/ObjectFactory.cpp | 6 +-- linux/devices/CMakeLists.txt | 5 ++- mission/devices/ImtqHandler.cpp | 2 +- mission/system/objects/ComSubsystem.cpp | 23 +++++----- mission/system/objects/ComSubsystem.h | 30 ++++++------- mission/system/tree/comModeTree.cpp | 60 ++++++++++++++----------- mission/system/tree/comModeTree.h | 2 +- mission/system/tree/system.cpp | 3 +- mission/tmtc/CfdpTmFunnel.cpp | 2 +- mission/tmtc/PusTmFunnel.cpp | 2 +- mission/tmtc/VirtualChannel.cpp | 2 +- 11 files changed, 74 insertions(+), 63 deletions(-) diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index 63539cc3..59a17207 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -756,9 +756,9 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(LinuxLibgpioIF* gpioComIF, new AxiPtmeConfig(objects::AXI_PTME_CONFIG, q7s::UIO_PTME, q7s::uiomapids::PTME_CONFIG); PtmeConfig* ptmeConfig = new PtmeConfig(objects::PTME_CONFIG, axiPtmeConfig); - *ipCoreHandler = new CcsdsIpCoreHandler( - objects::CCSDS_HANDLER, objects::PTME, objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig, - gpioComIF, gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA); + *ipCoreHandler = new CcsdsIpCoreHandler(objects::CCSDS_HANDLER, objects::PTME, + objects::CCSDS_PACKET_DISTRIBUTOR, ptmeConfig, gpioComIF, + gpioIds::RS485_EN_TX_CLOCK, gpioIds::RS485_EN_TX_DATA); VirtualChannel* vc = nullptr; vc = new VirtualChannel(ccsds::VC0, config::VC0_QUEUE_SIZE, objects::CCSDS_HANDLER); (*ipCoreHandler)->addVirtualChannel(ccsds::VC0, vc); diff --git a/linux/devices/CMakeLists.txt b/linux/devices/CMakeLists.txt index 17d842ea..22b39840 100644 --- a/linux/devices/CMakeLists.txt +++ b/linux/devices/CMakeLists.txt @@ -3,8 +3,9 @@ if(EIVE_BUILD_GPSD_GPS_HANDLER) endif() target_sources( - ${OBSW_NAME} PRIVATE Max31865RtdPolling.cpp ScexUartReader.cpp ImtqPollingTask.cpp - ScexDleParser.cpp ScexHelper.cpp RwPollingTask.cpp) + ${OBSW_NAME} + PRIVATE Max31865RtdPolling.cpp ScexUartReader.cpp ImtqPollingTask.cpp + ScexDleParser.cpp ScexHelper.cpp RwPollingTask.cpp) add_subdirectory(ploc) diff --git a/mission/devices/ImtqHandler.cpp b/mission/devices/ImtqHandler.cpp index 18c002c4..aa935ce5 100644 --- a/mission/devices/ImtqHandler.cpp +++ b/mission/devices/ImtqHandler.cpp @@ -256,7 +256,7 @@ ReturnValue_t ImtqHandler::scanForReply(const uint8_t* start, size_t remainingSi ReturnValue_t ImtqHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { ReturnValue_t result; ReturnValue_t status = returnvalue::OK; - if(getMode() != MODE_NORMAL) { + if (getMode() != MODE_NORMAL) { // Ignore replies during transitions. return returnvalue::OK; } diff --git a/mission/system/objects/ComSubsystem.cpp b/mission/system/objects/ComSubsystem.cpp index 3a79ac15..a30f441b 100644 --- a/mission/system/objects/ComSubsystem.cpp +++ b/mission/system/objects/ComSubsystem.cpp @@ -10,7 +10,6 @@ #include - ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables, uint32_t transmitterTimeout) : Subsystem(setObjectId, maxNumberOfSequences, maxNumberOfTables), paramHelper(this) { @@ -116,11 +115,11 @@ void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) { transmitterCountdown.timeOut(); countdownActive = false; } else if (isTxMode(mode)) { - // Only start transmitter countdown if transmitter is not already on - if (not isTxMode(this->mode)) { - transmitterCountdown.resetTimer(); - countdownActive = true; - } + // Only start transmitter countdown if transmitter is not already on + if (not isTxMode(this->mode)) { + transmitterCountdown.resetTimer(); + countdownActive = true; + } } Subsystem::startTransition(mode, submode); } @@ -190,10 +189,10 @@ void ComSubsystem::checkTransmitterCountdown() { } bool ComSubsystem::isTxMode(Mode_t mode) { - if ((mode == com::Submode::RX_AND_TX_DEFAULT_DATARATE) || - (mode == com::Submode::RX_AND_TX_LOW_DATARATE) || - (mode == com::Submode::RX_AND_TX_HIGH_DATARATE)) { - return true; - } - return false; + if ((mode == com::Submode::RX_AND_TX_DEFAULT_DATARATE) || + (mode == com::Submode::RX_AND_TX_LOW_DATARATE) || + (mode == com::Submode::RX_AND_TX_HIGH_DATARATE)) { + return true; + } + return false; } diff --git a/mission/system/objects/ComSubsystem.h b/mission/system/objects/ComSubsystem.h index 6b5b41dc..50f34b0d 100644 --- a/mission/system/objects/ComSubsystem.h +++ b/mission/system/objects/ComSubsystem.h @@ -1,24 +1,25 @@ #ifndef MISSION_SYSTEM_COMSUBSYSTEM_H_ #define MISSION_SYSTEM_COMSUBSYSTEM_H_ +#include #include #include #include -#include #include "mission/comDefs.h" class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { public: - /** - * @brief Constructor - * - * @param setObjectId - * @param maxNumberOfSequences - * @param maxNumberOfTables - * @param transmitterTimeout Maximum time the transmitter of the syrlinks - * will be enabled - */ + /** + * @brief Constructor + * + * @param setObjectId + * @param maxNumberOfSequences + * @param maxNumberOfTables + * @param transmitterTimeout Maximum time the transmitter of the syrlinks + * will be + * enabled + */ ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences, uint32_t maxNumberOfTables, uint32_t transmitterTimeout); virtual ~ComSubsystem() = default; @@ -30,7 +31,6 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { virtual void performChildOperation() override; private: - static const Mode_t INITIAL_MODE = 0; ReturnValue_t handleCommandMessage(CommandMessage *message) override; @@ -40,7 +40,7 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { void startTransition(Mode_t mode, Submode_t submode) override; void readEventQueue(); - void handleEventMessage(EventMessage* eventMessage); + void handleEventMessage(EventMessage *eventMessage); void handleBitLockEvent(); void handleCarrierLockEvent(); void checkTransmitterCountdown(); @@ -56,11 +56,11 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF { uint8_t datarateCfg = static_cast(com::Datarate::LOW_RATE_MODULATION_BPSK); // Maximum time after which the transmitter will be turned of. This is a - // protection mechanism due prevent the syrlinks from overheating - uint32_t transmitterTimeout = 0; + // protection mechanism due prevent the syrlinks from overheating + uint32_t transmitterTimeout = 0; ParameterHelper paramHelper; - MessageQueueIF* eventQueue = nullptr; + MessageQueueIF *eventQueue = nullptr; bool enableTxWhenCarrierLock = false; diff --git a/mission/system/tree/comModeTree.cpp b/mission/system/tree/comModeTree.cpp index 222d1f7d..9dc85a78 100644 --- a/mission/system/tree/comModeTree.cpp +++ b/mission/system/tree/comModeTree.cpp @@ -10,7 +10,8 @@ const auto check = subsystem::checkInsert; -ComSubsystem satsystem::com::SUBSYSTEM = ComSubsystem(objects::COM_SUBSYSTEM, 12, 24, TRANSMITTER_TIMEOUT); +ComSubsystem satsystem::com::SUBSYSTEM = + ComSubsystem(objects::COM_SUBSYSTEM, 12, 24, TRANSMITTER_TIMEOUT); static const auto OFF = HasModesIF::MODE_OFF; static const auto ON = HasModesIF::MODE_ON; @@ -18,39 +19,48 @@ static const auto NML = DeviceHandlerIF::MODE_NORMAL; auto COM_SEQUENCE_RX_ONLY = std::make_pair(::com::Submode::RX_ONLY, FixedArrayList()); -auto COM_TABLE_RX_ONLY_TGT = - std::make_pair(static_cast(::com::Submode::RX_ONLY << 24) | 1, FixedArrayList()); -auto COM_TABLE_RX_ONLY_TRANS_0 = - std::make_pair(static_cast(::com::Submode::RX_ONLY << 24) | 2, FixedArrayList()); -auto COM_TABLE_RX_ONLY_TRANS_1 = - std::make_pair(static_cast(::com::Submode::RX_ONLY << 24) | 3, FixedArrayList()); +auto COM_TABLE_RX_ONLY_TGT = std::make_pair( + static_cast(::com::Submode::RX_ONLY << 24) | 1, FixedArrayList()); +auto COM_TABLE_RX_ONLY_TRANS_0 = std::make_pair( + static_cast(::com::Submode::RX_ONLY << 24) | 2, FixedArrayList()); +auto COM_TABLE_RX_ONLY_TRANS_1 = std::make_pair( + static_cast(::com::Submode::RX_ONLY << 24) | 3, FixedArrayList()); auto COM_SEQUENCE_RX_AND_TX_LOW_RATE = std::make_pair(::com::Submode::RX_AND_TX_LOW_DATARATE, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, FixedArrayList()); +auto COM_TABLE_RX_AND_TX_LOW_RATE_TGT = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 1, + FixedArrayList()); +auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_0 = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 2, + FixedArrayList()); +auto COM_TABLE_RX_AND_TX_LOW_RATE_TRANS_1 = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_LOW_DATARATE << 24) | 3, + FixedArrayList()); auto COM_SEQUENCE_RX_AND_TX_HIGH_RATE = std::make_pair(::com::Submode::RX_AND_TX_HIGH_DATARATE, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, FixedArrayList()); +auto COM_TABLE_RX_AND_TX_HIGH_RATE_TGT = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 1, + FixedArrayList()); +auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_0 = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 2, + FixedArrayList()); +auto COM_TABLE_RX_AND_TX_HIGH_RATE_TRANS_1 = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_HIGH_DATARATE << 24) | 3, + FixedArrayList()); auto COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE = std::make_pair(::com::Submode::RX_AND_TX_DEFAULT_DATARATE, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 1, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0 = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 2, FixedArrayList()); -auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1 = std::make_pair( - static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 3, FixedArrayList()); +auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 1, + FixedArrayList()); +auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_0 = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 2, + FixedArrayList()); +auto COM_TABLE_RX_AND_TX_DEFAULT_RATE_TRANS_1 = + std::make_pair(static_cast(::com::Submode::RX_AND_TX_DEFAULT_DATARATE << 24) | 3, + FixedArrayList()); namespace { diff --git a/mission/system/tree/comModeTree.h b/mission/system/tree/comModeTree.h index 8641874e..9260e3ea 100644 --- a/mission/system/tree/comModeTree.h +++ b/mission/system/tree/comModeTree.h @@ -1,8 +1,8 @@ #ifndef MISSION_SYSTEM_TREE_COMMODETREE_H_ #define MISSION_SYSTEM_TREE_COMMODETREE_H_ -#include #include +#include namespace satsystem { diff --git a/mission/system/tree/system.cpp b/mission/system/tree/system.cpp index cb6202f1..5ec10a8c 100644 --- a/mission/system/tree/system.cpp +++ b/mission/system/tree/system.cpp @@ -3,10 +3,11 @@ #include #include #include -#include "mission/comDefs.h" + #include "acsModeTree.h" #include "comModeTree.h" #include "eive/objects.h" +#include "mission/comDefs.h" #include "payloadModeTree.h" #include "tcsModeTree.h" #include "util.h" diff --git a/mission/tmtc/CfdpTmFunnel.cpp b/mission/tmtc/CfdpTmFunnel.cpp index 779e9aa8..32dba7fe 100644 --- a/mission/tmtc/CfdpTmFunnel.cpp +++ b/mission/tmtc/CfdpTmFunnel.cpp @@ -21,7 +21,7 @@ ReturnValue_t CfdpTmFunnel::performOperation(uint8_t) { break; } count++; - if(count == 500) { + if (count == 500) { sif::error << "CfdpTmFunnel: Possible message storm detected" << std::endl; break; } diff --git a/mission/tmtc/PusTmFunnel.cpp b/mission/tmtc/PusTmFunnel.cpp index e239afc9..974cdca0 100644 --- a/mission/tmtc/PusTmFunnel.cpp +++ b/mission/tmtc/PusTmFunnel.cpp @@ -21,7 +21,7 @@ ReturnValue_t PusTmFunnel::performOperation(uint8_t) { break; } count++; - if(count == 500) { + if (count == 500) { sif::error << "PusTmFunnel: Possible message storm detected" << std::endl; break; } diff --git a/mission/tmtc/VirtualChannel.cpp b/mission/tmtc/VirtualChannel.cpp index 64c7b006..6a24cc09 100644 --- a/mission/tmtc/VirtualChannel.cpp +++ b/mission/tmtc/VirtualChannel.cpp @@ -50,7 +50,7 @@ ReturnValue_t VirtualChannel::performOperation() { } count++; - if(count == 500) { + if (count == 500) { sif::error << "VirtualChannel: Possible message storm detected" << std::endl; break; } From d32ce3c5631f0c682e1c60563be1b569b801059b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 22 Feb 2023 19:48:44 +0100 Subject: [PATCH 12/12] changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 02840492..e075c5f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,18 @@ will consitute of a breaking change warranting a new major release: # [unreleased] +## Changed + +COM PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/364 + +* Moved transmitter timer and handling of carrier and bitlock event from CCSDS handler to COM + subsystem +* Added parameter command to be able to change the transmitter timeout +* Solves [#362](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/issues/362) +* Solves [#360](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/issues/360) +* Solves [#361](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/issues/361) +* Solves [#386](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/issues/386) + # [v1.30.0] eive-tmtc: v2.14.0