node-zserial 1.0.9 → 1.0.10

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 +9 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-zserial",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "Node-RED nodes to talk to serial ports",
5
5
  "dependencies": {
6
6
  "serialport": "^12.0.0"
package/zserial.js CHANGED
@@ -308,6 +308,12 @@ module.exports = function (RED) {
308
308
  node.successMsg = {};
309
309
  node.errorMsg = {};
310
310
  node._msg = null
311
+
312
+ function initMsg() {
313
+ node.totalMsg = {};
314
+ node.successMsg = {};
315
+ node.errorMsg = {};
316
+ }
311
317
  function zsend(msg, err, alldone, port, done) {
312
318
 
313
319
  let payload = msg || err;
@@ -326,6 +332,7 @@ module.exports = function (RED) {
326
332
  }
327
333
  function onMsg(msg, send, done) {
328
334
  node._msg = msg;
335
+ initMsg();
329
336
  if (!msg.serialConfigs) {
330
337
  node.error("需要配置批量配置:msg.serialConfigs");
331
338
  // zsend(msg, null, null)
@@ -349,7 +356,7 @@ module.exports = function (RED) {
349
356
  successMsg: node.successMsg,
350
357
  errorMsg: node.errorMsg,
351
358
  }
352
- node.send([null, null,Object.assign({}, node._msg,{
359
+ node.send([null, null, Object.assign({}, node._msg, {
353
360
  payload: payload
354
361
  })]);
355
362
  done()
@@ -481,6 +488,7 @@ module.exports = function (RED) {
481
488
  }
482
489
 
483
490
  this.on("input", function (msg, send, done) {
491
+
484
492
  onMsg(msg, send, done);
485
493
  })
486
494
  this.on("close", function (done) {