From 3cb42712bccff114e0da7b78cb9780c38b29f931 Mon Sep 17 00:00:00 2001 From: Dave Conway-Jones Date: Tue, 22 Mar 2016 20:25:20 +0000 Subject: [PATCH] re-add line drawing to unicorn hat node --- hardware/unicorn/package.json | 2 +- hardware/unicorn/unihat.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hardware/unicorn/package.json b/hardware/unicorn/package.json index cead7d7f..4f07a4bc 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.6", + "version" : "0.0.7", "description" : "A Node-RED node to output to a Raspberry Pi Unicorn HAT from Pimorini.", "dependencies" : { "pngjs": "2.2.*" diff --git a/hardware/unicorn/unihat.py b/hardware/unicorn/unihat.py index 0e003d19..472425c4 100755 --- a/hardware/unicorn/unihat.py +++ b/hardware/unicorn/unihat.py @@ -39,7 +39,19 @@ while True: data = data[1:].strip() s = data.split(',') for p in range(0,len(s),5): - UH.set_pixel(int(s[p]),int(s[p+1]),int(s[p+2]),int(s[p+3]),int(s[p+4])) + j = 1 + if (s[p] == "*") and (s[p+1] == "*"): + for i in range(0,8): + for j in range(0,8): + UH.set_pixel(i,j,int(s[p+2]),int(s[p+3]),int(s[p+4])) + elif s[p] == "*": + for i in range(0,8): + UH.set_pixel(i,int(s[p+1]),int(s[p+2]),int(s[p+3]),int(s[p+4])) + elif s[p+1] == "*": + for i in range(0,8): + UH.set_pixel(int(s[p]),i,int(s[p+2]),int(s[p+3]),int(s[p+4])) + else : + UH.set_pixel(int(s[p]),int(s[p+1]),int(s[p+2]),int(s[p+3]),int(s[p+4])) else: q = 0 for p in range(64):