node-zserial 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/zserial.js +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-zserial",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Node-RED nodes to talk to serial ports",
5
5
  "dependencies": {
6
6
  "serialport": "^12.0.0"
package/zserial.js CHANGED
@@ -269,6 +269,7 @@ module.exports = function (RED) {
269
269
  curPort.on('timeout', function (msgout, sender) {
270
270
  if (sender !== node) { return; }
271
271
  msgout.status = "ERR_TIMEOUT";
272
+ msgout.port = curPort.serial.path;
272
273
  node.status({ fill: "red", shape: "ring", text: "timeout:::" + curPort.serial.path });
273
274
  node.send(msgout);
274
275
  if (done) done();
@@ -310,6 +311,7 @@ module.exports = function (RED) {
310
311
  node._msg = null
311
312
 
312
313
  function initMsg(msg) {
314
+ node._msg = msg;
313
315
  node.totallenth = msg.serialConfigs.length;
314
316
  node.totalMsg = {};
315
317
  node.successMsg = {};
@@ -332,7 +334,7 @@ module.exports = function (RED) {
332
334
  sendAll(done);
333
335
  }
334
336
  function onMsg(msg, send, done) {
335
- node._msg = msg;
337
+
336
338
  initMsg(msg);
337
339
  if (!msg.serialConfigs) {
338
340
  node.error("需要配置批量配置:msg.serialConfigs");
@@ -455,11 +457,9 @@ module.exports = function (RED) {
455
457
  curPort.on('timeout', function (msgout, sender) {
456
458
  if (sender !== node) { return; }
457
459
  msgout.status = "ERR_TIMEOUT";
460
+ msgout.port = curPort.serial.path;
458
461
  node.status({ fill: "red", shape: "ring", text: "timeout:::" + curPort.serial.path });
459
- zsend(null, {
460
- status: "ERR_TIMEOUT",
461
- port: curPort.serial.path
462
- }, null, curPort.serial.path, done);
462
+ zsend(null,msgout, null, curPort.serial.path, done);
463
463
  });
464
464
 
465
465
  curPort.on('initerror', function (port, retryNum, olderr) {