From e5b802c01d928aeda2eb19056723faa4feeeb0f9 Mon Sep 17 00:00:00 2001 From: redpanther Date: Thu, 28 Jan 2016 06:12:28 +0100 Subject: [PATCH] simplify effects Former-commit-id: bbb8dc4c3852d0651eb2f4e9999e426db4a905d0 --- effects/shutdown.py | 8 +++----- effects/strobe.py | 12 +++--------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/effects/shutdown.py b/effects/shutdown.py index 469443d0..214af60e 100644 --- a/effects/shutdown.py +++ b/effects/shutdown.py @@ -1,4 +1,4 @@ -import hyperion, time, colorsys, random, subprocess +import hyperion, time, subprocess def setPixel(x,y,rgb): global imageData, width @@ -17,8 +17,6 @@ width = 12 height = 10 imageData = bytearray(height * width * (0,0,0)) -imageDataBlack = bytearray(height * width * (0,0,0)) -imageDataRed = bytearray(height * width * alarmColor) # Start the write data loop for i in range(6): @@ -26,9 +24,9 @@ for i in range(6): off = False break if i % 2: - hyperion.setImage(width, height, imageDataRed) + hyperion.setColor(alarmColor[0], alarmColor[1], alarmColor[2]) else: - hyperion.setImage(width, height, imageDataBlack) + hyperion.setColor(0, 0, 0) time.sleep(sleepTime) for y in range(height,0,-1): diff --git a/effects/strobe.py b/effects/strobe.py index 007e6133..39a3a558 100644 --- a/effects/strobe.py +++ b/effects/strobe.py @@ -1,6 +1,4 @@ -import hyperion -import time -import colorsys +import hyperion, time # Get the rotation time color = hyperion.args.get('color', (255,255,255)) @@ -12,13 +10,9 @@ frequency = min(100.0, frequency) # Compute the strobe interval sleepTime = 1.0 / frequency -# Initialize the led data -blackLedsData = bytearray(hyperion.ledCount * ( 0, 0, 0)) -whiteLedsData = bytearray(hyperion.ledCount * color) - # Start the write data loop while not hyperion.abort(): - hyperion.setColor(blackLedsData) + hyperion.setColor(0, 0, 0) time.sleep(sleepTime) - hyperion.setColor(whiteLedsData) + hyperion.setColor(color[0], color[1], color[2]) time.sleep(sleepTime)