Skip to content

Commit

Permalink
[LoRaWAN] Small bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenCellist committed Mar 18, 2024
1 parent 9a00b68 commit e97826f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/protocols/LoRaWAN/LoRaWAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ int16_t LoRaWANNode::checkBufferCommon(uint8_t *buffer, uint16_t size) {
break;
}
}
if(i < size) {
if(i == size) {
return(RADIOLIB_ERR_NETWORK_NOT_JOINED);
}

// check integrity of the whole buffer (compare checksum to included checksum)
uint16_t checkSum = LoRaWANNode::checkSum16(buffer, size - 2);
uint16_t signature = LoRaWANNode::ntoh<uint16_t>(&buffer[size]);
uint16_t signature = LoRaWANNode::ntoh<uint16_t>(&buffer[size - 2]);
if(signature != checkSum) {
RADIOLIB_DEBUG_PROTOCOL_PRINTLN("Calculated checksum: %04X, expected: %04X", checkSum, signature);
return(RADIOLIB_ERR_CHECKSUM_MISMATCH);
Expand Down

0 comments on commit e97826f

Please sign in to comment.