diff --git a/hardware/PiGpio/36-rpi-gpio.js b/hardware/PiGpio/36-rpi-gpio.js index d93a8a40..7ab000fc 100644 --- a/hardware/PiGpio/36-rpi-gpio.js +++ b/hardware/PiGpio/36-rpi-gpio.js @@ -108,10 +108,12 @@ module.exports = function(RED) { delete pinsInUse[node.pin]; if (node.child != null) { node.finished = done; - node.child.stdin.write("close "+node.pin); - node.child.kill('SIGKILL'); + node.child.stdin.write("close "+node.pin, () => { + node.child.kill('SIGKILL'); + setTimeout(function() { if (done) { done(); } }, 25); + }); } - else { done(); } + else { if (done) { done(); } } }); } RED.nodes.registerType("rpi-gpio in",GPIOInNode); @@ -210,10 +212,12 @@ module.exports = function(RED) { delete pinsInUse[node.pin]; if (node.child != null) { node.finished = done; - node.child.stdin.write("close "+node.pin); - node.child.kill('SIGKILL'); + node.child.stdin.write("close "+node.pin, () => { + node.child.kill('SIGKILL'); + setTimeout(function() { if (done) { done(); } }, 25); + }); } - else { done(); } + else { if (done) { done(); } } }); } diff --git a/hardware/PiGpio/package.json b/hardware/PiGpio/package.json index e445708c..66b71165 100644 --- a/hardware/PiGpio/package.json +++ b/hardware/PiGpio/package.json @@ -1,6 +1,6 @@ { "name": "node-red-node-pi-gpio", - "version": "2.0.3", + "version": "2.0.4", "description": "The basic Node-RED node for Pi GPIO", "dependencies" : { },