From eb27ab4bb037981f20714318440baf16678353a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 28 Jun 2023 13:32:35 +0200 Subject: [PATCH] fix and optimization --- mission/com/CcsdsIpCoreHandler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mission/com/CcsdsIpCoreHandler.cpp b/mission/com/CcsdsIpCoreHandler.cpp index 766fd67c..78533165 100644 --- a/mission/com/CcsdsIpCoreHandler.cpp +++ b/mission/com/CcsdsIpCoreHandler.cpp @@ -246,7 +246,12 @@ ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submod void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) { triggerEvent(CHANGING_MODE, mode, submode); if (mode == HasModesIF::MODE_ON) { - if (this->submode != submode) { + // Check whether the rate actually changes. + if ((this->submode != submode) and + ((submode == static_cast(com::CcsdsSubmode::DATARATE_LOW) and + ptmeConfig.getRate() != RATE_100KBPS)) or + ((submode == static_cast(com::CcsdsSubmode::DATARATE_HIGH) and + ptmeConfig.getRate() != RATE_500KBPS))) { initPtmeUpdateAfterXCycles(); updateContext.enableTransmitAfterPtmeUpdate = true; updateContext.updateClockRate = true; @@ -255,7 +260,6 @@ void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) { updateContext.setModeAfterUpdate = true; return; } - if(ptmeConfig.setRate(bitRate)) // No rate change, so enable transmitter right away. enableTransmit(); } else if (mode == HasModesIF::MODE_OFF) {