fixes for pus tc c

This commit is contained in:
Robin Müller 2021-06-14 11:44:39 +02:00
parent b1e3a1b2b5
commit 7cf4aa0d5a
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
3 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,7 @@ ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) {
if (not currentPacket->isSizeCorrect()) {
return INCOMPLETE_PACKET;
}
condition = (tcPacketBase->getSecondaryHeaderFlag() != CCSDS_SECONDARY_HEADER_FLAG) ||
(tcPacketBase->getPusVersionNumber() != PUS_VERSION_NUMBER);
if (condition) {

View File

@ -1,6 +1,7 @@
#ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_
#define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_
#include "../FSFW.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../tmtcservices/PusVerificationReport.h"
@ -24,7 +25,12 @@ protected:
/**
* Describes the TC Packet PUS Version Number a packet must have to pass.
*/
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
static constexpr uint8_t PUS_VERSION_NUMBER = 2;
#else
static constexpr uint8_t PUS_VERSION_NUMBER = 1;
#endif
/**
* The packet id each correct packet should have.
* It is composed of the APID and some static fields.

View File

@ -62,11 +62,20 @@ void TcPacketPus::setData(const uint8_t* pData) {
}
uint8_t TcPacketPus::getSecondaryHeaderFlag() const {
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
// Does not exist for PUS C
return 0;
#else
return (tcData->dataField.versionTypeAck & 0b10000000) >> 7;
#endif
}
uint8_t TcPacketPus::getPusVersionNumber() const {
#if FSFW_USE_PUS_C_TELECOMMANDS == 1
return (tcData->dataField.versionTypeAck & 0b11110000) >> 4;
#else
return (tcData->dataField.versionTypeAck & 0b01110000) >> 4;
#endif
}
uint16_t TcPacketPus::getSourceId() const {