1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

arduino node - slight tidy, fix node declaration

to close #535
This commit is contained in:
Dave Conway-Jones 2019-04-15 17:28:55 +01:00
parent a475b67a19
commit 8d45e85acf
No known key found for this signature in database
GPG Key ID: 9E7F9C73F5168CD4
3 changed files with 6 additions and 6 deletions

View File

@ -62,7 +62,7 @@
<script type="text/x-red" data-template-name="arduino out"> <script type="text/x-red" data-template-name="arduino out">
<div class="form-row"> <div class="form-row">
<label for="node-input-arduino"><i class="fa fa-tasks"></i> <span data-i18n="arduino.label.arduino"></span></label> <label for="node-input-arduino"><i class="fa fa-tasks"></i> Arduino</label>
<input type="text" id="node-input-arduino"> <input type="text" id="node-input-arduino">
</div> </div>
<div class="form-row"> <div class="form-row">

View File

@ -68,10 +68,10 @@ module.exports = function(RED) {
this.arduino = n.arduino; this.arduino = n.arduino;
this.serverConfig = RED.nodes.getNode(this.arduino); this.serverConfig = RED.nodes.getNode(this.arduino);
this.running = false; this.running = false;
var node = this;
if (typeof this.serverConfig === "object") { if (typeof this.serverConfig === "object") {
var startup = function() { var startup = function() {
this.board = this.serverConfig.board; node.board = node.serverConfig.board;
var node = this;
node.oldval = ""; node.oldval = "";
node.status({fill:"grey",shape:"ring",text:"node-red:common.status.connecting"}); node.status({fill:"grey",shape:"ring",text:"node-red:common.status.connecting"});
var doit = function() { var doit = function() {
@ -119,12 +119,12 @@ module.exports = function(RED) {
} }
if (node.board.isReady) { doit(); } if (node.board.isReady) { doit(); }
else { node.board.once("ready", function() { doit(); }); } else { node.board.once("ready", function() { doit(); }); }
setTimeout(function() { if (!node.running) { startup(); } }, 4500); setTimeout(function() { if (node.running === false) { startup(); } }, 4500);
} }
startup(); startup();
} }
else { else {
this.warn(RED._("arduino.errors.portnotconf")); node.warn(RED._("arduino.errors.portnotconf"));
} }
node.on('close', function() { node.on('close', function() {
node.running = false; node.running = false;

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-arduino", "name" : "node-red-node-arduino",
"version" : "0.2.1", "version" : "0.2.2",
"description" : "A Node-RED node to talk to an Arduino running firmata", "description" : "A Node-RED node to talk to an Arduino running firmata",
"dependencies" : { "dependencies" : {
"firmata" : "^2.0.0" "firmata" : "^2.0.0"