mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
The problem that the input contents disappear when multiple keys are input at the same time. (#717)
This commit is contained in:
parent
640a6d0cb2
commit
906a48fa61
@ -276,11 +276,16 @@ module.exports = function(RED) {
|
|||||||
node.status({fill:"green",shape:"dot",text:"rpi-gpio.status.ok"});
|
node.status({fill:"green",shape:"dot",text:"rpi-gpio.status.ok"});
|
||||||
|
|
||||||
node.child.stdout.on('data', function (data) {
|
node.child.stdout.on('data', function (data) {
|
||||||
var b = data.toString().trim().split(",");
|
var d = data.toString().trim().split("\n");
|
||||||
|
for (var i = 0; i < d.length; i++) {
|
||||||
|
if (d[i] !== '') {
|
||||||
|
var b = d[i].trim().split(",");
|
||||||
var act = "up";
|
var act = "up";
|
||||||
if (b[1] === "1") { act = "down"; }
|
if (b[1] === "1") { act = "down"; }
|
||||||
if (b[1] === "2") { act = "repeat"; }
|
if (b[1] === "2") { act = "repeat"; }
|
||||||
node.send({ topic:"pi/key", payload:Number(b[0]), action:act });
|
node.send({ topic:"pi/key", payload:Number(b[0]), action:act });
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
node.child.stderr.on('data', function (data) {
|
node.child.stderr.on('data', function (data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user