Update xsns_53_sml.ino

Maximum bytes count for binary modbus CRC calculation in relation to SML_BSIZ value
This commit is contained in:
mnowa 2022-12-12 16:13:04 +01:00 committed by GitHub
parent 630987302a
commit 370debc0e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -2376,7 +2376,7 @@ void SML_Decode(uint8_t index) {
mp++;
} else {
uint16_t pos = smltbuf[mindex][2] + 3;
if (pos > 32) pos = 32;
if (pos > (SML_BSIZ-2)) pos = SML_BSIZ-2;
uint16_t crc = MBUS_calculateCRC(&smltbuf[mindex][0], pos, 0xFFFF);
if (lowByte(crc) != smltbuf[mindex][pos]) goto nextsect;
if (highByte(crc) != smltbuf[mindex][pos + 1]) goto nextsect;