Merge pull request 'Add CCSDS handler modes' (#352) from add_ccsds_handler_modes into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #352
This commit is contained in:
Robin Müller 2023-01-26 17:04:07 +01:00
commit ecc5ec05f3
5 changed files with 89 additions and 7 deletions

View File

@ -10,14 +10,21 @@ list yields a list of all related PRs for each release.
# [unreleased]
## Added
## Fixed
- The `OBSW_SYRLINKS_SIMULATED` flag is set to 0 for for both EM and FM.
- MGM4 handling in ACS sensor processing: Bugfix in `mulScalar` operation
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/354
## Changed
- Startracker temperature set and PCDU switcher set are diagnostic now
## Fixed
## Added
- MGM4 handling in ACS sensor processing: Bugfix in `mulScalar` operation
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/354
- The CCSDS handler can accept mode commands now. It accepts ON and OFF commands. Furthermore
it has a submode for low datarate (1) and high datarate (2) for the ON command.
PR: https://egit.irs.uni-stuttgart.de/eive/eive-obsw/pulls/352
# [v1.20.0] 2023-01-24

View File

@ -150,7 +150,7 @@ set(OBSW_ADD_SCEX_DEVICE
${INIT_VAL}
CACHE STRING "Add Solar Cell Experiment module")
set(OBSW_SYRLINKS_SIMULATED
${OBSW_Q7S_EM}
0
CACHE STRING "Syrlinks is simulated")
# ##############################################################################

View File

@ -21,6 +21,7 @@ CcsdsIpCoreHandler::CcsdsIpCoreHandler(object_id_t objectId, object_id_t ptmeId,
tcDestination(tcDestination),
parameterHelper(this),
actionHelper(this, nullptr),
modeHelper(this),
ptmeConfig(ptmeConfig),
gpioIF(gpioIF),
enTxClock(enTxClock),
@ -81,6 +82,11 @@ ReturnValue_t CcsdsIpCoreHandler::initialize() {
return result;
}
result = modeHelper.initialize();
if (result != returnvalue::OK) {
return result;
}
VirtualChannelMapIter iter;
for (iter = virtualChannelMap.begin(); iter != virtualChannelMap.end(); iter++) {
result = iter->second->initialize();
@ -152,6 +158,10 @@ void CcsdsIpCoreHandler::readCommandQueue(void) {
if (result == returnvalue::OK) {
return;
}
result = modeHelper.handleModeCommand(&commandMessage);
if (result == returnvalue::OK) {
return;
}
CommandMessage reply;
reply.setReplyRejected(CommandMessage::UNKNOWN_COMMAND, commandMessage.getCommand());
commandQueue->reply(&reply);
@ -218,10 +228,12 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
ReturnValue_t result = returnvalue::OK;
switch (actionId) {
case SET_LOW_RATE: {
submode = static_cast<Submode_t>(Submode::DATARATE_LOW);
result = ptmeConfig->setRate(RATE_100KBPS);
break;
}
case SET_HIGH_RATE: {
submode = static_cast<Submode_t>(Submode::DATARATE_HIGH);
result = ptmeConfig->setRate(RATE_500KBPS);
break;
}
@ -233,10 +245,16 @@ ReturnValue_t CcsdsIpCoreHandler::executeAction(ActionId_t actionId, MessageQueu
}
case EN_TRANSMITTER: {
enableTransmit();
if (mode == HasModesIF::MODE_OFF) {
mode = HasModesIF::MODE_ON;
}
return EXECUTION_FINISHED;
}
case DISABLE_TRANSMITTER: {
disableTransmit();
if (mode == HasModesIF::MODE_ON) {
mode = HasModesIF::MODE_OFF;
}
return EXECUTION_FINISHED;
}
case ENABLE_TX_CLK_MANIPULATOR: {
@ -339,6 +357,48 @@ void CcsdsIpCoreHandler::checkTxTimer() {
}
}
void CcsdsIpCoreHandler::getMode(Mode_t* mode, Submode_t* submode) {
*mode = this->mode;
*submode = this->submode;
}
ReturnValue_t CcsdsIpCoreHandler::checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) {
if (mode == HasModesIF::MODE_ON) {
if (submode != static_cast<Submode_t>(Submode::DATARATE_HIGH) and
submode != static_cast<Submode_t>(Submode::DATARATE_LOW)) {
return HasModesIF::INVALID_SUBMODE;
}
} else if (mode != HasModesIF::MODE_OFF) {
return returnvalue::FAILED;
}
*msToReachTheMode = 2000;
return returnvalue::OK;
}
void CcsdsIpCoreHandler::startTransition(Mode_t mode, Submode_t submode) {
if (mode == HasModesIF::MODE_ON) {
enableTransmit();
if (submode == static_cast<Submode_t>(Submode::DATARATE_HIGH)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_500KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
}
} else if (submode == static_cast<Submode_t>(Submode::DATARATE_LOW)) {
ReturnValue_t result = ptmeConfig->setRate(RATE_100KBPS);
if (result == returnvalue::OK) {
mode = HasModesIF::MODE_ON;
}
}
} else if (mode == HasModesIF::MODE_OFF) {
disableTransmit();
mode = HasModesIF::MODE_OFF;
}
modeHelper.modeChanged(mode, submode);
}
void CcsdsIpCoreHandler::announceMode(bool recursive) { triggerEvent(MODE_INFO, mode, submode); }
void CcsdsIpCoreHandler::disableTransmit() {
#ifndef TE0720_1CFA
gpioIF->pullLow(enTxClock);

View File

@ -1,6 +1,8 @@
#ifndef CCSDSHANDLER_H_
#define CCSDSHANDLER_H_
#include <fsfw/modes/HasModesIF.h>
#include <cstdint>
#include <unordered_map>
@ -21,6 +23,8 @@
#include "fsfw_hal/common/gpio/gpioDefinitions.h"
#include "linux/ipcore/PtmeConfig.h"
enum class Submode : uint8_t { UNSET = 0, DATARATE_LOW = 1, DATARATE_HIGH = 2 };
/**
* @brief This class handles the data exchange with the CCSDS IP cores implemented in the
* programmable logic of the Q7S.
@ -32,6 +36,7 @@
*/
class CcsdsIpCoreHandler : public SystemObject,
public ExecutableObjectIF,
public HasModesIF,
public AcceptsTelemetryIF,
public AcceptsTelecommandsIF,
public ReceivesParameterMessagesIF,
@ -59,7 +64,14 @@ class CcsdsIpCoreHandler : public SystemObject,
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t initialize();
MessageQueueId_t getCommandQueue() const;
MessageQueueId_t getCommandQueue() const override;
// ModesIF
void getMode(Mode_t* mode, Submode_t* submode) override;
ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
uint32_t* msToReachTheMode) override;
void startTransition(Mode_t mode, Submode_t submode) override;
void announceMode(bool recursive) override;
/**
* @brief Function to add a virtual channel
@ -126,6 +138,9 @@ class CcsdsIpCoreHandler : public SystemObject,
ParameterHelper parameterHelper;
ActionHelper actionHelper;
Mode_t mode = HasModesIF::MODE_OFF;
Submode_t submode = static_cast<Submode_t>(Submode::UNSET);
ModeHelper modeHelper;
MessageQueueId_t tcDistributorQueueId = MessageQueueIF::NO_QUEUE;

2
tmtc

@ -1 +1 @@
Subproject commit 49f27c9923cfa13a3bafce46c37dd2631550f4af
Subproject commit c36c7ca5bbe12b74f096414383eedfc16576a9d2