From fea41407acf2d4d1a5126b8473241c8ead56d401 Mon Sep 17 00:00:00 2001 From: JeroenSt Date: Sat, 27 Aug 2022 09:11:36 +0200 Subject: [PATCH] changed wrong copying of tcp data to writedata --- tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino index 46cb50697..8c9d5cbea 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_63_modbus_bridge.ino @@ -644,8 +644,8 @@ void ModbusTCPHandle(void) writeData = (uint16_t *)malloc(dataSendCount); for (uint8_t dataPointer = 0; dataPointer < dataSendCount; dataPointer++) { - writeData[dataPointer] = (uint16_t)((((uint16_t)modbusBridgeTCP.tcp_buf[dataStartByte+dataPointer]) << 8) - | ((uint16_t)modbusBridgeTCP.tcp_buf[dataStartByte + 1 + dataPointer])); + writeData[dataPointer] = (uint16_t)((((uint16_t)modbusBridgeTCP.tcp_buf[dataStartByte+(dataPointer*2)]) << 8) + | ((uint16_t)modbusBridgeTCP.tcp_buf[dataStartByte + 1 + (dataPointer*2)])); } }