From 61e5b9b929ba2d6b28b1a1b52a0cdddd191bec22 Mon Sep 17 00:00:00 2001 From: Sean Bedford Date: Wed, 19 Mar 2014 16:57:30 +0000 Subject: [PATCH] Only instantiate a board when we need one --- hardware/duino/97-duino.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hardware/duino/97-duino.js b/hardware/duino/97-duino.js index 1d8a38fb..a1f3a690 100644 --- a/hardware/duino/97-duino.js +++ b/hardware/duino/97-duino.js @@ -23,12 +23,6 @@ function DuinoNode(n) { RED.nodes.createNode(this,n); this.pin = n.pin || "10"; node = this; - try { - this.board = new duino.Board(); - } - catch (e) { - util.log("[duino] - Error establishing board connection!"); - } this.on("input", function(message) { if (typeof(message.payload) == "string") { @@ -36,6 +30,12 @@ function DuinoNode(n) { } // Send message as RC triState if (message.payload.inputType === "RC") { + try { + this.board = new duino.Board(); + } + catch (e) { + util.log("[duino] - Error establishing board connection!"); + } var rcCode = message.payload.rcCode; if (rcCode.length != 8) {