mirror of
				https://github.com/node-red/node-red-nodes.git
				synced 2025-03-01 10:37:43 +00:00 
			
		
		
		
	The problem that the input contents disappear when multiple keys are input at the same time. (#717)
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							640a6d0cb2
						
					
				
				
					commit
					906a48fa61
				
			@@ -276,11 +276,16 @@ module.exports = function(RED) {
 | 
			
		||||
            node.status({fill:"green",shape:"dot",text:"rpi-gpio.status.ok"});
 | 
			
		||||
 | 
			
		||||
            node.child.stdout.on('data', function (data) {
 | 
			
		||||
                var b = data.toString().trim().split(",");
 | 
			
		||||
                var act = "up";
 | 
			
		||||
                if (b[1] === "1") { act = "down"; }
 | 
			
		||||
                if (b[1] === "2") { act = "repeat"; }
 | 
			
		||||
                node.send({ topic:"pi/key", payload:Number(b[0]), action:act });
 | 
			
		||||
                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";
 | 
			
		||||
                        if (b[1] === "1") { act = "down"; }
 | 
			
		||||
                        if (b[1] === "2") { act = "repeat"; }
 | 
			
		||||
                        node.send({ topic:"pi/key", payload:Number(b[0]), action:act });
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            node.child.stderr.on('data', function (data) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user