Serial port only report close error once

This commit is contained in:
Dave Conway-Jones 2019-09-09 23:05:10 +01:00
parent 876c9a014e
commit a266d372b2
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
3 changed files with 6 additions and 3 deletions

View File

@ -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() {

View File

@ -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

View File

@ -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"