From 542aa994b712c7c2cfaea36f8c14194a4a773f50 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Wed, 24 Nov 2021 15:55:25 +0100 Subject: [PATCH] link state now detected by bit and carrier lock flags --- bsp_q7s/core/InitMission.cpp | 2 +- bsp_q7s/core/ObjectFactory.cpp | 4 ++-- linux/fsfwconfig/OBSWConfig.h.in | 5 +++-- mission/tmtc/CCSDSHandler.cpp | 10 +++++----- mission/tmtc/CCSDSHandler.h | 8 ++++++-- mission/tmtc/VirtualChannel.cpp | 4 ++-- mission/tmtc/VirtualChannel.h | 6 +----- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/bsp_q7s/core/InitMission.cpp b/bsp_q7s/core/InitMission.cpp index bd70c1c0..7923a2cd 100644 --- a/bsp_q7s/core/InitMission.cpp +++ b/bsp_q7s/core/InitMission.cpp @@ -110,7 +110,7 @@ void initmission::initTasks() { // If a command has not been read before the next one arrives, the old command will be // overwritten by the PDEC. PeriodicTaskIF* pdecHandlerTask = factory->createPeriodicTask( - "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1, missedDeadlineFunc); + "PDEC_HANDLER", 50, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc); result = pdecHandlerTask->addComponent(objects::PDEC_HANDLER); if(result != HasReturnvaluesIF::RETURN_OK) { initmission::printAddObjectError("PDEC Handler", objects::PDEC_HANDLER); diff --git a/bsp_q7s/core/ObjectFactory.cpp b/bsp_q7s/core/ObjectFactory.cpp index ec0c085f..bf8a2fba 100644 --- a/bsp_q7s/core/ObjectFactory.cpp +++ b/bsp_q7s/core/ObjectFactory.cpp @@ -981,10 +981,10 @@ void ObjectFactory::createCcsdsComponents(LinuxLibgpioIF *gpioComIF) { #if BOARD_TE0720 == 0 GpioCookie* gpioRS485Chip = new GpioCookie; gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_CLOCK, "RS485 Transceiver", - gpio::Direction::OUT, gpio::HIGH); + gpio::Direction::OUT, gpio::LOW); gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_CLOCK, gpio); gpio = new GpiodRegularByLineName(q7s::gpioNames::RS485_EN_TX_DATA, "RS485 Transceiver", - gpio::Direction::OUT, gpio::HIGH); + gpio::Direction::OUT, gpio::LOW); gpioRS485Chip->addGpio(gpioIds::RS485_EN_TX_DATA, gpio); // Default configuration enables RX channels (RXEN = LOW) diff --git a/linux/fsfwconfig/OBSWConfig.h.in b/linux/fsfwconfig/OBSWConfig.h.in index 3e3bf5c3..0ca7bae2 100644 --- a/linux/fsfwconfig/OBSWConfig.h.in +++ b/linux/fsfwconfig/OBSWConfig.h.in @@ -39,6 +39,8 @@ debugging. */ // Set to 1 if telecommands are received via the PDEC IP Core #define OBSW_TC_FROM_PDEC 1 +#define TMTC_TEST_SETUP 1 + #define OBSW_ENABLE_TIMERS 1 #define OBSW_ADD_STAR_TRACKER 0 #define OBSW_ADD_PLOC_SUPERVISOR 0 @@ -92,7 +94,6 @@ debugging. */ #define OBSW_TEST_TE7020_HEATER 0 #define OBSW_TEST_GPIO_OPEN_BY_LABEL 0 #define OBSW_TEST_GPIO_OPEN_BY_LINE_NAME 0 -#define OBSW_LINK_IS_UP 1 #define OBSW_DEBUG_P60DOCK 0 #define OBSW_DEBUG_PDU1 0 @@ -109,7 +110,7 @@ debugging. */ #define OBSW_DEBUG_STARTRACKER 0 #define OBSW_DEBUG_PLOC_MPSOC 0 #define OBSW_DEBUG_PLOC_SUPERVISOR 0 -#define OBSW_DEBUG_PDEC_HANDLER 0 +#define OBSW_DEBUG_PDEC_HANDLER 1 /*******************************************************************/ /** Hardcoded */ diff --git a/mission/tmtc/CCSDSHandler.cpp b/mission/tmtc/CCSDSHandler.cpp index a9c6df27..71307bd9 100644 --- a/mission/tmtc/CCSDSHandler.cpp +++ b/mission/tmtc/CCSDSHandler.cpp @@ -1,4 +1,3 @@ -#include "OBSWConfig.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/serviceinterface/serviceInterfaceDefintions.h" #include "fsfw/objectmanager/ObjectManager.h" @@ -271,8 +270,8 @@ void CCSDSHandler::enableTransmit() { } transmitterCountdown.setTimeout(TRANSMITTER_TIMEOUT); #if BOARD_TE0720 == 0 - gpioIF->pullLow(enTxClock); - gpioIF->pullLow(enTxData); + gpioIF->pullHigh(enTxClock); + gpioIF->pullHigh(enTxData); #endif /* BOARD_TE0720 == 0 */ linkState = UP; // Set link state of all virtual channels to link up @@ -290,9 +289,10 @@ void CCSDSHandler::checkTxTimer() { void CCSDSHandler::disableTransmit() { #if BOARD_TE0720 == 0 - gpioIF->pullHigh(enTxClock); - gpioIF->pullHigh(enTxData); + gpioIF->pullLow(enTxClock); + gpioIF->pullLow(enTxData); #endif /* BOARD_TE0720 == 0 */ linkState = DOWN; forwardLinkstate(); + transmitterCountdown.setTimeout(0); } diff --git a/mission/tmtc/CCSDSHandler.h b/mission/tmtc/CCSDSHandler.h index cdab72e0..6fb6168b 100644 --- a/mission/tmtc/CCSDSHandler.h +++ b/mission/tmtc/CCSDSHandler.h @@ -89,9 +89,13 @@ private: //! [EXPORT] : [COMMENT] Received action message with unknown action id static const ReturnValue_t COMMAND_NOT_IMPLEMENTED = MAKE_RETURN_CODE(0xA0); +#if TMTC_TEST_SETUP == 0 // syrlinks must not be transmitting more than 15 minutes (according to datasheet) -// static const uint32_t TRANSMITTER_TIMEOUT = 900000; //900000 ms = 15 min - static const uint32_t TRANSMITTER_TIMEOUT = 10000; //900000 ms = 15 min + static const uint32_t TRANSMITTER_TIMEOUT = 900000; //900000 ms = 15 min +#else + // Set to high value when not sending via syrlinks + static const uint32_t TRANSMITTER_TIMEOUT = 86400000; // 1 day +#endif /* TMTC_TEST_SETUP == 0 */ static const bool UP = true; static const bool DOWN = false; diff --git a/mission/tmtc/VirtualChannel.cpp b/mission/tmtc/VirtualChannel.cpp index 3423692b..0273f5ce 100644 --- a/mission/tmtc/VirtualChannel.cpp +++ b/mission/tmtc/VirtualChannel.cpp @@ -64,6 +64,6 @@ void VirtualChannel::setPtmeObject(PtmeIF* ptme_) { ptme = ptme_; } -void VirtualChannel::setLinkState(bool linkIsUp) { - linkIsUp = linkIsUp; +void VirtualChannel::setLinkState(bool linkIsUp_) { + linkIsUp = linkIsUp_; } diff --git a/mission/tmtc/VirtualChannel.h b/mission/tmtc/VirtualChannel.h index d7d95cb7..c6e2eb6d 100644 --- a/mission/tmtc/VirtualChannel.h +++ b/mission/tmtc/VirtualChannel.h @@ -38,7 +38,7 @@ class VirtualChannel: public AcceptsTelemetryIF, public HasReturnvaluesIF { * @brief Can be used by the owner to set the link state. Packets will be discarded if link * to ground station is down. */ - void setLinkState(bool linkIsUp); + void setLinkState(bool linkIsUp_); private: @@ -46,11 +46,7 @@ private: MessageQueueIF* tmQueue = nullptr; uint8_t vcId; -#if OBSW_LINK_IS_UP == 1 - bool linkIsUp = true; -#else bool linkIsUp = false; -#endif /* OBSW_LINK_IS_UP == 1 */ StorageManagerIF* tmStore = nullptr; };