mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-12-26 23:16:47 +01:00
Fix Arduino serial port search
This commit is contained in:
@@ -47,13 +47,13 @@
|
||||
} catch(err) { };
|
||||
|
||||
$("#node-config-lookup-serial").click(function() { // Board's serial port search function
|
||||
this.warn("Serial Auto-search started.");
|
||||
//console.log("Serial Auto-search started.");
|
||||
$("#node-config-lookup-serial-icon").removeClass('fa-search');
|
||||
$("#node-config-lookup-serial-icon").addClass('spinner');
|
||||
$("#node-config-lookup-serial") .addClass('disabled');
|
||||
|
||||
$.getJSON('arduinoports', function(data) {
|
||||
this.warn('Serial Auto-search found data: %o', data);
|
||||
//console.log('Serial Auto-search found data: %o', data);
|
||||
$("#node-config-lookup-serial-icon").removeClass('spinner');
|
||||
$("#node-config-lookup-serial") .removeClass('disabled');
|
||||
$("#node-config-lookup-serial-icon").addClass('fa-search');
|
||||
@@ -62,7 +62,7 @@
|
||||
source: ports,
|
||||
minLength: 0,
|
||||
close: function( event, ui ) {
|
||||
this.warn("Serial Auto-search closing.");
|
||||
//console.log("Serial Auto-search closing.");
|
||||
$("#node-config-input-device").autocomplete( "destroy" );
|
||||
}
|
||||
}).autocomplete("search", "");
|
||||
|
||||
@@ -102,7 +102,6 @@ module.exports = function(RED) {
|
||||
const SP = require('serialport');
|
||||
const firmataBoard = require('./lib/firmata');
|
||||
|
||||
|
||||
let moreLogs = RED.settings.verbose || false; // enable this for "debugging"
|
||||
|
||||
// "global" constants: (these are used at Emitters too)
|
||||
@@ -782,9 +781,9 @@ debugger
|
||||
*
|
||||
*/
|
||||
RED.httpAdmin.get("/arduinoports", RED.auth.needsPermission("arduino.read"), function(req, res) {
|
||||
SP.list().then(
|
||||
ports => {
|
||||
const a = ports.map(p => p.comName);
|
||||
SP.SerialPort.list().then(
|
||||
(data) => {
|
||||
const a = data.map(p => p.path);
|
||||
res.json(a);
|
||||
},
|
||||
err => {
|
||||
|
||||
Reference in New Issue
Block a user