ccsds handler sending command to enable transmitter
This commit is contained in:
@ -10,6 +10,8 @@
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include "fsfw/serviceinterface/serviceInterfaceDefintions.h"
|
||||
|
||||
#include "mission/devices/devicedefinitions/SyrlinksDefinitions.h"
|
||||
|
||||
CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t tcDestination,
|
||||
PtmeConfig* ptmeConfig, GpioIF* gpioIF, gpioId_t enTxClock,
|
||||
gpioId_t enTxData, uint32_t transmitterTimeout)
|
||||
@ -22,11 +24,14 @@ CCSDSHandler::CCSDSHandler(object_id_t objectId, object_id_t ptmeId, object_id_t
|
||||
gpioIF(gpioIF),
|
||||
enTxClock(enTxClock),
|
||||
enTxData(enTxData),
|
||||
transmitterTimeout(transmitterTimeout) {
|
||||
transmitterTimeout(transmitterTimeout),
|
||||
commandActionHelper(this) {
|
||||
commandQueue = QueueFactory::instance()->createMessageQueue(QUEUE_SIZE);
|
||||
auto mqArgs = MqArgs(objectId, static_cast<void*>(this));
|
||||
eventQueue =
|
||||
QueueFactory::instance()->createMessageQueue(10, EventMessage::EVENT_MESSAGE_SIZE, &mqArgs);
|
||||
commandActionHelperQueue =
|
||||
QueueFactory::instance()->createMessageQueue(EventMessage::EVENT_MESSAGE_SIZE * 5);
|
||||
}
|
||||
|
||||
CCSDSHandler::~CCSDSHandler() {}
|
||||
@ -120,6 +125,10 @@ ReturnValue_t CCSDSHandler::initialize() {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return ObjectManagerIF::CHILD_INIT_FAILED;
|
||||
}
|
||||
|
||||
#if OBSW_SYRLINKS_SIMULATED == 1
|
||||
ptmeConfig->invertTxClock(true);
|
||||
#endif /* OBSW_SYRLINKS_SIMULATED == 1*/
|
||||
@ -148,8 +157,73 @@ void CCSDSHandler::readCommandQueue(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::readCommandActionHelperQueue() {
|
||||
CommandMessage message;
|
||||
for (ReturnValue_t result = commandActionHelperQueue->receiveMessage(&message);
|
||||
result == RETURN_OK; result = commandActionHelperQueue->receiveMessage(&message)) {
|
||||
result = commandActionHelper.handleReply(&message);
|
||||
if (result == RETURN_OK) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageQueueId_t CCSDSHandler::getCommandQueue() const { return commandQueue->getId(); }
|
||||
|
||||
MessageQueueIF* CCSDSHandler::getCommandQueuePtr() { return commandActionHelperQueue; }
|
||||
|
||||
void CCSDSHandler::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) { return; }
|
||||
|
||||
void CCSDSHandler::stepFailedReceived(ActionId_t actionId, uint8_t step,
|
||||
ReturnValue_t returnCode) {
|
||||
switch (actionId) {
|
||||
case syrlinks::SET_TX_MODE_MODULATION: {
|
||||
sif::warning << "CCSDSHandler::stepFailedReceived: Failed to set enable transmitter"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "CCSDSHandler::stepFailedReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) {
|
||||
return;
|
||||
}
|
||||
|
||||
void CCSDSHandler::completionSuccessfulReceived(ActionId_t actionId) {
|
||||
switch (actionId) {
|
||||
case syrlinks::SET_TX_MODE_MODULATION: {
|
||||
triggerEvent(TRANSMITTER_ENABLED);
|
||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||
linkState = UP;
|
||||
// Set link state of all virtual channels to link up
|
||||
forwardLinkstate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "CCSDSHandler::completionSuccessfulReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) {
|
||||
switch (actionId) {
|
||||
case syrlinks::SET_TX_MODE_MODULATION: {
|
||||
sif::warning << "CCSDSHandler::completionFailedReceived: Failed to set enable transmitter"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "CCSDSHandler::completionFailedReceived: Received unexpected action reply"
|
||||
<< std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CCSDSHandler::addVirtualChannel(VcId_t vcId, VirtualChannel* virtualChannel) {
|
||||
if (vcId > common::NUMBER_OF_VIRTUAL_CHANNELS) {
|
||||
sif::warning << "CCSDSHandler::addVirtualChannel: Invalid virtual channel ID" << std::endl;
|
||||
@ -312,14 +386,10 @@ void CCSDSHandler::enableTransmit() {
|
||||
// Transmitter already enabled
|
||||
return;
|
||||
}
|
||||
transmitterCountdown.setTimeout(transmitterTimeout);
|
||||
#ifndef TE0720_1CFA
|
||||
gpioIF->pullHigh(enTxClock);
|
||||
gpioIF->pullHigh(enTxData);
|
||||
#endif /* BOARD_TE0720 == 0 */
|
||||
linkState = UP;
|
||||
// Set link state of all virtual channels to link up
|
||||
forwardLinkstate();
|
||||
}
|
||||
|
||||
void CCSDSHandler::checkTxTimer() {
|
||||
|
@ -17,6 +17,8 @@
|
||||
#include "fsfw/tmtcservices/AcceptsTelemetryIF.h"
|
||||
#include "fsfw_hal/common/gpio/GpioIF.h"
|
||||
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
|
||||
#include "fsfw/action/CommandActionHelper.h"
|
||||
#include "fsfw/action/CommandsActionsIF.h"
|
||||
#include "linux/obc/PtmeConfig.h"
|
||||
|
||||
/**
|
||||
@ -34,7 +36,8 @@ class CCSDSHandler : public SystemObject,
|
||||
public AcceptsTelecommandsIF,
|
||||
public HasReturnvaluesIF,
|
||||
public ReceivesParameterMessagesIF,
|
||||
public HasActionsIF {
|
||||
public HasActionsIF,
|
||||
public CommandsActionsIF {
|
||||
public:
|
||||
using VcId_t = uint8_t;
|
||||
|
||||
@ -79,8 +82,19 @@ class CCSDSHandler : public SystemObject,
|
||||
virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy,
|
||||
const uint8_t* data, size_t size);
|
||||
|
||||
MessageQueueIF* getCommandQueuePtr() override;
|
||||
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||
void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override;
|
||||
void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override;
|
||||
void completionSuccessfulReceived(ActionId_t actionId) override;
|
||||
void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override;
|
||||
|
||||
private:
|
||||
static const uint8_t INTERFACE_ID = CLASS_ID::CCSDS_HANDLER;
|
||||
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PLOC_MPSOC_HANDLER;
|
||||
|
||||
//! [EXPORT] : [COMMENT] Syrlinks transmitter is enabled
|
||||
static const Event TRANSMITTER_ENABLED = MAKE_EVENT(1, severity::LOW);
|
||||
|
||||
static const uint32_t QUEUE_SIZE = common::CCSDS_HANDLER_QUEUE_SIZE;
|
||||
|
||||
@ -120,6 +134,7 @@ class CCSDSHandler : public SystemObject,
|
||||
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
MessageQueueIF* eventQueue = nullptr;
|
||||
MessageQueueIF* commandActionHelperQueue = nullptr;
|
||||
|
||||
ParameterHelper parameterHelper;
|
||||
|
||||
@ -140,12 +155,15 @@ class CCSDSHandler : public SystemObject,
|
||||
// Countdown to disable transmitter after 15 minutes
|
||||
Countdown transmitterCountdown;
|
||||
|
||||
CommandActionHelper commandActionHelper;
|
||||
|
||||
// When true transmitting is started as soon as carrier lock has been detected
|
||||
bool enableTxWhenCarrierLock = false;
|
||||
|
||||
bool linkState = DOWN;
|
||||
|
||||
void readCommandQueue(void);
|
||||
void readCommandActionHelperQueue(void);
|
||||
void handleTelemetry();
|
||||
void handleTelecommands();
|
||||
void checkEvents();
|
||||
|
@ -1,6 +1,7 @@
|
||||
target_sources(${LIB_EIVE_MISSION} PRIVATE
|
||||
CCSDSHandler.cpp
|
||||
VirtualChannel.cpp
|
||||
TmFunnel.cpp
|
||||
)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user