Modbus: fix response parsing error for coil write (#2986)

This commit is contained in:
Martin 2022-01-03 18:28:28 +01:00 committed by GitHub
parent 407661d56b
commit 45ebe51e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ bool Modbus::parse_modbus_byte_(uint8_t byte) {
uint8_t data_len = raw[2]; uint8_t data_len = raw[2];
uint8_t data_offset = 3; uint8_t data_offset = 3;
// the response for write command mirrors the requests and data startes at offset 2 instead of 3 for read commands // the response for write command mirrors the requests and data startes at offset 2 instead of 3 for read commands
if (function_code == 0x5 || function_code == 0x06 || function_code == 0x10) { if (function_code == 0x5 || function_code == 0x06 || function_code == 0xF || function_code == 0x10) {
data_offset = 2; data_offset = 2;
data_len = 4; data_len = 4;
} }