Update TasmotaModbus to v1.1.1

Update TasmotaModbus to v1.1.1
This commit is contained in:
Theo Arends 2019-09-10 15:10:02 +02:00
parent 0e3a88bbe2
commit 9cd21815c6
7 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "TasmotaModbus",
"version": "1.1.0",
"version": "1.1.1",
"keywords": [
"serial", "io", "TasmotaModbus"
],

View File

@ -1,5 +1,5 @@
name=TasmotaModbus
version=1.1.0
version=1.1.1
author=Theo Arends
maintainer=Theo Arends <theo@arends.com>
sentence=Basic modbus wrapper for TasmotaSerial for ESP8266.

View File

@ -100,7 +100,10 @@ uint8_t TasmotaModbus::ReceiveBuffer(uint8_t *buffer, uint8_t register_count)
}
if (len < 7) { return 7; } // 7 = Not enough data
if (len != buffer[2] + 5) { return 8; } // 8 = Unexpected result
if (len != buffer[2] + 5) {
buffer[2] = len - 5; // As it's wrong anyway let's store actual number received in here (5 will be added by client)
return 8; // 8 = Unexpected result
}
uint16_t crc = (buffer[len -1] << 8) | buffer[len -2];
if (CalculateCRC(buffer, len -2) != crc) { return 9; } // 9 = crc error