aboutsummaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorjaseg <jaseg@jaseg.net>2014-03-10 00:31:05 +0100
committerjaseg <jaseg@jaseg.net>2014-03-10 00:31:05 +0100
commit6503863333020a27a713d28ebc42cf2225dfca28 (patch)
tree026c04042f6e831666bcc9463566c8f9bb3265a0 /host
parent97a0b8b17118a11e837ce767e0d01b69576227c2 (diff)
downloadmatelight-6503863333020a27a713d28ebc42cf2225dfca28.tar.gz
matelight-6503863333020a27a713d28ebc42cf2225dfca28.tar.bz2
matelight-6503863333020a27a713d28ebc42cf2225dfca28.zip
Fixed alpha handling, added noise
Diffstat (limited to 'host')
-rw-r--r--host/matelight.py2
-rwxr-xr-xhost/server.py9
2 files changed, 9 insertions, 2 deletions
diff --git a/host/matelight.py b/host/matelight.py
index d473cc0..1bafe66 100644
--- a/host/matelight.py
+++ b/host/matelight.py
@@ -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)
diff --git a/host/server.py b/host/server.py
index 3b99b4e..2660f42 100755
--- a/host/server.py
+++ b/host/server.py
@@ -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: