# HG changeset patch # User Drew Perttula # Date 2014-06-13 07:47:22 # Node ID 4eb7dc40797f26ed8d6372173a59afedb365f009 # Parent 9f4d68612d56b2ca36ae6778e6cd0022ffb32d50 just called Strip now Ignore-this: b563277b80d12713d6ed589f6c271d0 diff --git a/light9/Effects.py b/light9/Effects.py --- a/light9/Effects.py +++ b/light9/Effects.py @@ -15,17 +15,21 @@ def register(f): registered.append(f) return f -class ColorStrip(object): +@register +class Strip(object): """list of r,g,b tuples for sending to an LED strip""" which = 'L' pixels = [] - + @classmethod + def solid(cls, which='L', color=(1,1,1)): + x = cls() + x.which = which + x.pixels = [tuple(color)] * 50 + return x + +@register class Blacklight(float): """a level for the blacklight PWM output""" - -@register -def blacklight(v): - return Blacklight(v) @register def chase(t, ontime=0.5, offset=0.2, onval=1.0, @@ -61,20 +65,6 @@ def hsv(h, s, v, light='all', centerScal if light in ['center', 'all']: lev[88], lev[89], lev[90] = r*centerScale,g*centerScale,b*centerScale return Submaster.Submaster(name='hsv', levels=lev) - -@register -def colorDemo(): - s = ColorStrip() - s.which = 'L' - s.pixels = [(0,0,1)] * 50 - return s - -@register -def colorSolid(which='L', color=[1,1,1]): - s = ColorStrip() - s.which = which - s.pixels = [tuple(color)] * 50 - return s @register def stack(t, names=None, fade=0): diff --git a/light9/effecteval/effectloop.py b/light9/effecteval/effectloop.py --- a/light9/effecteval/effectloop.py +++ b/light9/effecteval/effectloop.py @@ -155,7 +155,7 @@ class LedLoop(EffectLoop): for out in outputs: if isinstance(out, Effects.Blacklight): combined['blacklight'] = max(combined['blacklight'], int(out * 255)) - elif isinstance(out, Effects.ColorStrip): + elif isinstance(out, Effects.Strip): pixels = numpy.array(out.pixels, dtype=numpy.float16) px255 = (numpy.clip(pixels, 0, 1) * 255).astype(numpy.uint8) combined[out.which] = numpy.maximum(combined[out.which], px255)