using correct version number now

This commit is contained in:
Robin Müller 2021-10-05 01:23:56 +02:00 committed by Robin Mueller
parent ab906fa534
commit ae689408f3
7 changed files with 10 additions and 13 deletions

View File

@ -31,8 +31,6 @@ public:
//! Maximum size of a TM Packet in this mission.
//! TODO: Make this dependant on a config variable.
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048;
//! First four bits of first byte of secondary header
static const uint8_t VERSION_NUMBER_BYTE = 0b00010000;
/**
* This is the default constructor.

View File

@ -62,12 +62,7 @@ void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service,
//First, set to zero.
memset(&tmData->data_field, 0, sizeof(tmData->data_field));
// NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits.
// The other 4 bits of the first byte are the spacecraft time reference
// status. To change to PUS-C, set 0b00100000.
// Set CCSDS_secondary header flag to 0, version number to 001 and ack
// to 0000
tmData->data_field.version_type_ack = 0b00010000;
tmData->data_field.version_type_ack = TM_PUS_VERSION_NUMBER << 4;
tmData->data_field.service_type = service;
tmData->data_field.service_subtype = subservice;
tmData->data_field.subcounter = packetSubcounter;

View File

@ -52,6 +52,9 @@ public:
sizeof(PUSTmDataFieldHeaderPusA) + 2);
//! Maximum size of a TM Packet in this mission.
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE;
//! First four bits of first byte of secondary header. Set to 1 according
//! to ECSS-E-ST-70-41C p.439
static constexpr uint8_t TM_PUS_VERSION_NUMBER = 1;
/**
* This is the default constructor.

View File

@ -64,7 +64,7 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service,
/* Only account for last 4 bytes for time reference field */
timeRefField &= 0b1111;
tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField;
tmData->dataField.versionTimeReferenceField = (TM_PUS_VERSION_NUMBER << 4) | timeRefField;
tmData->dataField.serviceType = service;
tmData->dataField.serviceSubtype = subservice;
tmData->dataField.subcounterMsb = packetSubcounter << 8 & 0xff;

View File

@ -54,6 +54,9 @@ public:
sizeof(PUSTmDataFieldHeaderPusC) + 2);
//! Maximum size of a TM Packet in this mission.
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE;
//! First four bits of first byte of secondary header. Set to 2 according
//! to ECSS-E-ST-70-41C p.439
static constexpr uint8_t TM_PUS_VERSION_NUMBER = 2;
/**
* This is the default constructor.

View File

@ -29,8 +29,7 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service,
initializeTmPacket(apid, service, subservice, packetSubcounter);
memcpy(getSourceData(), headerData, headerSize);
memcpy(getSourceData() + headerSize, data, size);
setPacketDataLength(
size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1);
setPacketDataLength(size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1);
}
TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service,

View File

@ -30,8 +30,7 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,
initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField);
memcpy(getSourceData(), headerData, headerSize);
memcpy(getSourceData() + headerSize, data, size);
setPacketDataLength(
size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1);
setPacketDataLength(size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1);
}
TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,