simpler way to check crc16
This commit is contained in:
parent
ec47d7eeef
commit
ba56c72d91
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user