diff --git a/hardware/unicorn/package.json b/hardware/unicorn/package.json index 2451fc8e..4ddcff18 100644 --- a/hardware/unicorn/package.json +++ b/hardware/unicorn/package.json @@ -1,6 +1,6 @@ { "name" : "node-red-node-pi-unicorn-hat", - "version" : "0.0.8", + "version" : "0.0.9", "description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.", "dependencies" : { "pngjs": "2.2.*" diff --git a/hardware/unicorn/unicorn.html b/hardware/unicorn/unicorn.html index bbdde34d..c28eb6ba 100644 --- a/hardware/unicorn/unicorn.html +++ b/hardware/unicorn/unicorn.html @@ -41,8 +41,8 @@

Any msg with a topic identifies a 'sprite', which can then be moved independently. A 'sprite' can be a single pixel or a group of pixels.

Setting payload to 0 will delete the sprite from the list.

-

Setting payload to CLS will clear the display to off and delete any sprites.

-

Setting payload to DEL will delete any sprites, and leave the background.

+

Setting payload to CLEAR will clear the display to off, and delete any sprites.

+

Setting payload to DELETE will delete any sprites, and leave the background.

The brightness may be set by setting payload to brightness,nn where nn is 0 to 100.

The rotation may be set by setting payload to rotate,rr where rr is 0, 90, 180 or 270.

diff --git a/hardware/unicorn/unicorn.js b/hardware/unicorn/unicorn.js index 8bec6ea5..0a09a9de 100644 --- a/hardware/unicorn/unicorn.js +++ b/hardware/unicorn/unicorn.js @@ -98,12 +98,12 @@ module.exports = function(RED) { var s = msg.payload.toUpperCase().split(","); var doDraw = true; if (s.length === 1) { - if (s[0] == "CLS") { + if ((s[0] == "CLS") || (s[0] == "CLR") || (s[0] == "CLEAR")) { //console.log("CLEAR") pic.fill(0); node.items = {}; } - if (s[0] == "DEL") { + if ((s[0] == "DEL") || (s[0] == "DELETE")) { //console.log("DELETE") node.items = {}; } @@ -130,39 +130,40 @@ module.exports = function(RED) { else if (s.length % 5 === 0) { // handles pixel updates if (msg.topic) { node.items[msg.topic] = msg.payload; + console.log("ITEMS",node.items); } else { node.child.stdin.write('P'+msg.payload+'\n'); doDraw = false; - for (a=0; a