move CRC check
This commit is contained in:
parent
cc3e64e70d
commit
dfe7c378da
@ -57,6 +57,13 @@ ReturnValue_t PusTmReader::parseData(bool crcCheck) {
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
if (crcCheck) {
|
||||
uint16_t crc16 = CRC::crc16ccitt(spReader.getFullData(), getFullPacketLen());
|
||||
if (crc16 != 0) {
|
||||
// Checksum failure
|
||||
return PusIF::INVALID_CRC_16;
|
||||
}
|
||||
}
|
||||
size_t currentOffset = SpacePacketReader::getHeaderLen();
|
||||
pointers.secHeaderStart = pointers.spHeaderStart + currentOffset;
|
||||
currentOffset += PusTmIF::MIN_SEC_HEADER_LEN;
|
||||
@ -77,13 +84,6 @@ ReturnValue_t PusTmReader::parseData(bool crcCheck) {
|
||||
}
|
||||
currentOffset += sourceDataLen;
|
||||
pointers.crcStart = pointers.spHeaderStart + currentOffset;
|
||||
if (crcCheck) {
|
||||
uint16_t crc16 = CRC::crc16ccitt(spReader.getFullData(), getFullPacketLen());
|
||||
if (crc16 != 0) {
|
||||
// Checksum failure
|
||||
return PusIF::INVALID_CRC_16;
|
||||
}
|
||||
}
|
||||
return returnvalue::OK;
|
||||
}
|
||||
bool PusTmReader::isNull() const { return spReader.isNull() or pointers.secHeaderStart == nullptr; }
|
||||
|
Loading…
Reference in New Issue
Block a user