aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2014-12-10 21:19:41 +0100
committerjaseg <code@jaseg.net>2014-12-10 21:19:41 +0100
commit3c329decfa20dd3f2bcd3beb1f512b4e3daf809e (patch)
tree68e461ef9f4573e28d5426ab4775f4ef2a3c8c11
parente36a4054f18973980a9321e84fd79ea38793a6a4 (diff)
parent2387b0de02f6d51b848498443f9e8697c20bac5a (diff)
downloadmatelight-3c329decfa20dd3f2bcd3beb1f512b4e3daf809e.tar.gz
matelight-3c329decfa20dd3f2bcd3beb1f512b4e3daf809e.tar.bz2
matelight-3c329decfa20dd3f2bcd3beb1f512b4e3daf809e.zip
Merge branch 'master' of matelight:matelight
Conflicts: host/server.py
-rw-r--r--firmware/main.c24
-rw-r--r--host/default.lines8
-rwxr-xr-xhost/server.py26
3 files changed, 37 insertions, 21 deletions
diff --git a/firmware/main.c b/firmware/main.c
index 52b6360..cc5c458 100644
--- a/firmware/main.c
+++ b/firmware/main.c
@@ -40,24 +40,24 @@
#define CRATE_SIZE (CRATE_WIDTH*CRATE_HEIGHT)
#define BUS_SIZE (CRATES_PER_BUS*CRATE_SIZE*BYTES_PER_PIXEL)
unsigned const char const BOTTLE_MAP[CRATE_SIZE] = {
- 17, 16, 15, 14, 13,
- 18, 9, 10, 11, 12,
- 19, 8, 7, 6, 5,
- 0, 1, 2, 3, 4
+ 4, 3, 2, 1, 0,
+ 5, 6, 7, 8,19,
+ 12, 11, 10, 9,18,
+ 13, 14, 15,16,17
};
unsigned const char const FUCKED_UP_BOTTLE_MAP[CRATE_SIZE] = {
- 3, 4, 5, 6, 7,
- 2, 11, 10, 9, 8,
- 1, 12, 13, 14, 15,
- 0, 19, 18, 17, 16
+ 16,17, 18,19, 0,
+ 15,14, 13,12, 1,
+ 8, 9, 10,11, 2,
+ 7, 6, 5, 4, 3
};
unsigned const char const CRATE_MAP[CRATE_COUNT] = {
- 0x07, 0x05, 0x03, 0x01, 0x10, 0x12, 0x14, 0x16,
- 0x06, 0x04, 0x02, 0x00, 0x11, 0x13, 0x15, 0x17,
- 0x26, 0x24, 0x22, 0x20, 0x31, 0x33, 0x35, 0x37,
- 0x27, 0x25, 0x23, 0x21, 0x30, 0x32, 0x34, 0x36
+ 0x36, 0x34, 0x32, 0x30, 0x11, 0x13, 0x15, 0x17,
+ 0x37, 0x35, 0x33, 0x31, 0x10, 0x12, 0x14, 0x16,
+ 0x27, 0x25, 0x23, 0x21, 0x01, 0x03, 0x05, 0x07,
+ 0x26, 0x24, 0x22, 0x20, 0x00, 0x02, 0x04, 0x06
};
#define SYSTICKS_PER_SECOND 100
diff --git a/host/default.lines b/host/default.lines
index ecf0862..ca3afda 100644
--- a/host/default.lines
+++ b/host/default.lines
@@ -1,3 +1,4 @@
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mabstraction is a type of decadence
\x1B[38;5;214mit's important to stay clean on all levels
\x1B[38;5;214mexpiring for love is beautiful but stupid
@@ -37,6 +38,7 @@
\x1B[38;5;214moccasionally principles are more valuable than people
\x1B[38;5;214ma sense of timing is the mark of genius
\x1B[38;5;214mexpressing anger is necessary
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mroutine is a link with the past
\x1B[38;5;214mtorture is barbaric
\x1B[38;5;214melaboration is a form of pollution
@@ -66,6 +68,7 @@
\x1B[38;5;214mideals are replaced by conventional goals at a certain age
\x1B[38;5;214mmost people are not fit to rule themselves
\x1B[38;5;214mguilt and self-laceration are indulgences
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mit's better to be lonely than to be with inferior people
\x1B[38;5;214mdying and coming back gives you considerable perspective
\x1B[38;5;214mabsolute submission can be a form of freedom
@@ -95,6 +98,7 @@
\x1B[38;5;214mchildren are the most cruel of all
\x1B[38;5;214mthe cruelest disappointment is when you let yourself down
\x1B[38;5;214mgo all out in romance and let the chips fall where they may
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mthe only way to be pure is to stay by yourself
\x1B[38;5;214mspending too much time on self-improvement is antisocial
\x1B[38;5;214mknowing yourself lets you understand others
@@ -124,6 +128,7 @@
\x1B[38;5;214mat times inactivity is preferable to mindless functioning
\x1B[38;5;214mmostly you should mind your own business
\x1B[38;5;214mthe mundane is to be cherished
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mselfishness is the most basic motivation
\x1B[38;5;214msloppy thinking gets worse over time
\x1B[38;5;214myou can't expect people to be something they're not
@@ -214,6 +219,7 @@
\x1B[38;5;214mpeople are boring unless they are extremists
\x1B[38;5;214mconfusing yourself is a way to stay honest
\x1B[38;5;214mstarvation is nature's way
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mhumor is a release
\x1B[38;5;214mcrime against property is relatively unimportant
\x1B[38;5;214mat times your unconsciousness is truer than your conscious mind
@@ -244,6 +250,7 @@
\x1B[38;5;214mthe idea of transcendence is used to obscure oppression
\x1B[38;5;214mpolitics is used for personal gain
\x1B[38;5;214meating too much is criminal
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mimposing order is man's vocation for chaos is hell
\x1B[38;5;214myou don't know what's what until you support yourself
\x1B[38;5;214mif you can't leave your mark give up
@@ -257,3 +264,4 @@
\x1B[38;5;214mfaithfulness is a social not a biological law
\x1B[38;5;214mrelativity is no boon to mankind
\x1B[38;5;214mmoderation kills the spirit
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
diff --git a/host/server.py b/host/server.py
index 025d534..c011c82 100755
--- a/host/server.py
+++ b/host/server.py
@@ -10,6 +10,7 @@ import itertools
import threading
import random
import os
+import sys
from ctypes import *
@@ -64,6 +65,7 @@ def printframe(fb):
def log(*args):
printlock.acquire()
print(strftime('\x1B[93m[%m-%d %H:%M:%S]\x1B[0m'), ' '.join(str(arg) for arg in args), '\x1B[0m')
+ sys.stdout.flush()
printlock.release()
class TextRenderer:
@@ -73,6 +75,7 @@ class TextRenderer:
def __iter__(self):
for i in range(-DISPLAY_WIDTH, self.width):
+ #print('Rendering text @ pos {}'.format(i))
yield render_text(self.text, i)
class MateLightUDPServer:
@@ -134,7 +137,7 @@ class MateLightTCPTextHandler(BaseRequestHandler):
data = str(self.request.recv(1024).strip(), 'UTF-8')
addr = self.client_address[0]
if len(data) > 140:
- self.request.sendall('TOO MUCH INFORMATION!\n')
+ self.request.sendall(b'TOO MUCH INFORMATION!\n')
return
log('\x1B[95mText from\x1B[0m {}: {}\x1B[0m'.format(addr, data))
renderqueue.append(TextRenderer(data))
@@ -150,11 +153,11 @@ userver = MateLightUDPServer()
userver.start()
defaultlines = [ TextRenderer(l[:-1].replace('\\x1B', '\x1B')) for l in open('default.lines').readlines() ]
-random.shuffle(defaultlines)
-defaulttexts = itertools.cycle(itertools.chain(*defaultlines))
+#random.shuffle(defaultlines)
+defaulttexts = itertools.chain(*defaultlines)
if __name__ == '__main__':
- #print('\033[?1049h'+'\n'*9)
+ print('\033[?1049h'+'\n'*9)
while True:
if renderqueue:
renderer = renderqueue.popleft()
@@ -167,13 +170,18 @@ if __name__ == '__main__':
frame = bytes([v for c in zip(list(foo), list(foo), list(foo)) for v in c ])
sleep(0.05)
else:
- frame = next(defaulttexts)
- sleep(0.05)
+ try:
+ frame = next(defaulttexts)
+ except StopIteration:
+ defaultlines = [ TextRenderer(l[:-1].replace('\\x1B', '\x1B')) for l in open('default.lines').readlines() ]
+ #random.shuffle(defaultlines)
+ defaulttexts = itertools.chain(*defaultlines)
sendframe(frame)
- #printframe(next(defaulttexts))
+# printframe(frame)
continue
+# sleep(0.1)
for frame in renderer:
sendframe(frame)
- sleep(0.05)
- #printframe(frame)
+# printframe(frame)
+# sleep(0.1)