that should be transition safe
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-16 18:05:23 +01:00
parent a16671762d
commit 56a4378a63
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 23 additions and 4 deletions

View File

@ -24,6 +24,11 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence
void ComSubsystem::performChildOperation() { void ComSubsystem::performChildOperation() {
readEventQueue(); readEventQueue();
if (performRecoveryToRxOnly and not isInTransition) {
startRxOnlyRecovery(true);
// To avoid immediately enabling TX after falling back.
rememberBitLock = false;
}
// Execute default rate sequence after transition has been completed // Execute default rate sequence after transition has been completed
if (rememberBitLock and not isInTransition) { if (rememberBitLock and not isInTransition) {
startRxAndTxLowRateSeq(); startRxAndTxLowRateSeq();
@ -151,10 +156,16 @@ void ComSubsystem::handleEventMessage(EventMessage *eventMessage) {
Event event = eventMessage->getEvent(); Event event = eventMessage->getEvent();
switch (event) { switch (event) {
case tcsCtrl::SYRLINKS_OVERHEATING: { case tcsCtrl::SYRLINKS_OVERHEATING: {
// TODO: To prevent simply overwriting/cancelling on-going transitions, set flag here and // This event overrides the bit lock.
// execute transition at a later stage. rememberBitLock = false;
modeHelper.setForced(true); if (mode == com::RX_ONLY) {
startTransition(com::RX_ONLY, 0); return;
}
if (isInTransition) {
performRecoveryToRxOnly = true;
return;
}
startRxOnlyRecovery(true);
break; break;
} }
case PdecHandler::BIT_LOCK_PDEC: { case PdecHandler::BIT_LOCK_PDEC: {
@ -204,6 +215,12 @@ void ComSubsystem::checkTransmitterCountdown() {
} }
} }
void ComSubsystem::startRxOnlyRecovery(bool forced) {
modeHelper.setForced(forced);
startTransition(com::RX_ONLY, 0);
performRecoveryToRxOnly = false;
}
bool ComSubsystem::isTxMode(Mode_t mode) { bool ComSubsystem::isTxMode(Mode_t mode) {
if ((mode == com::Submode::RX_AND_TX_DEFAULT_DATARATE) || if ((mode == com::Submode::RX_AND_TX_DEFAULT_DATARATE) ||
(mode == com::Submode::RX_AND_TX_LOW_DATARATE) || (mode == com::Submode::RX_AND_TX_LOW_DATARATE) ||

View File

@ -57,6 +57,7 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
* @brief Enables transmitter in low rate mode * @brief Enables transmitter in low rate mode
*/ */
void startRxAndTxLowRateSeq(); void startRxAndTxLowRateSeq();
void startRxOnlyRecovery(bool forced);
/** /**
* @brief Returns true if mode is a mode where the transmitter is on * @brief Returns true if mode is a mode where the transmitter is on
@ -73,6 +74,7 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
MessageQueueIF *eventQueue = nullptr; MessageQueueIF *eventQueue = nullptr;
bool enableTxWhenCarrierLock = false; bool enableTxWhenCarrierLock = false;
bool performRecoveryToRxOnly = false;
// Countdown will be started as soon as the transmitter was enabled // Countdown will be started as soon as the transmitter was enabled
Countdown transmitterCountdown; Countdown transmitterCountdown;