that should be transition safe
EIVE/eive-obsw/pipeline/pr-develop This commit looks good Details

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() {
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
if (rememberBitLock and not isInTransition) {
startRxAndTxLowRateSeq();
@ -151,10 +156,16 @@ void ComSubsystem::handleEventMessage(EventMessage *eventMessage) {
Event event = eventMessage->getEvent();
switch (event) {
case tcsCtrl::SYRLINKS_OVERHEATING: {
// TODO: To prevent simply overwriting/cancelling on-going transitions, set flag here and
// execute transition at a later stage.
modeHelper.setForced(true);
startTransition(com::RX_ONLY, 0);
// This event overrides the bit lock.
rememberBitLock = false;
if (mode == com::RX_ONLY) {
return;
}
if (isInTransition) {
performRecoveryToRxOnly = true;
return;
}
startRxOnlyRecovery(true);
break;
}
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) {
if ((mode == com::Submode::RX_AND_TX_DEFAULT_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
*/
void startRxAndTxLowRateSeq();
void startRxOnlyRecovery(bool forced);
/**
* @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;
bool enableTxWhenCarrierLock = false;
bool performRecoveryToRxOnly = false;
// Countdown will be started as soon as the transmitter was enabled
Countdown transmitterCountdown;