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,
|
||||
pcdu::PDU1_CH1_SYRLINKS_12V, syrlinksFdir);
|
||||
syrlinksHandler->setPowerSwitcher(pwrSwitcher);
|
||||
syrlinksHandler->setStartUpImmediately();
|
||||
syrlinksHandler->connectModeTreeParent(satsystem::com::SUBSYSTEM);
|
||||
#if OBSW_DEBUG_SYRLINKS == 1
|
||||
syrlinksHandler->setDebugMode(true);
|
||||
|
@ -165,6 +165,7 @@ ReturnValue_t PdecHandler::irqOperation() {
|
||||
return result;
|
||||
}
|
||||
state = State::RUNNING;
|
||||
checkLocks();
|
||||
break;
|
||||
case State::RUNNING: {
|
||||
nb = write(fd, &info, sizeof(info));
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include <utility>
|
||||
|
||||
#include "ComSubsystem.h"
|
||||
|
||||
#include <fsfw/events/EventManagerIF.h>
|
||||
@ -7,14 +5,11 @@
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||
#include <linux/ipcore/PdecHandler.h>
|
||||
#include <mission/comDefs.h>
|
||||
#include <mission/config/comCfg.h>
|
||||
|
||||
extern std::pair<uint8_t, FixedArrayList<ModeListEntry, 3>> COM_SEQUENCE_RX_ONLY;
|
||||
//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;
|
||||
#include <utility>
|
||||
|
||||
|
||||
ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequences,
|
||||
uint32_t maxNumberOfTables, uint32_t transmitterTimeout)
|
||||
@ -28,6 +23,11 @@ ComSubsystem::ComSubsystem(object_id_t setObjectId, uint32_t maxNumberOfSequence
|
||||
|
||||
void ComSubsystem::performChildOperation() {
|
||||
readEventQueue();
|
||||
// Execute default rate sequence after transition has been completed
|
||||
if (rememberBitLock and not isInTransition) {
|
||||
startRxAndTxLowRateSeq();
|
||||
rememberBitLock = false;
|
||||
}
|
||||
if (countdownActive) {
|
||||
checkTransmitterCountdown();
|
||||
}
|
||||
@ -51,9 +51,9 @@ ReturnValue_t ComSubsystem::getParameter(uint8_t domainId, uint8_t uniqueIdentif
|
||||
parameterWrapper->set(datarateCfg);
|
||||
com::setCurrentDatarate(static_cast<com::Datarate>(newVal));
|
||||
return returnvalue::OK;
|
||||
}
|
||||
else if ((domainId == 0) and (uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::TRANSMITTER_TIMEOUT))) {
|
||||
uint8_t newVal = 0;
|
||||
} else if ((domainId == 0) and
|
||||
(uniqueIdentifier == static_cast<uint8_t>(com::ParameterId::TRANSMITTER_TIMEOUT))) {
|
||||
uint32_t newVal = 0;
|
||||
ReturnValue_t result = newValues->getElement(&newVal);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
@ -90,7 +90,8 @@ ReturnValue_t ComSubsystem::initialize() {
|
||||
if (result != returnvalue::OK) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "ComSubsystem::initialize: Failed to register Com Subsystem as event "
|
||||
"listener" << std::endl;
|
||||
"listener"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
@ -111,15 +112,16 @@ ReturnValue_t ComSubsystem::initialize() {
|
||||
void ComSubsystem::startTransition(Mode_t mode, Submode_t submode) {
|
||||
// Depending on the submode the transmitter timeout is enabled or
|
||||
// disabled here
|
||||
if (mode == COM_SEQUENCE_RX_ONLY.first) {
|
||||
if (mode == com::Submode::RX_ONLY) {
|
||||
transmitterCountdown.timeOut();
|
||||
countdownActive = false;
|
||||
} else if ((mode == COM_SEQUENCE_RX_AND_TX_DEFAULT_RATE.first) ||
|
||||
(mode == COM_SEQUENCE_RX_AND_TX_LOW_RATE.first) ||
|
||||
(mode == COM_SEQUENCE_RX_AND_TX_HIGH_RATE.first)) {
|
||||
} else if (isTxMode(mode)) {
|
||||
// Only start transmitter countdown if transmitter is not already on
|
||||
if (not isTxMode(this->mode)) {
|
||||
transmitterCountdown.resetTimer();
|
||||
countdownActive = true;
|
||||
}
|
||||
}
|
||||
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() {
|
||||
if (!enableTxWhenCarrierLock) {
|
||||
return;
|
||||
}
|
||||
startRxAndTxDefaultSeq();
|
||||
startRxAndTxLowRateSeq();
|
||||
}
|
||||
|
||||
void ComSubsystem::startRxAndTxDefaultSeq() {
|
||||
void ComSubsystem::startRxAndTxLowRateSeq() {
|
||||
// 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() {
|
||||
if (transmitterCountdown.hasTimedOut()) {
|
||||
startTransition(COM_SEQUENCE_RX_ONLY.first, SUBMODE_NONE);
|
||||
startTransition(com::Submode::RX_ONLY, SUBMODE_NONE);
|
||||
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;
|
||||
|
||||
private:
|
||||
|
||||
static const Mode_t INITIAL_MODE = 0;
|
||||
|
||||
ReturnValue_t handleCommandMessage(CommandMessage *message) override;
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
@ -42,9 +45,14 @@ class ComSubsystem : public Subsystem, public ReceivesParameterMessagesIF {
|
||||
void handleCarrierLockEvent();
|
||||
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);
|
||||
// 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:
|
||||
// rx and tx low rate, rx and tx high rate, rx and tx default rate)
|
||||
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_ */
|
||||
|
@ -12,9 +12,7 @@ extern ComSubsystem SUBSYSTEM;
|
||||
// The syrlinks must not transmitting longer then 15 minutes otherwise the
|
||||
// transceiver might be damaged due to overheating
|
||||
// 15 minutes in milliseconds
|
||||
//static const uint32_t TRANSMITTER_TIMEOUT = 900000;
|
||||
|
||||
static const uint32_t TRANSMITTER_TIMEOUT = 60000;
|
||||
static const uint32_t TRANSMITTER_TIMEOUT = 900000;
|
||||
|
||||
Subsystem& init();
|
||||
} // namespace com
|
||||
|
Loading…
Reference in New Issue
Block a user