com subsystem complete
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
fd1c090141
commit
3137ebb86e
@ -573,7 +573,6 @@ void ObjectFactory::createSyrlinksComponents(PowerSwitchIF* pwrSwitcher) {
|
|||||||
new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
|
new SyrlinksHandler(objects::SYRLINKS_HANDLER, objects::UART_COM_IF, syrlinksUartCookie,
|
||||||
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
|
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
|
||||||
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
|
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
|
||||||
syrlinksHandler->setStartUpImmediately();
|
|
||||||
syrlinksHandler->connectModeTreeParent(satsystem::com::SUBSYSTEM);
|
syrlinksHandler->connectModeTreeParent(satsystem::com::SUBSYSTEM);
|
||||||
#if OBSW_DEBUG_SYRLINKS == 1
|
#if OBSW_DEBUG_SYRLINKS == 1
|
||||||
syrlinksHandler->setDebugMode(true);
|
syrlinksHandler->setDebugMode(true);
|
||||||
|
@ -165,6 +165,7 @@ ReturnValue_t PdecHandler::irqOperation() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
state = State::RUNNING;
|
state = State::RUNNING;
|
||||||
|
checkLocks();
|
||||||
break;
|
break;
|
||||||
case State::RUNNING: {
|
case State::RUNNING: {
|
||||||
nb = write(fd, &info, sizeof(info));
|
nb = write(fd, &info, sizeof(info));
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
#include <utility>
|
|
||||||
|
|
||||||
#include "ComSubsystem.h"
|
#include "ComSubsystem.h"
|
||||||
|
|
||||||
#include <fsfw/events/EventManagerIF.h>
|
#include <fsfw/events/EventManagerIF.h>
|
||||||
@ -7,14 +5,11 @@
|
|||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
#include <linux/ipcore/PdecHandler.h>
|
#include <linux/ipcore/PdecHandler.h>
|
||||||
|
#include <mission/comDefs.h>
|
||||||
#include <mission/config/comCfg.h>
|
#include <mission/config/comCfg.h>
|
||||||
|
|
||||||
extern std::pair<uint8_t, FixedArrayList<ModeListEntry, 3>> COM_SEQUENCE_RX_ONLY;
|
#include <utility>
|
||||||
//extern std::pair<uint32_t, FixedArrayList<ModeListEntry, 3>> COM_TABLE_RX_ONLY_TGT;
|
|
||||||
extern std::pair<uint8_t, FixedArrayList<ModeListEntry, 3>> COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE;
|
|
||||||
extern std::pair<uint32_t, FixedArrayList<ModeListEntry, 3>> COM_TABLE_RX_AND_TX_DEFAULT_RATE_TGT;
|
|
||||||
extern std::pair<uint8_t, FixedArrayList<ModeListEntry, 3>> COM_SEQUENCE_RX_AND_TX_LOW_RATE;
|
|
||||||
extern std::pair<uint8_t, FixedArrayList<ModeListEntry, 3>> COM_SEQUENCE_RX_AND_TX_HIGH_RATE;
|
|
||||||
|
|
||||||
ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
|
ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
|
||||||
uint32_t maxNumberOfTables, uint32_t transmitterTimeout)
|
uint32_t maxNumberOfTables, uint32_t transmitterTimeout)
|
||||||
@ -28,8 +23,13 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence
|
|||||||
|
|
||||||
void ComSubsystem::performChildOperation() {
|
void ComSubsystem::performChildOperation() {
|
||||||
readEventQueue();
|
readEventQueue();
|
||||||
|
// Execute default rate sequence after transition has been completed
|
||||||
|
if (rememberBitLock and not isInTransition) {
|
||||||
|
startRxAndTxLowRateSeq();
|
||||||
|
rememberBitLock = false;
|
||||||
|
}
|
||||||
if (countdownActive) {
|
if (countdownActive) {
|
||||||
checkTransmitterCountdown();
|
checkTransmitterCountdown();
|
||||||
}
|
}
|
||||||
Subsystem::performChildOperation();
|
Subsystem::performChildOperation();
|
||||||
}
|
}
|
||||||
@ -51,17 +51,17 @@ ReturnValue_t ComSubsystem::getParameter(uint8_t domainId, uint8_t uniqueIdentif
|
|||||||
parameterWrapper->set(datarateCfg);
|
parameterWrapper->set(datarateCfg);
|
||||||
com::setCurrentDatarate(static_cast<com::Datarate>(newVal));
|
com::setCurrentDatarate(static_cast<com::Datarate>(newVal));
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
} else if ((domainId == 0) and
|
||||||
else if ((domainId == 0) and (uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::TRANSMITTER_TIMEOUT))) {
|
(uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::TRANSMITTER_TIMEOUT))) {
|
||||||
uint8_t newVal = 0;
|
uint32_t newVal = 0;
|
||||||
ReturnValue_t result = newValues->getElement(&newVal);
|
ReturnValue_t result = newValues->getElement(&newVal);
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
parameterWrapper->set(transmitterTimeout);
|
parameterWrapper->set(transmitterTimeout);
|
||||||
transmitterTimeout = newVal;
|
transmitterTimeout = newVal;
|
||||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -79,46 +79,48 @@ ReturnValue_t ComSubsystem::initialize() {
|
|||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
EventManagerIF *manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||||
if (manager == nullptr) {
|
if (manager == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#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
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
result = manager->registerListener(eventQueue->getId());
|
result = manager->registerListener(eventQueue->getId());
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "ComSubsystem::initialize: Failed to register Com Subsystem as event "
|
sif::warning << "ComSubsystem::initialize: Failed to register Com Subsystem as event "
|
||||||
"listener" << std::endl;
|
"listener"
|
||||||
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||||
}
|
}
|
||||||
result = manager->subscribeToEventRange(eventQueue->getId(),
|
result = manager->subscribeToEventRange(eventQueue->getId(),
|
||||||
event::getEventId(PdecHandler::CARRIER_LOCK),
|
event::getEventId(PdecHandler::CARRIER_LOCK),
|
||||||
event::getEventId(PdecHandler::BIT_LOCK_PDEC));
|
event::getEventId(PdecHandler::BIT_LOCK_PDEC));
|
||||||
if (result != returnvalue::OK) {
|
if (result != returnvalue::OK) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::error << "ComSubsystem::initialize: Failed to subscribe to events from PDEC "
|
sif::error << "ComSubsystem::initialize: Failed to subscribe to events from PDEC "
|
||||||
"handler"
|
"handler"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return Subsystem::initialize();
|
return Subsystem::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) {
|
void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) {
|
||||||
// Depending on the submode the transmitter timeout is enabled or
|
// Depending on the submode the transmitter timeout is enabled or
|
||||||
// disabled here
|
// disabled here
|
||||||
if (mode == COM_SEQUENCE_RX_ONLY.first) {
|
if (mode == com::Submode::RX_ONLY) {
|
||||||
transmitterCountdown.timeOut();
|
transmitterCountdown.timeOut();
|
||||||
countdownActive = false;
|
countdownActive = false;
|
||||||
} else if ((mode == COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first) ||
|
} else if (isTxMode(mode)) {
|
||||||
(mode == COM_SEQUENCE_RX_AND_TX_LOW_RATE.first) ||
|
// Only start transmitter countdown if transmitter is not already on
|
||||||
(mode == COM_SEQUENCE_RX_AND_TX_HIGH_RATE.first)) {
|
if (not isTxMode(this->mode)) {
|
||||||
transmitterCountdown.resetTimer();
|
transmitterCountdown.resetTimer();
|
||||||
countdownActive = true;
|
countdownActive = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Subsystem::startTransition(mode, submode);
|
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() {
|
void ComSubsystem::handleCarrierLockEvent() {
|
||||||
if (!enableTxWhenCarrierLock) {
|
if (!enableTxWhenCarrierLock) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
startRxAndTxDefaultSeq();
|
startRxAndTxLowRateSeq();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComSubsystem::startRxAndTxDefaultSeq() {
|
void ComSubsystem::startRxAndTxLowRateSeq() {
|
||||||
// Turns transmitter on
|
// 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() {
|
void ComSubsystem::checkTransmitterCountdown() {
|
||||||
if (transmitterCountdown.hasTimedOut()) {
|
if (transmitterCountdown.hasTimedOut()) {
|
||||||
startTransition(COM_SEQUENCE_RX_ONLY.first, SUBMODE_NONE);
|
startTransition(com::Submode::RX_ONLY, SUBMODE_NONE);
|
||||||
countdownActive = false;
|
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;
|
||||||
|
}
|
||||||
|
@ -30,6 +30,9 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
|||||||
virtual void performChildOperation() override;
|
virtual void performChildOperation() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static const Mode_t INITIAL_MODE = 0;
|
||||||
|
|
||||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||||
|
|
||||||
ReturnValue_t initialize() override;
|
ReturnValue_t initialize() override;
|
||||||
@ -42,9 +45,14 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
|||||||
void handleCarrierLockEvent();
|
void handleCarrierLockEvent();
|
||||||
void checkTransmitterCountdown();
|
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<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
|
uint8_t datarateCfg = static_cast<uint8_t>(com::Datarate::LOW_RATE_MODULATION_BPSK);
|
||||||
// Maximum time after which the transmitter will be turned of. This is a
|
// 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:
|
// 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)
|
// rx and tx low rate, rx and tx high rate, rx and tx default rate)
|
||||||
bool countdownActive = false;
|
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_ */
|
#endif /* MISSION_SYSTEM_COMSUBSYSTEM_H_ */
|
||||||
|
@ -12,9 +12,7 @@ extern ComSubsystem SUBSYSTEM;
|
|||||||
// The syrlinks must not transmitting longer then 15 minutes otherwise the
|
// The syrlinks must not transmitting longer then 15 minutes otherwise the
|
||||||
// transceiver might be damaged due to overheating
|
// transceiver might be damaged due to overheating
|
||||||
// 15 minutes in milliseconds
|
// 15 minutes in milliseconds
|
||||||
//static const uint32_t TRANSMITTER_TIMEOUT = 900000;
|
static const uint32_t TRANSMITTER_TIMEOUT = 900000;
|
||||||
|
|
||||||
static const uint32_t TRANSMITTER_TIMEOUT = 60000;
|
|
||||||
|
|
||||||
Subsystem& init();
|
Subsystem& init();
|
||||||
} // namespace com
|
} // namespace com
|
||||||
|
Loading…
Reference in New Issue
Block a user