File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -42,9 +42,12 @@ class ModbusReadInputRegisterResponse: ModbusPacket {
42
42
println (" modbus length $length " )
43
43
byteVector = ByteArray (LEN_BYTES_METADATA_SIZE + length )
44
44
byteVector[0 ] = length
45
+ var i = 1
45
46
for (element in listIndexToRegisterValue){
46
- byteVector[(element.first - minIndex)+ 1 ] = DataConverter .toBytes(element.second)[1 ]
47
- byteVector[(element.first - minIndex)+ 2 ] = DataConverter .toBytes(element.second)[0 ]
47
+ println (" byte[${i} ]=${DataConverter .toBytes(element.second)[1 ]} " )
48
+ byteVector[i++ ] = DataConverter .toBytes(element.second)[1 ]
49
+ println (" byte[${i} ]=${DataConverter .toBytes(element.second)[0 ]} " )
50
+ byteVector[i++ ] = DataConverter .toBytes(element.second)[0 ]
48
51
}
49
52
}
50
53
}
You can’t perform that action at this time.
0 commit comments