simpler way to check crc16

This commit is contained in:
Robin Müller 2022-08-18 15:34:26 +02:00
parent ec47d7eeef
commit ba56c72d91
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
1 changed files with 1 additions and 3 deletions

View File

@ -893,9 +893,7 @@ void PlocSupervisorHandler::setExecutionTimeout(DeviceCommandId_t command) {
}
ReturnValue_t PlocSupervisorHandler::verifyPacket(const uint8_t* start, size_t foundLen) {
uint16_t receivedCrc = *(start + foundLen - 2) << 8 | *(start + foundLen - 1);
uint16_t recalculatedCrc = CRC::crc16ccitt(start, foundLen - 2);
if (receivedCrc != recalculatedCrc) {
if (CRC::crc16ccitt(start, foundLen) != 0) {
return SupvReturnValuesIF::CRC_FAILURE;
}
return RETURN_OK;