node-modbus
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -51,5 +51,5 @@ var stampit = require('stampit'), | ||
.word8(fc) | ||
.word16be(startAddress) | ||
.word16be(startAddress); | ||
if (coils instanceof Buffer) { | ||
if (Buffer.isBuffer(coils)) { | ||
@@ -59,3 +59,4 @@ pdu.word16be(N) | ||
.put(coils) | ||
} else if (coils instanceof Array) { | ||
} | ||
else if (Array.isArray(coils)) { | ||
@@ -69,3 +70,3 @@ if (coils.length > 1968) { | ||
curByte = 0, | ||
cntr = 0 | ||
cntr = 0; | ||
@@ -82,3 +83,3 @@ pdu.word16be(coils.length) | ||
if (cntr === 0 || i === coils.length - 1 ) { | ||
pdu.word8(curByte) | ||
pdu.word8(curByte); | ||
curByte = 0 | ||
@@ -85,0 +86,0 @@ } |
@@ -51,5 +51,5 @@ var stampit = require('stampit'), | ||
.word8(fc) | ||
.word16be(startAddress) | ||
.word16be(startAddress); | ||
if(register instanceof Buffer) { | ||
if(Buffer.isBuffer(register)) { | ||
@@ -64,3 +64,3 @@ if(register.length/2 > 0x007b) { | ||
} | ||
else if(register instanceof Array) { | ||
else if(Array.isArray(register)) { | ||
@@ -73,6 +73,6 @@ if (register.length > 0x007b) { | ||
var byteCount = Math.ceil(register.length * 2), | ||
curByte = 0 | ||
curByte = 0; | ||
pdu.word16be(register.length) | ||
.word8(byteCount) | ||
.word8(byteCount); | ||
@@ -79,0 +79,0 @@ for (var i = 0; i < register.length; i += 1) { |
@@ -50,3 +50,3 @@ var stampit = require('stampit'), | ||
var response = Put().word8(0x0F).word16be(start).word16be(quantity).buffer(), | ||
oldValue, newValue, current = pdu.readUInt8(6 + 0), j = 0; | ||
oldValue, newValue, current = pdu.readUInt8(6), j = 0; | ||
@@ -53,0 +53,0 @@ for (var i = start; i < start + quantity; i += 1 ) { |
@@ -43,3 +43,2 @@ var stampit = require('stampit'), | ||
return; | ||
} | ||
@@ -55,3 +54,2 @@ | ||
return; | ||
} | ||
@@ -64,6 +62,5 @@ | ||
mem.writeUInt8(pdu.readUInt8(6 + j + 0), i); | ||
mem.writeUInt8(pdu.readUInt8(6 + j), i); | ||
j += 1; | ||
} | ||
@@ -70,0 +67,0 @@ |
@@ -102,3 +102,3 @@ var stampit = require('stampit'), | ||
this.log.debug('received data'); | ||
this.log.debug('received data ' + JSON.stringify(pdu)); | ||
@@ -105,0 +105,0 @@ if( crc.crc16modbus(pdu) === 0 ) { /* PDU is valid if CRC across whole PDU equals 0, else ignore and do nothing */ |
{ | ||
"name": "node-modbus", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Sum of implementations for the Serial/TCP Modbus protocol.", | ||
@@ -5,0 +5,0 @@ "author": "Klaus Landsdorf <klaus.landsdorf@bianco-royal.de>", |
1297
57817