mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 12:27:13 +01:00
Fix modbus user-defined function handling (#3527)
This commit is contained in:
parent
c8b58b5c23
commit
29d6d0a906
@ -76,7 +76,12 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
|
||||
// installed, but wait, there is the CRC, and if we get a hit there is a good
|
||||
// chance that this is a complete message ... admittedly there is a small chance is
|
||||
// isn't but that is quite small given the purpose of the CRC in the first place
|
||||
data_len = at;
|
||||
|
||||
// Fewer than 2 bytes can't calc CRC
|
||||
if (at < 2)
|
||||
return true;
|
||||
|
||||
data_len = at - 2;
|
||||
data_offset = 1;
|
||||
|
||||
uint16_t computed_crc = crc16(raw, data_offset + data_len);
|
||||
|
Loading…
Reference in New Issue
Block a user