Changeset - 4eb7dc40797f
[Not reviewed]
default
0 2 0
Drew Perttula - 11 years ago 2014-06-13 07:47:22
drewp@bigasterisk.com
just called Strip now
Ignore-this: b563277b80d12713d6ed589f6c271d0
2 files changed with 10 insertions and 20 deletions:
0 comments (0 inline, 0 general)
light9/Effects.py
Show inline comments
 
@@ -15,19 +15,23 @@ 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, 
 
          offval=0.0, names=None, combiner=max, random=False):
 
    """names is list of URIs. returns a submaster that chases through
 
@@ -63,20 +67,6 @@ def hsv(h, s, v, light='all', centerScal
 
    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):
 
    """names is list of URIs. returns a submaster that stacks the the inputs
 

	
light9/effecteval/effectloop.py
Show inline comments
 
@@ -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)
0 comments (0 inline, 0 general)