aboutsummaryrefslogtreecommitdiff
path: root/NeoRuntime/Runtime/neo_runtime.py
diff options
context:
space:
mode:
authorJakob Stendahl <jakobste@uio.no>2021-10-21 19:28:20 +0200
committerJakob Stendahl <jakobste@uio.no>2021-10-21 19:28:20 +0200
commit6e53fd0dfd830d6d96206419c530c71fa4b3f4e6 (patch)
tree9034a4c9adf3a41c6eb492f2fe6ac06e434275dd /NeoRuntime/Runtime/neo_runtime.py
parentf243dc8d7527cde3d5b5a4f6e659cf7604f5ae2a (diff)
downloadLuxcena-Neo-6e53fd0dfd830d6d96206419c530c71fa4b3f4e6.tar.gz
Luxcena-Neo-6e53fd0dfd830d6d96206419c530c71fa4b3f4e6.zip
:sparkles: Add attempt at the "simulation"
Diffstat (limited to 'NeoRuntime/Runtime/neo_runtime.py')
-rw-r--r--NeoRuntime/Runtime/neo_runtime.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/NeoRuntime/Runtime/neo_runtime.py b/NeoRuntime/Runtime/neo_runtime.py
index b028530..3057f3c 100644
--- a/NeoRuntime/Runtime/neo_runtime.py
+++ b/NeoRuntime/Runtime/neo_runtime.py
@@ -116,11 +116,32 @@ class NeoRuntime:
ws.close()
last_send = time.perf_counter()
+
+ if self.__send_strip_buffer:
+ time.sleep(0.001)
+ buffer = [2]
+ for p in self.__strip.COLORSTATE:
+ buffer.append((p & 0x00FF0000) >> 16)
+ buffer.append((p & 0x0000FF00) >> 8)
+ buffer.append((p & 0x000000FF))
+ buffer = bytes(buffer)
+ for ws in w:
+ try:
+ ws.send(buffer)
+ except BrokenPipeError:
+ self.__s_clients.remove(ws)
+ ws.close()
+ time.sleep(0.001)
for rs in r:
if rs is self.__s:
c, a = self.__s.accept()
self.__s_clients.append(c)
+ try:
+ buf = bytes([3]) + bytes(json.dumps(self.__strip.pixelMatrix.matrix), "ascii")
+ c.send(buf)
+ except Exception as e:
+ print(e)
else:
data = rs.recv(128)
if not data: