using correct version number now
This commit is contained in:
parent
ab906fa534
commit
ae689408f3
@ -31,8 +31,6 @@ public:
|
|||||||
//! Maximum size of a TM Packet in this mission.
|
//! Maximum size of a TM Packet in this mission.
|
||||||
//! TODO: Make this dependant on a config variable.
|
//! TODO: Make this dependant on a config variable.
|
||||||
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048;
|
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.
|
* This is the default constructor.
|
||||||
|
@ -62,12 +62,7 @@ void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service,
|
|||||||
//First, set to zero.
|
//First, set to zero.
|
||||||
memset(&tmData->data_field, 0, sizeof(tmData->data_field));
|
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.
|
tmData->data_field.version_type_ack = TM_PUS_VERSION_NUMBER << 4;
|
||||||
// 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.service_type = service;
|
tmData->data_field.service_type = service;
|
||||||
tmData->data_field.service_subtype = subservice;
|
tmData->data_field.service_subtype = subservice;
|
||||||
tmData->data_field.subcounter = packetSubcounter;
|
tmData->data_field.subcounter = packetSubcounter;
|
||||||
|
@ -52,6 +52,9 @@ public:
|
|||||||
sizeof(PUSTmDataFieldHeaderPusA) + 2);
|
sizeof(PUSTmDataFieldHeaderPusA) + 2);
|
||||||
//! Maximum size of a TM Packet in this mission.
|
//! Maximum size of a TM Packet in this mission.
|
||||||
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE;
|
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.
|
* This is the default constructor.
|
||||||
|
@ -64,7 +64,7 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service,
|
|||||||
|
|
||||||
/* Only account for last 4 bytes for time reference field */
|
/* Only account for last 4 bytes for time reference field */
|
||||||
timeRefField &= 0b1111;
|
timeRefField &= 0b1111;
|
||||||
tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField;
|
tmData->dataField.versionTimeReferenceField = (TM_PUS_VERSION_NUMBER << 4) | timeRefField;
|
||||||
tmData->dataField.serviceType = service;
|
tmData->dataField.serviceType = service;
|
||||||
tmData->dataField.serviceSubtype = subservice;
|
tmData->dataField.serviceSubtype = subservice;
|
||||||
tmData->dataField.subcounterMsb = packetSubcounter << 8 & 0xff;
|
tmData->dataField.subcounterMsb = packetSubcounter << 8 & 0xff;
|
||||||
|
@ -54,6 +54,9 @@ public:
|
|||||||
sizeof(PUSTmDataFieldHeaderPusC) + 2);
|
sizeof(PUSTmDataFieldHeaderPusC) + 2);
|
||||||
//! Maximum size of a TM Packet in this mission.
|
//! Maximum size of a TM Packet in this mission.
|
||||||
static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE;
|
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.
|
* This is the default constructor.
|
||||||
|
@ -29,8 +29,7 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service,
|
|||||||
initializeTmPacket(apid, service, subservice, packetSubcounter);
|
initializeTmPacket(apid, service, subservice, packetSubcounter);
|
||||||
memcpy(getSourceData(), headerData, headerSize);
|
memcpy(getSourceData(), headerData, headerSize);
|
||||||
memcpy(getSourceData() + headerSize, data, size);
|
memcpy(getSourceData() + headerSize, data, size);
|
||||||
setPacketDataLength(
|
setPacketDataLength(size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1);
|
||||||
size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service,
|
TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service,
|
||||||
|
@ -30,8 +30,7 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,
|
|||||||
initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField);
|
initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField);
|
||||||
memcpy(getSourceData(), headerData, headerSize);
|
memcpy(getSourceData(), headerData, headerSize);
|
||||||
memcpy(getSourceData() + headerSize, data, size);
|
memcpy(getSourceData() + headerSize, data, size);
|
||||||
setPacketDataLength(
|
setPacketDataLength(size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1);
|
||||||
size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,
|
TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service,
|
||||||
|
Loading…
Reference in New Issue
Block a user