hopefully last bugfix
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2022-08-21 01:38:45 +02:00
parent 47ebf3d8cc
commit b503836a3d
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
4 changed files with 36 additions and 35 deletions

View File

@ -1829,20 +1829,13 @@ class UpdateStatusReport : public ploc::SpTmReader {
return result;
}
const uint8_t* dataFieldPtr = getFullData() + ccsds::HEADER_LEN;
size_t size = sizeof(memoryId);
SerializeAdapter::deSerialize(&memoryId, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(n);
SerializeAdapter::deSerialize(&n, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(startAddress);
SerializeAdapter::deSerialize(&startAddress, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(length);
SerializeAdapter::deSerialize(&length, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
dataFieldPtr += size;
size = sizeof(crc);
SerializeAdapter::deSerialize(&crc, dataFieldPtr, &size, SerializeIF::Endianness::BIG);
size_t size = 12;
SerializeAdapter::deSerialize(&memoryId, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&n, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&startAddress, &dataFieldPtr, &size,
SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&length, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
SerializeAdapter::deSerialize(&crc, &dataFieldPtr, &size, SerializeIF::Endianness::BIG);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -555,32 +555,43 @@ ReturnValue_t PlocSupvHelper::handleCheckMemoryCommand() {
if (result != RETURN_OK) {
return result;
}
// Will hold status report for later processing
std::array<uint8_t, 32> statusReportBuf{};
{
supv::UpdateStatusReport updateStatusReport(tmBuf.data(), tmBuf.size());
result = handleTmReception(static_cast<size_t>(updateStatusReport.getNominalSize()),
supv::recv_timeout::UPDATE_STATUS_REPORT);
result = updateStatusReport.checkCrc();
if (result != RETURN_OK) {
sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl;
return result;
}
if (result != RETURN_OK) {
sif::warning
<< "PlocSupvHelper::handleCheckMemoryCommand: Failed to receive update status report"
<< std::endl;
return result;
}
result = updateStatusReport.checkCrc();
if (result != RETURN_OK) {
sif::warning << "PlocSupvHelper::handleTmReception: CRC check failed" << std::endl;
return result;
}
// We need to copy this into another buffer. Otherwise, it will be overwritten
// when reading the execution report.
std::memcpy(statusReportBuf.data(), tmBuf.data(), updateStatusReport.getNominalSize());
}
result = handleExe(CRC_EXECUTION_TIMEOUT);
if (result != RETURN_OK) {
return result;
}
result = updateStatusReport.parseDataField();
// Now process the status report
supv::UpdateStatusReport statusReportCopy(statusReportBuf.data(), statusReportBuf.size());
result = statusReportCopy.parseDataField();
if (result != RETURN_OK) {
return result;
}
result = updateStatusReport.verifycrc(update.crc);
result = statusReportCopy.verifycrc(update.crc);
if (result != RETURN_OK) {
sif::warning << "PlocSupvHelper::handleCheckMemoryCommand: CRC failure. Expected CRC 0x"
<< std::hex << update.crc << " but received CRC 0x" << updateStatusReport.getCrc()
<< std::hex << update.crc << " but received CRC 0x" << statusReportCopy.getCrc()
<< std::endl;
return result;
}

View File

@ -107,10 +107,7 @@ class SpTmReader : public SpacePacketReader {
uint16_t getPayloadDataLength() { return getPacketDataLen() - 2; }
ReturnValue_t checkCrc() {
const uint8_t* crcPtr = getFullData() + getFullPacketLen() - CRC_SIZE;
uint16_t receivedCrc = *(crcPtr) << 8 | *(crcPtr + 1);
uint16_t recalculatedCrc = CRC::crc16ccitt(getFullData(), getFullPacketLen() - CRC_SIZE);
if (recalculatedCrc != receivedCrc) {
if (CRC::crc16ccitt(getFullData(), getFullPacketLen()) != 0) {
return HasReturnvaluesIF::RETURN_FAILED;
}
return HasReturnvaluesIF::RETURN_OK;

2
tmtc

@ -1 +1 @@
Subproject commit 00e99292cc158a347f485507537fa5b63262243b
Subproject commit 9ed2593a54fecbea89dd812bbe87d4122a30bf83