mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Revert "close fix" - seems to cause more hangs on redeploy than before.
This commit is contained in:
parent
1fd5e800a6
commit
9347ef2401
@ -44,19 +44,16 @@ function Blink1Node(n) {
|
||||
else {
|
||||
// you can add fancy colours by name here if you want...
|
||||
// these are the @cheerlight ones.
|
||||
var result = msg.payload.toLowerCase().match(/red|green|blue|cyan|white|warmwhite|purple|magenta|yellow|orange|black/g);
|
||||
var colors = {"red":"#FF0000","green":"#008000","blue":"#0000FF","cyan":"#00FFFF","white":"#FFFFFF",
|
||||
"warmwhite":"#FDF5E6","purple":"#800080","magenta":"#FF00FF","yellow":"#FFFF00","orange":"#FFA500","black":"#000000"}
|
||||
if (result != null) {
|
||||
for (var colour in result) {
|
||||
var c = colors[result[colour]];
|
||||
if (msg.payload.toLowerCase() in colors) {
|
||||
var c = colors[msg.payload.toLowerCase()];
|
||||
var r = parseInt(c.slice(1,3),16);
|
||||
var g = parseInt(c.slice(3,5),16);
|
||||
var b = parseInt(c.slice(5),16);
|
||||
if (node.fade == 0) { blink1.setRGB( r, g, b ); }
|
||||
else { blink1.fadeToRGB(node.fade, r, g, b ); }
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.warn("Blink1 : invalid msg : "+msg.payload);
|
||||
}
|
||||
@ -66,11 +63,12 @@ function Blink1Node(n) {
|
||||
node.warn("No Blink1 found");
|
||||
}
|
||||
});
|
||||
this.on("close", function() {
|
||||
if (blink1 && typeof blink1.close == "function") {
|
||||
blink1.close();
|
||||
}
|
||||
});
|
||||
// This ought to work but seems to cause more hangs on closing than not...
|
||||
//this.on("close", function() {
|
||||
//if (blink1 && typeof blink1.close == "function") {
|
||||
//blink1.close();
|
||||
//}
|
||||
//});
|
||||
var blink1 = new Blink1.Blink1();
|
||||
}
|
||||
catch(e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user