1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Fix listing errors in node-red-nodes

This commit is contained in:
Dave Conway-Jones 2016-03-01 21:10:58 +00:00
parent ea9356a3cc
commit d70ae82d10
9 changed files with 50 additions and 48 deletions

View File

@ -55,8 +55,8 @@ module.exports = function(RED) {
} }
else if (p3.test(msg.payload)) { else if (p3.test(msg.payload)) {
// if it is a r,g,b,index quad for a two led device // if it is a r,g,b,index quad for a two led device
var rgb = msg.payload.split(','); var rgb2 = msg.payload.split(',');
blink1[node.serial||"one"].fadeToRGB(node.fade, parseInt(rgb[0])&255, parseInt(rgb[1])&255, parseInt(rgb[2])&255, parseInt(rgb[3])&3); blink1[node.serial||"one"].fadeToRGB(node.fade, parseInt(rgb2[0])&255, parseInt(rgb2[1])&255, parseInt(rgb2[2])&255, parseInt(rgb2[3])&3);
} }
else { else {
// you can add fancy colours by name here if you want... // you can add fancy colours by name here if you want...

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-blink1", "name" : "node-red-node-blink1",
"version" : "0.0.14", "version" : "0.0.15",
"description" : "A Node-RED node to control a Thingm Blink(1)", "description" : "A Node-RED node to control a Thingm Blink(1)",
"dependencies" : { "dependencies" : {
"node-blink1" : "0.2.2" "node-blink1" : "0.2.2"

View File

@ -40,7 +40,7 @@ module.exports = function(RED) {
// the magic to make python print stuff immediately // the magic to make python print stuff immediately
process.env.PYTHONUNBUFFERED = 1; process.env.PYTHONUNBUFFERED = 1;
function piNeopixelNode(n) { function PiNeopixelNode(n) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
this.pixels = n.pixels || 1; this.pixels = n.pixels || 1;
this.bgnd = n.bgnd || "0,0,0"; this.bgnd = n.bgnd || "0,0,0";
@ -86,13 +86,13 @@ module.exports = function(RED) {
else { node.warn("Invalid payload : "+pay); return; } else { node.warn("Invalid payload : "+pay); return; }
} }
else { // it's a single number so just draw bar else { // it's a single number so just draw bar
var l = pay; var ll = pay;
if (node.mode.indexOf("pcent") >= 0) { l = parseInt(l / 100 * node.pixels + 0.5); } if (node.mode.indexOf("pcent") >= 0) { ll = parseInt(ll / 100 * node.pixels + 0.5); }
l = l - 1; ll = ll - 1;
if (node.mode.indexOf("need") >= 0) { if (node.mode.indexOf("need") >= 0) {
pay = "0,"+(l-1)+","+node.fgnd+"\n"+l+","+needle+"\n"+(l+1)+","+(node.pixels-1)+","+node.bgnd; pay = "0,"+(ll-1)+","+node.fgnd+"\n"+ll+","+needle+"\n"+(ll+1)+","+(node.pixels-1)+","+node.bgnd;
} else { } else {
pay = "0,"+l+","+node.fgnd+"\n"+(l+1)+","+(node.pixels-1)+","+node.bgnd; pay = "0,"+ll+","+node.fgnd+"\n"+(ll+1)+","+(node.pixels-1)+","+node.bgnd;
} }
} }
} }
@ -165,5 +165,5 @@ module.exports = function(RED) {
} }
} }
} }
RED.nodes.registerType("rpi-neopixels",piNeopixelNode); RED.nodes.registerType("rpi-neopixels",PiNeopixelNode);
} }

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-pi-neopixel", "name" : "node-red-node-pi-neopixel",
"version" : "0.0.8", "version" : "0.0.9",
"description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.", "description" : "A Node-RED node to output to a neopixel (ws2812) string of LEDS from a Raspberry Pi.",
"dependencies" : { "dependencies" : {
}, },

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-pi-unicorn-hat", "name" : "node-red-node-pi-unicorn-hat",
"version" : "0.0.3", "version" : "0.0.5",
"description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.", "description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.",
"dependencies" : { "dependencies" : {
"pngjs": "2.2.*" "pngjs": "2.2.*"

View File

@ -50,7 +50,6 @@
<script type="text/javascript"> <script type="text/javascript">
RED.nodes.registerType('rpi-unicorn',{ RED.nodes.registerType('rpi-unicorn',{
category: 'Raspberry Pi', category: 'Raspberry Pi',
label: 'Raspberry Pi',
color:"#c6dbef", color:"#c6dbef",
defaults: { defaults: {
name: { value:"" }, name: { value:"" },

View File

@ -92,6 +92,7 @@ module.exports = function(RED) {
else { ready = true; } else { ready = true; }
function inputlistener(msg) { function inputlistener(msg) {
var a,b,c,d,e;
var s = msg.payload.toUpperCase().split(","); var s = msg.payload.toUpperCase().split(",");
var doDraw = true; var doDraw = true;
if (s.length === 1) { if (s.length === 1) {
@ -131,10 +132,10 @@ module.exports = function(RED) {
else { else {
node.child.stdin.write('P'+msg.payload+'\n'); node.child.stdin.write('P'+msg.payload+'\n');
doDraw = false; doDraw = false;
for (var a=0; a<s.length; a++) { for (a=0; a<s.length; a++) {
//console.log("PIXELS",a); //console.log("PIXELS",a);
if ((s[a] === "*") && (s[a+1] === "*")) { if ((s[a] === "*") && (s[a+1] === "*")) {
for (var c=0; c<192; c++) { for (c=0; c<192; c++) {
pic[c] = s[a+2]; pic[c] = s[a+2];
pic[c+1] = s[a+3]; pic[c+1] = s[a+3];
pic[c+2] = s[a+4]; pic[c+2] = s[a+4];
@ -142,14 +143,14 @@ module.exports = function(RED) {
} }
} }
else if (s[a] === "*") { else if (s[a] === "*") {
for (var d=0; d<8; d++) { for (d=0; d<8; d++) {
pic[d*3+s[1]*24] = s[a+2]; pic[d*3+s[1]*24] = s[a+2];
pic[d*3+s[1]*24+1] = s[a+3]; pic[d*3+s[1]*24+1] = s[a+3];
pic[d*3+s[1]*24+2] = s[a+4]; pic[d*3+s[1]*24+2] = s[a+4];
} }
} }
else if (s[a+1] === "*") { else if (s[a+1] === "*") {
for (var e=0; e<8; e++) { for (e=0; e<8; e++) {
pic[s[a]*3+e*24] = s[a+2]; pic[s[a]*3+e*24] = s[a+2];
pic[s[a]*3+e*24+1] = s[a+3]; pic[s[a]*3+e*24+1] = s[a+3];
pic[s[a]*3+e*24+2] = s[a+4]; pic[s[a]*3+e*24+2] = s[a+4];
@ -165,11 +166,11 @@ module.exports = function(RED) {
} }
} }
else if (s.length === 192) { // handle complete buffer refresh. else if (s.length === 192) { // handle complete buffer refresh.
for (var i=0; i<192; i++) { for (var h=0; h<192; h++) {
pic[i] = s[i]; pic[h] = s[h];
pic[i+1] = s[i+1]; pic[h+1] = s[h+1];
pic[i+2] = s[i+2]; pic[h+2] = s[h+2];
i += 2; h += 2;
} }
} }
else { else {
@ -180,17 +181,18 @@ module.exports = function(RED) {
var pixels = new Buffer(192); var pixels = new Buffer(192);
pic.copy(pixels); pic.copy(pixels);
for (var p in node.items) { for (var p in node.items) {
var b = node.items[p].split(","); if (node.items.hasOwnProperty(p)) {
for (var a=0; a<b.length; a++) { b = node.items[p].split(",");
for (a=0; a<b.length; a++) {
if (b[a] === "*") { if (b[a] === "*") {
for (var d=0; d<8; d++) { for (d=0; d<8; d++) {
pixels[d*3+b[a+1]*24] = b[a+2]; pixels[d*3+b[a+1]*24] = b[a+2];
pixels[d*3+b[a+1]*24+1] = b[a+3]; pixels[d*3+b[a+1]*24+1] = b[a+3];
pixels[d*3+b[a+1]*24+2] = b[a+4]; pixels[d*3+b[a+1]*24+2] = b[a+4];
} }
} }
else if (b[a+1] === "*") { else if (b[a+1] === "*") {
for (var e=0; e<8; e++) { for (e=0; e<8; e++) {
pixels[b[a]*3+e*24] = b[a+2]; pixels[b[a]*3+e*24] = b[a+2];
pixels[b[a]*3+e*24+1] = b[a+3]; pixels[b[a]*3+e*24+1] = b[a+3];
pixels[b[a]*3+e*24+2] = b[a+4]; pixels[b[a]*3+e*24+2] = b[a+4];
@ -204,6 +206,7 @@ module.exports = function(RED) {
a += 4; a += 4;
} }
} }
}
node.child.stdin.write(pixels); node.child.stdin.write(pixels);
node.child.stdin.write("\n"); node.child.stdin.write("\n");
} }

View File

@ -44,7 +44,7 @@ module.exports = function(RED) {
var pri = msg.priority||this.priority; var pri = msg.priority||this.priority;
var url = this.url||msg.url; var url = this.url||msg.url;
var options = { priority:pri }; var options = { priority:pri };
if (url) { options.url = url }; if (url) { options.url = url; }
if (typeof(msg.payload) === 'object') { if (typeof(msg.payload) === 'object') {
msg.payload = JSON.stringify(msg.payload); msg.payload = JSON.stringify(msg.payload);
} }

View File

@ -1,6 +1,6 @@
{ {
"name" : "node-red-node-prowl", "name" : "node-red-node-prowl",
"version" : "0.0.5", "version" : "0.0.6",
"description" : "A Node-RED node to send alerts via Prowl", "description" : "A Node-RED node to send alerts via Prowl",
"dependencies" : { "dependencies" : {
"node-prowl" : "0.1.7" "node-prowl" : "0.1.7"