Skip to content

Commit

Permalink
fixup serialport initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Conway-Jones committed Feb 24, 2022
1 parent 22d1ec2 commit 184140b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions io/serialport/25-serial.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = function(RED) {
"use strict";
var settings = RED.settings;
var events = require("events");
var serialp = require("serialport");
const { SerialPort } = require('serialport');
var bufMaxSize = 32768; // Max serial buffer size, for inputs...
const serialReconnectTime = settings.serialReconnectTime || 15000;

Expand Down Expand Up @@ -336,7 +336,8 @@ module.exports = function(RED) {
//newline = newline.replace("\\n","\n").replace("\\r","\r");
var olderr = "";
var setupSerial = function() {
obj.serial = new serialp(port,{
obj.serial = new SerialPort({
path: port,
baudRate: baud,
dataBits: databits,
parity: parity,
Expand Down Expand Up @@ -487,7 +488,7 @@ module.exports = function(RED) {
}());

RED.httpAdmin.get("/serialports", RED.auth.needsPermission('serial.read'), function(req,res) {
serialp.list().then(
SerialPort.list().then(
ports => {
const a = ports.map(p => p.path);
res.json(a);
Expand Down
6 changes: 3 additions & 3 deletions io/serialport/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name" : "node-red-node-serialport",
"version" : "0.15.0",
"version" : "1.0.1",
"description" : "Node-RED nodes to talk to serial ports",
"dependencies" : {
"serialport" : "^9.2.5"
"serialport" : "^10.3.0"
},
"repository" : {
"type":"git",
Expand All @@ -18,7 +18,7 @@
"serialport": "25-serial.js"
}
},
"engines" : { "node" : ">=10.0.0" },
"engines" : { "node" : ">=12.0.0" },
"author": {
"name": "Dave Conway-Jones",
"email": "ceejay@vnet.ibm.com",
Expand Down

0 comments on commit 184140b

Please sign in to comment.