Fixed alpha handling, added noise

This commit is contained in:
jaseg 2014-03-10 00:31:05 +01:00
parent 97a0b8b171
commit 6503863333
2 changed files with 9 additions and 2 deletions

View file

@ -39,6 +39,6 @@ def sendframe(framedata):
# just use the first Mate Light available
rgba = len(framedata) == DISPLAY_WIDTH*DISPLAY_HEIGHT*4
global dbuf
np.copyto(dbuf, np.frombuffer(framedata, dtype=np.uint8))
np.copyto(dbuf[:640*(3+rgba)], np.frombuffer(framedata, dtype=np.uint8))
ml.matelight_send_frame(matelights, dbuf.ctypes.data_as(POINTER(c_uint8)), c_size_t(CRATES_X), c_size_t(CRATES_Y), c_float(BRIGHTNESS), rgba)

View file

@ -9,6 +9,7 @@ from collections import namedtuple, deque
import itertools
import threading
import random
import os
from ctypes import *
@ -160,7 +161,13 @@ if __name__ == '__main__':
elif userver.frame_da():
renderer = userver
else:
sendframe(next(defaulttexts))
static_noise = time() % 300 < 60
if static_noise:
foo = os.urandom(640)
frame = bytes([v for c in zip(list(foo), list(foo), list(foo)) for v in c ])
else:
frame = next(defaulttexts)
sendframe(frame)
#printframe(next(defaulttexts))
continue
for frame in renderer: