mirror of https://github.com/arendst/Tasmota.git
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:
commit
9898cb0bed
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue