mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
let pi keyboard to retry connection
This commit is contained in:
parent
91217d6e62
commit
8c7409d041
@ -271,7 +271,7 @@ module.exports = function(RED) {
|
|||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
var node = this;
|
var node = this;
|
||||||
|
|
||||||
if (allOK === true) {
|
var doConnect = function() {
|
||||||
node.child = spawn(gpioCommand+".py", ["kbd","0"]);
|
node.child = spawn(gpioCommand+".py", ["kbd","0"]);
|
||||||
node.status({fill:"green",shape:"dot",text:"rpi-gpio.status.ok"});
|
node.status({fill:"green",shape:"dot",text:"rpi-gpio.status.ok"});
|
||||||
|
|
||||||
@ -300,7 +300,10 @@ module.exports = function(RED) {
|
|||||||
node.status({fill:"grey",shape:"ring",text:"rpi-gpio.status.closed"});
|
node.status({fill:"grey",shape:"ring",text:"rpi-gpio.status.closed"});
|
||||||
node.finished();
|
node.finished();
|
||||||
}
|
}
|
||||||
else { node.status({fill:"red",shape:"ring",text:"rpi-gpio.status.stopped"}); }
|
else {
|
||||||
|
node.status({fill:"red",shape:"ring",text:"rpi-gpio.status.stopped"});
|
||||||
|
setTimeout(function() { doConnect(); },2000)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
node.child.on('error', function (err) {
|
node.child.on('error', function (err) {
|
||||||
@ -308,6 +311,10 @@ module.exports = function(RED) {
|
|||||||
else if (err.errno === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")); }
|
else if (err.errno === "EACCES") { node.error(RED._("rpi-gpio.errors.commandnotexecutable")); }
|
||||||
else { node.error(RED._("rpi-gpio.errors.error")+': ' + err.errno); }
|
else { node.error(RED._("rpi-gpio.errors.error")+': ' + err.errno); }
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allOK === true) {
|
||||||
|
doConnect();
|
||||||
|
|
||||||
node.on("close", function(done) {
|
node.on("close", function(done) {
|
||||||
node.status({});
|
node.status({});
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-node-pi-gpio",
|
"name": "node-red-node-pi-gpio",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "The basic Node-RED node for Pi GPIO",
|
"description": "The basic Node-RED node for Pi GPIO",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user