mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Catch board not configured error without crashing
This commit is contained in:
parent
6922a71995
commit
28b7009f33
@ -74,6 +74,7 @@ function DuinoNodeIn(n) {
|
||||
this.state = n.state;
|
||||
this.arduino = n.arduino;
|
||||
this.serverConfig = RED.nodes.getNode(this.arduino);
|
||||
if (typeof this.serverConfig === "object") {
|
||||
this.board = this.serverConfig.board;
|
||||
this.repeat = this.serverConfig.repeat;
|
||||
var node = this;
|
||||
@ -106,7 +107,11 @@ function DuinoNodeIn(n) {
|
||||
|
||||
this._close = function() {
|
||||
clearInterval(this._interval);
|
||||
util.log("[firmata] input eventlistener stopped");
|
||||
util.log("[arduino] input eventlistener stopped");
|
||||
}
|
||||
}
|
||||
else {
|
||||
util.log("[arduino] Serial Port not Configured");
|
||||
}
|
||||
}
|
||||
RED.nodes.registerType("arduino in",DuinoNodeIn);
|
||||
@ -124,6 +129,7 @@ function DuinoNodeOut(n) {
|
||||
this.state = n.state;
|
||||
this.arduino = n.arduino;
|
||||
this.serverConfig = RED.nodes.getNode(this.arduino);
|
||||
if (typeof this.serverConfig === "object") {
|
||||
this.board = this.serverConfig.board;
|
||||
var node = this;
|
||||
|
||||
@ -164,4 +170,8 @@ function DuinoNodeOut(n) {
|
||||
}
|
||||
}, 5000); // loop to wait for firmata to connect to arduino
|
||||
}
|
||||
else {
|
||||
util.log("[arduino] Serial Port not Configured");
|
||||
}
|
||||
}
|
||||
RED.nodes.registerType("arduino out",DuinoNodeOut);
|
||||
|
Loading…
Reference in New Issue
Block a user