From a266d372b29dc501fa8d4ea3e3627526263d5e96 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Mon, 9 Sep 2019 23:05:10 +0100 Subject: [PATCH] Serial port only report close error once --- io/serialport/25-serial.js | 5 ++++- io/serialport/README.md | 2 +- io/serialport/package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/io/serialport/25-serial.js b/io/serialport/25-serial.js index fde04163..7218e8b7 100644 --- a/io/serialport/25-serial.js +++ b/io/serialport/25-serial.js @@ -328,7 +328,10 @@ module.exports = function(RED) { }); obj.serial.on('close', function() { if (!obj._closing) { - RED.log.error(RED._("serial.errors.unexpected-close",{port:port})); + if (olderr !== "unexpected") { + olderr = "unexpected"; + RED.log.error(RED._("serial.errors.unexpected-close",{port:port})); + } obj._emitter.emit('closed'); if (obj.tout) { clearTimeout(obj.tout); } obj.tout = setTimeout(function() { diff --git a/io/serialport/README.md b/io/serialport/README.md index 19d95100..a5965222 100644 --- a/io/serialport/README.md +++ b/io/serialport/README.md @@ -6,7 +6,7 @@ hardware serial ports. ## Install -To install the stable version use the `Menu - Manage palette` option and search for node-red-node-serialport, or run the following command in your Node-RED user directory, typically `~/.node-red` +To install the stable version use the `Menu - Manage palette - Install` option and search for node-red-node-serialport, or run the following command in your Node-RED user directory, typically `~/.node-red` npm i node-red-node-serialport diff --git a/io/serialport/package.json b/io/serialport/package.json index 8e17f563..4fc7d98a 100644 --- a/io/serialport/package.json +++ b/io/serialport/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-serialport", - "version" : "0.8.6", + "version" : "0.8.7", "description" : "Node-RED nodes to talk to serial ports", "dependencies" : { "serialport" : "^7.1.5"