mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
pi node - don't try to send data if closing
This commit is contained in:
parent
3af37d3984
commit
fed49e3718
@ -73,7 +73,7 @@ module.exports = function(RED) {
|
|||||||
node.child.stdout.on('data', function (data) {
|
node.child.stdout.on('data', function (data) {
|
||||||
data = data.toString().trim();
|
data = data.toString().trim();
|
||||||
if (data.length > 0) {
|
if (data.length > 0) {
|
||||||
if (node.buttonState !== -1) {
|
if (node.running && node.buttonState !== -1) {
|
||||||
node.send({ topic:"pi/"+node.pin, payload:Number(data) });
|
node.send({ topic:"pi/"+node.pin, payload:Number(data) });
|
||||||
}
|
}
|
||||||
node.buttonState = data;
|
node.buttonState = data;
|
||||||
@ -87,8 +87,8 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
node.child.on('close', function (code) {
|
node.child.on('close', function (code) {
|
||||||
node.child = null;
|
|
||||||
node.running = false;
|
node.running = false;
|
||||||
|
node.child = null;
|
||||||
if (RED.settings.verbose) { node.log(RED._("rpi-gpio.status.closed")); }
|
if (RED.settings.verbose) { node.log(RED._("rpi-gpio.status.closed")); }
|
||||||
if (node.done) {
|
if (node.done) {
|
||||||
node.status({fill:"grey",shape:"ring",text:"rpi-gpio.status.closed"});
|
node.status({fill:"grey",shape:"ring",text:"rpi-gpio.status.closed"});
|
||||||
@ -279,8 +279,8 @@ module.exports = function(RED) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
node.child.on('close', function (code) {
|
node.child.on('close', function (code) {
|
||||||
node.child = null;
|
|
||||||
node.running = false;
|
node.running = false;
|
||||||
|
node.child = null;
|
||||||
if (RED.settings.verbose) { node.log(RED._("rpi-gpio.status.closed")); }
|
if (RED.settings.verbose) { node.log(RED._("rpi-gpio.status.closed")); }
|
||||||
if (node.done) {
|
if (node.done) {
|
||||||
node.status({fill:"grey",shape:"ring",text:"rpi-gpio.status.closed"});
|
node.status({fill:"grey",shape:"ring",text:"rpi-gpio.status.closed"});
|
||||||
|
Loading…
Reference in New Issue
Block a user