Changeset - a856693007b2
[Not reviewed]
default
0 2 0
Drew Perttula - 11 years ago 2014-06-13 07:32:06
drewp@bigasterisk.com
flip L/R, add blacklight() effect
Ignore-this: d0486e7678a1fe150f9fc5dc22c8ba13
2 files changed with 10 insertions and 4 deletions:
0 comments (0 inline, 0 general)
light9/Effects.py
Show inline comments
 
@@ -23,6 +23,9 @@ class ColorStrip(object):
 
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, 
light9/effecteval/effectloop.py
Show inline comments
 
@@ -143,9 +143,10 @@ class LedLoop(EffectLoop):
 
    def initOutput(self):
 
        kw = dict(baudrate=115200)
 
        self.boards = {
 
            'L': serial.Serial('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A7027NYX-if00-port0', **kw),
 
            'R': serial.Serial('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A7027JI6-if00-port0', **kw),
 
            'L': serial.Serial('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A7027JI6-if00-port0', **kw),
 
            'R': serial.Serial('/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A7027NYX-if00-port0', **kw),
 
        }
 
        self.lastSentBacklight = None
 
        
 
    def combineOutputs(self, outputs):
 
        combined = {'L': Z, 'R': Z, 'blacklight': 0}
 
@@ -163,8 +164,10 @@ class LedLoop(EffectLoop):
 
    def sendOutput(self, combined):
 
        for which, px255 in combined.items():
 
            if which == 'blacklight':
 
                self.boards['L'].write('\x60\x01' + chr(px255))
 
                self.boards['L'].flush()
 
                if px255 != self.lastSentBacklight:
 
                    self.boards['L'].write('\x60\x01' + chr(px255))
 
                    self.boards['L'].flush()
 
                    self.lastSentBacklight = px255
 
            else:
 
                board = self.boards[which]
 
                msg = '\x60\x00' + px255.reshape((-1,)).tostring()
0 comments (0 inline, 0 general)