pus version in config is constexpr now

This commit is contained in:
Robin Müller 2022-06-13 16:45:09 +02:00
parent 15d69e64f3
commit eb46f0c473
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 7 additions and 3 deletions

View File

@ -27,7 +27,7 @@ ReturnValue_t TcPacketSerializer::initialize() {
return result;
}
initializeTcPacket(cfg.apid, cfg.sequenceCount, cfg.ack, cfg.service, cfg.subservice,
cfg.pusVersion, cfg.sourceId);
PusConfig::PUS_VERSION, cfg.sourceId);
if (cfg.appData != nullptr and cfg.appDataLen > 0) {
std::memcpy(&tcData->appData, cfg.appData, cfg.appDataLen);
}

View File

@ -14,13 +14,17 @@ struct PusConfig {
uint16_t sourceId = 0;
uint8_t* appData = nullptr;
size_t appDataLen = 0;
pus::PusVersion pusVersion = pus::PusVersion::PUS_C_VERSION;
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
static constexpr pus::PusVersion PUS_VERSION = pus::PusVersion::PUS_C_VERSION;
#else
static constexpr pus::PusVersion PUS_VERSION = pus::PusVersion::PUS_A_VERSION;
#endif
uint8_t ack = TcPacketPus::ACK_ALL;
};
class TcPacketSerializer : public TcPacketPus, public SerializeIF, public HasReturnvaluesIF {
public:
TcPacketSerializer(uint8_t* data, size_t size, PusConfig& cfg);
TcPacketSerializer(uint8_t* store, size_t maxSize, PusConfig& cfg);
ReturnValue_t initialize();