Compare commits

..

18 Commits

Author SHA1 Message Date
interfisch 83ca29d94e Merge branch 'master' into deploy 2017-10-26 23:51:28 +02:00
interfisch 606207d27c Merge branch 'master' into deploy 2017-05-20 20:53:16 +02:00
interfisch 9c607bf901 deleted .gitlab-ci.yml 2017-03-02 20:15:05 +01:00
interfisch b85e9eeb88 conflict solved, maybe 2017-02-23 22:14:44 +01:00
interfisch ceb0f3dc46 Merge branch 'master' into deploy 2017-02-18 20:35:17 +01:00
interfisch 9dcedb1c45 conflict! .gitlab-ci.yml deletion added. hopefully this commit doesnt explode and kill my whole family o.0 2017-02-18 20:09:36 +01:00
interfisch f9e69a8bb6 Merge branch 'master' into deploy 2017-02-17 01:36:02 +01:00
interfisch e0fc46af48 Merge branch 'master' into deploy 2017-02-17 01:29:52 +01:00
interfisch ee3915b62e Merge branch 'master' into deploy 2017-02-17 01:16:00 +01:00
Stefan Kinzel e2ccafac89 resolved conflict 2017-02-17 01:02:01 +01:00
Stefan Kinzel 0686597fb2 yadt 2017-02-17 00:56:37 +01:00
Stefan Kinzel c9d48ca25a yadt 2017-02-17 00:55:11 +01:00
Stefan Kinzel 961538b940 yadt 2017-02-17 00:36:41 +01:00
Stefan Kinzel 3e1405856d yadt 2017-02-17 00:28:21 +01:00
Stefan Kinzel 419aa5e3f5 yet another deploy test 2017-02-17 00:24:25 +01:00
Stefan Kinzel 21ab8e990b Merge branch 'master' into deploy 2017-02-17 00:22:35 +01:00
Stefan Kinzel 2794b5c762 next deploy-test 2017-02-17 00:01:21 +01:00
Stefan Kinzel b32c78d4dc changed ip to ::1 (and first deploy-test) 2017-02-16 23:16:08 +01:00
3 changed files with 54 additions and 97 deletions

View File

@ -134,17 +134,6 @@ class FlipdotSender(object):
self._sock.sendto(bytes(packet), (self._udphost, self._udpport)) self._sock.sendto(bytes(packet), (self._udphost, self._udpport))
def send_binimage(self, data,fadespeed=0): #works like send_bytes, but enables fadeanimation
image = Image.new("RGBA", self._img_size, FlipdotSender.C_BLACK)
draw = ImageDraw.Draw(image)
draw.fontmode = "1"
for i,d in enumerate(data):
if d=="1":
draw.point((i%self._img_size[0],int(i/self._img_size[0])), fill=FlipdotSender.C_WHITE)
self._send(image,fadespeed)
def send_text(self, text,fadespeed=0): def send_text(self, text,fadespeed=0):
image = Image.new("RGBA", self._img_size, FlipdotSender.C_BLACK) image = Image.new("RGBA", self._img_size, FlipdotSender.C_BLACK)

View File

@ -48,7 +48,7 @@ class Hangman(object):
self._fo_word2= (15, 7) #(15,7) self._fo_word2= (15, 7) #(15,7)
#self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nomenliste_de.txt" #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nomenliste_de.txt"
#self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/wordsonly.txt" #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/wordsonly.txt"
self._wordlist="/root/mqtt-to-flipdot/hangman/wordlists/wordsonly.txt" #<- on flipdot pi self._wordlist="/root/mqtt-to-flipdot/hangman/wordlists/wordsonly.txt"
#self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nerdwords.txt" #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nerdwords.txt"
#self._wordlist="./hangman/wordlists/nerdwords.txt" #<- use for local testing #self._wordlist="./hangman/wordlists/nerdwords.txt" #<- use for local testing
@ -58,7 +58,7 @@ class Hangman(object):
self._g_chars="" #used characters self._g_chars="" #used characters
# self._hmdir="/home/pi/mqtt-to-flipdot/hangman/stdhm/" # self._hmdir="/home/pi/mqtt-to-flipdot/hangman/stdhm/"
self._hmdir="/root/mqtt-to-flipdot/hangman/stdhm/" #<- on flipdot pi self._hmdir="/root/mqtt-to-flipdot/hangman/stdhm/"
#self._hmdir="./hangman/stdhm/" #<- use for local testing #self._hmdir="./hangman/stdhm/" #<- use for local testing
self._hmimg=[] self._hmimg=[]

View File

@ -72,55 +72,21 @@ def on_message(client, userdata, msg):
flipthread.start() flipthread.start()
if mode!="inuse" and msg.topic == "raum2/flipdot/textFull/set": #scale/break text automatically if msg.topic == "raum2/flipdot/textFull/set": #scale/break text automatically
#mode="inuse" mode="inuse"
#updateTimeout() updateTimeout()
payload = msg.payload.decode("utf-8") payload = msg.payload.decode("utf-8")
if flipthread is not None and flipthread.isAlive():
flipdot.stopAnimation()
while flipthread.isAlive():
flipdot.stopAnimation() #try to stop animation
time.sleep(0.1)
flipthread.join()
if len(payload)>0 and payload[0]=='~': if len(payload)>0 and payload[0]=='~':
payload=payload[1:] payload=payload[1:]
#flipdot.send_textFull(payload,50) flipdot.send_textFull(payload,50)
flipthread=Thread(target=flipdot.send_textFull, args=(payload,64)) flipdot.send_textFull(payload)
else:
#flipdot.send_textFull(payload)
flipthread=Thread(target=flipdot.send_textFull, args=(payload,))
flipthread.start()
if msg.topic == "raum2/flipdot/image/set": if msg.topic == "raum2/flipdot/image/set":
'''
mode="inuse" mode="inuse"
updateTimeout() updateTimeout()
payload = msg.payload.decode("utf-8") payload = msg.payload.decode("utf-8")
print(payload) print(payload)
flipdot.send_bytes(payload) flipdot.send_bytes(payload)
'''
payload = msg.payload.decode("utf-8")
if flipthread is not None and flipthread.isAlive():
flipdot.stopAnimation()
while flipthread.isAlive():
flipdot.stopAnimation() #try to stop animation
time.sleep(0.1)
flipthread.join()
if len(payload)>0 and payload[0]=='~':
payload=payload[1:]
#flipdot.send_textFull(payload,50)
flipthread=Thread(target=flipdot.send_binimage, args=(payload,64))
else:
#flipdot.send_textFull(payload)
flipthread=Thread(target=flipdot.send_binimage, args=(payload,))
flipthread.start()
@ -167,7 +133,7 @@ hangman= Hangman("localhost", 2323,flipdot)
client = mqtt.Client() client = mqtt.Client()
client.on_connect = on_connect client.on_connect = on_connect
client.on_message = on_message client.on_message = on_message
client.connect("mqtt.ctdo.de", 1883, 60) client.connect("raum.ctdo.de", 1883, 60)
client.loop_start() client.loop_start()
@ -184,3 +150,5 @@ while True:
timeout=0 timeout=0
time.sleep(2) time.sleep(2)