From ba56c72d91481cd4d9f6102dff682baaddc19594 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 18 Aug 2022 15:34:26 +0200 Subject: [PATCH] simpler way to check crc16 --- linux/devices/ploc/PlocSupervisorHandler.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/linux/devices/ploc/PlocSupervisorHandler.cpp b/linux/devices/ploc/PlocSupervisorHandler.cpp index fbbcf3c4..1f588299 100644 --- a/linux/devices/ploc/PlocSupervisorHandler.cpp +++ b/linux/devices/ploc/PlocSupervisorHandler.cpp @@ -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;