Merge pull request #17366 from mnowa/development

Update xsns_53_sml.ino to use maximum bytes count for binary modbus CRC calculation in relation to SML_BSIZ value
This commit is contained in:
Theo Arends 2022-12-12 17:54:32 +01:00 committed by GitHub
commit 9898cb0bed
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++; mp++;
} else { } else {
uint16_t pos = smltbuf[mindex][2] + 3; 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); uint16_t crc = MBUS_calculateCRC(&smltbuf[mindex][0], pos, 0xFFFF);
if (lowByte(crc) != smltbuf[mindex][pos]) goto nextsect; if (lowByte(crc) != smltbuf[mindex][pos]) goto nextsect;
if (highByte(crc) != smltbuf[mindex][pos + 1]) goto nextsect; if (highByte(crc) != smltbuf[mindex][pos + 1]) goto nextsect;