From 61c0826261cf52ea82136aa95b22d29d99bd3098 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Wed, 13 Nov 2019 21:52:01 +0000 Subject: [PATCH] update arduino node for node12 --- hardware/Arduino/35-arduino.html | 17 +++++++---------- hardware/Arduino/35-arduino.js | 12 +++++++++--- hardware/Arduino/package.json | 2 +- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/hardware/Arduino/35-arduino.html b/hardware/Arduino/35-arduino.html index 90df533b..b492fa28 100644 --- a/hardware/Arduino/35-arduino.html +++ b/hardware/Arduino/35-arduino.html @@ -1,5 +1,5 @@ - - - - - @@ -152,10 +152,7 @@ $("#node-config-lookup-serial-icon").addClass('fa-search'); $("#node-config-lookup-serial-icon").removeClass('spinner'); $("#node-config-lookup-serial").removeClass('disabled'); - var ports = []; - $.each(data, function(i, port) { - ports.push(port.comName); - }); + var ports = data || []; $("#node-config-input-device").autocomplete({ source:ports, minLength:0, diff --git a/hardware/Arduino/35-arduino.js b/hardware/Arduino/35-arduino.js index fc3ffe1f..5e6302bd 100644 --- a/hardware/Arduino/35-arduino.js +++ b/hardware/Arduino/35-arduino.js @@ -204,8 +204,14 @@ module.exports = function(RED) { RED.nodes.registerType("arduino out",DuinoNodeOut); RED.httpAdmin.get("/arduinoports", RED.auth.needsPermission("arduino.read"), function(req,res) { - SP.list(function(error, ports) { - res.json(ports); - }); + SP.list().then( + ports => { + const a = ports.map(p => p.comName); + res.json(a); + }, + err => { + this.log('Error listing serial ports', err) + } + ) }); } diff --git a/hardware/Arduino/package.json b/hardware/Arduino/package.json index 0e325ac9..45ab3bb0 100644 --- a/hardware/Arduino/package.json +++ b/hardware/Arduino/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-arduino", - "version" : "0.2.4", + "version" : "0.3.0", "description" : "A Node-RED node to talk to an Arduino running firmata", "dependencies" : { "firmata" : "^2.0.0"