diff options
author | rcoh <rcoh@mit.edu> | 2011-01-04 17:23:30 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-01-04 17:23:30 -0500 |
commit | 1679719e7ca8ce433c5714474a32c926161dc5b8 (patch) | |
tree | dc75dc66ee8695fe786df2b48c0e6911332ed7c5 /util | |
parent | 395e99394ead5d0d656e74fed23dc780652b6090 (diff) |
Some performance improvements -- we also synchronize all the frames, giving us a meaning that even
if things slow down, rendering doesn't look weird.
Diffstat (limited to 'util')
-rw-r--r-- | util/PacketComposition.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/util/PacketComposition.py b/util/PacketComposition.py index 73eefff..b323d54 100644 --- a/util/PacketComposition.py +++ b/util/PacketComposition.py @@ -7,11 +7,12 @@ MAGICHASH = 0x69000420 PORTOUT = 0x0108 UNI = 0 import pdb +import util.TimeOps as timeops kinetDict = {'flags': 0, 'startcode': 0, 'pad':0} -def composePixelStripData(pixelStrip): +def composePixelStripData(pixelStrip,currentTime=timeops.time()): packet = bytearray() for light in pixelStrip: - color = light.state() + color = light.state(currentTime) for channel in color: #skip the last value, its an #alpha value packet.append(struct.pack('B', channel)) @@ -21,9 +22,9 @@ def composePixelStripData(pixelStrip): #color = pixelStrip.pixels[i].state() #packet[i:i+2] = color # return bytearray(packet) -def composePixelStripPacket(pixelStrip,port): +def composePixelStripPacket(pixelStrip,port, currentTime): packet = bytearray() - data = composePixelStripData(pixelStrip) + data = composePixelStripData(pixelStrip, currentTime) subDict = dict(kinetDict) subDict['len'] = 38000 #I have no idea why this works. subDict['port'] = port |