mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
fix unicorn listing
This commit is contained in:
parent
be2199640e
commit
c755442296
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name" : "node-red-node-pi-unicorn-hat",
|
||||
"version" : "0.0.9",
|
||||
"version" : "0.0.10",
|
||||
"description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.",
|
||||
"dependencies" : {
|
||||
"pngjs": "2.2.*"
|
||||
|
@ -93,7 +93,7 @@ module.exports = function(RED) {
|
||||
|
||||
function inputlistener(msg) {
|
||||
if (typeof msg.payload === "string") {
|
||||
var a,b,c,d,e;
|
||||
var a,b,c,d,e,i,j,x,y;
|
||||
msg.payload = msg.payload.replace('"','');
|
||||
var s = msg.payload.toUpperCase().split(",");
|
||||
var doDraw = true;
|
||||
@ -120,7 +120,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
else if (s.length === 3) {
|
||||
//console.log("BACKGROUND",s)
|
||||
for (var i=0; i<192; i++) {
|
||||
for (i=0; i<192; i++) {
|
||||
pic[i] = s[0];
|
||||
pic[i+1] = s[1];
|
||||
pic[i+2] = s[2];
|
||||
@ -134,8 +134,8 @@ module.exports = function(RED) {
|
||||
else {
|
||||
node.child.stdin.write('P'+msg.payload+'\n');
|
||||
doDraw = false;
|
||||
var x = [];
|
||||
var y = [];
|
||||
x = [];
|
||||
y = [];
|
||||
for (a = 0; a < s.length; a++) {
|
||||
//console.log("PIXELS",a);
|
||||
if (s[a] === "*") {
|
||||
@ -155,8 +155,8 @@ module.exports = function(RED) {
|
||||
}
|
||||
else { y[0] = y[1] = s[a+1]; }
|
||||
|
||||
for (var j = y[0]; j <= y[1]; j++) {
|
||||
for (var i = x[0]; i <= x[1]; i++) {
|
||||
for (j = y[0]; j <= y[1]; j++) {
|
||||
for (i = x[0]; i <= x[1]; i++) {
|
||||
pic[i*3+j*24] = s[a+2];
|
||||
pic[i*3+j*24+1] = s[a+3];
|
||||
pic[i*3+j*24+2] = s[a+4];
|
||||
@ -185,8 +185,8 @@ module.exports = function(RED) {
|
||||
for (var p in node.items) {
|
||||
if (node.items.hasOwnProperty(p)) {
|
||||
b = node.items[p].split(",");
|
||||
var x = [];
|
||||
var y = [];
|
||||
x = [];
|
||||
y = [];
|
||||
for (a = 0; a < b.length; a++) {
|
||||
if (b[a] === "*") {
|
||||
x[0] = 0;
|
||||
@ -204,8 +204,8 @@ module.exports = function(RED) {
|
||||
y = b[a+1].split("-").sort();
|
||||
}
|
||||
else { y[0] = y[1] = b[a+1]; }
|
||||
for (var j = y[0]; j <= y[1]; j++) {
|
||||
for (var i = x[0]; i <= x[1]; i++) {
|
||||
for (j = y[0]; j <= y[1]; j++) {
|
||||
for (i = x[0]; i <= x[1]; i++) {
|
||||
pixels[i*3+j*24] = b[a+2];
|
||||
pixels[i*3+j*24+1] = b[a+3];
|
||||
pixels[i*3+j*24+2] = b[a+4];
|
||||
|
Loading…
Reference in New Issue
Block a user