mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Let blinkstick handle strings of neopixels
This commit is contained in:
parent
24394c4b18
commit
63abf0a8c3
@ -97,7 +97,7 @@ module.exports = function(RED) {
|
|||||||
node.led = device;
|
node.led = device;
|
||||||
|
|
||||||
if (Object.size(node.led) === 0) {
|
if (Object.size(node.led) === 0) {
|
||||||
node.status({fill:"red",shape:"ring",text:"disconnected"});
|
node.status({fill:"red",shape:"ring",text:"not found"});
|
||||||
node.error("BlinkStick with serial number " + node.serial + " not found");
|
node.error("BlinkStick with serial number " + node.serial + " not found");
|
||||||
} else {
|
} else {
|
||||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||||
@ -108,7 +108,7 @@ module.exports = function(RED) {
|
|||||||
node.led = blinkstick.findFirst();
|
node.led = blinkstick.findFirst();
|
||||||
|
|
||||||
if (Object.size(node.led) === 0) {
|
if (Object.size(node.led) === 0) {
|
||||||
node.status({fill:"red",shape:"ring",text:"disconnected"});
|
node.status({fill:"red",shape:"ring",text:"not found"});
|
||||||
node.error("No BlinkStick found");
|
node.error("No BlinkStick found");
|
||||||
} else {
|
} else {
|
||||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||||
@ -172,7 +172,7 @@ module.exports = function(RED) {
|
|||||||
else {
|
else {
|
||||||
node.warn("BlinkStick missing ? " + err);
|
node.warn("BlinkStick missing ? " + err);
|
||||||
}
|
}
|
||||||
console.log(err);
|
node.log(err);
|
||||||
//Reset animation
|
//Reset animation
|
||||||
animationComplete = true;
|
animationComplete = true;
|
||||||
//Clear color
|
//Clear color
|
||||||
@ -191,6 +191,7 @@ module.exports = function(RED) {
|
|||||||
findBlinkStick();
|
findBlinkStick();
|
||||||
|
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
|
if (typeof(node.led) !== "undefined") {
|
||||||
if (typeof(msg.payload) === 'object' ) {
|
if (typeof(msg.payload) === 'object' ) {
|
||||||
// if it's an array then hopefully it's r,g,b,r,g,b or name,name,name
|
// if it's an array then hopefully it's r,g,b,r,g,b or name,name,name
|
||||||
if (Array.isArray(msg.payload)) {
|
if (Array.isArray(msg.payload)) {
|
||||||
@ -241,7 +242,6 @@ module.exports = function(RED) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (p1.test(msg.payload)) {
|
} else if (p1.test(msg.payload)) {
|
||||||
//Color value is represented as "red,green,blue" string of bytes
|
//Color value is represented as "red,green,blue" string of bytes
|
||||||
var rgb = msg.payload.split(",");
|
var rgb = msg.payload.split(",");
|
||||||
@ -267,6 +267,11 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
node.status({fill:"red",shape:"ring",text:"not found"});
|
||||||
|
node.error("BlinkStick not found",msg);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.on("close", function() {
|
this.on("close", function() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "node-red-node-blinkstick",
|
"name" : "node-red-node-blinkstick",
|
||||||
"version" : "0.1.3",
|
"version" : "0.1.5",
|
||||||
"description" : "A Node-RED node to control a Blinkstick",
|
"description" : "A Node-RED node to control a Blinkstick",
|
||||||
"dependencies" : {
|
"dependencies" : {
|
||||||
"blinkstick" : "1.1.*"
|
"blinkstick" : "1.1.*"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user