diff --git a/FlipdotSender.py b/FlipdotSender.py index d85cbd8..51ae798 100644 --- a/FlipdotSender.py +++ b/FlipdotSender.py @@ -106,11 +106,12 @@ class FlipdotSender(object): packet = self._array2packet(imgmaptmp) self._sock.sendto(bytes(packet), (self._udphost, self._udpport)) time.sleep(0.2) - if threadrunning==True: #if animation wasnt cancelled + if threadrunning==True: #if animation hasnt been cancelled self.sendPacket(imgmap) #send packet and save last-imagemap threadrunning=False else: self.sendPacket(imgmap) #send packet and save last-imagemap + def sendPacket(self, imgmap): packet = self._array2packet(imgmap) @@ -176,8 +177,7 @@ class FlipdotSender(object): else: draw.text((0,-1), text[0:splitpoint], font=font, fill=FlipdotSender.C_WHITE) draw.text((0,-1+currentfontsize), text[splitpoint:], font=font, fill=FlipdotSender.C_WHITE) - - + self._send(image,fadespeed) diff --git a/hangman.py b/hangman.py index 8c34fd7..50306df 100644 --- a/hangman.py +++ b/hangman.py @@ -49,12 +49,14 @@ class Hangman(object): #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nomenliste_de.txt" #self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/crodict_nomen.txt" self._wordlist="/home/pi/mqtt-to-flipdot/hangman/wordlists/nerdwords.txt" + #self._wordlist="./hangman/wordlists/nerdwords.txt" #<- use for local testing self._gamestate=0# 0=start 1=ingame 2=lose 3=win self._g_word="test" #word self._g_displword="" #display word self._g_chars="" #used characters self._hmdir="/home/pi/mqtt-to-flipdot/hangman/stdhm/" + #self._hmdir="./hangman/stdhm/" #<- use for local testing self._hmimg=[] self._maxfails=len( os.listdir(self._hmdir))-1 -1 #maxfails defined by files in directory, -1 -1 because win image diff --git a/mqtt-to-flipdot.py b/mqtt-to-flipdot.py index c87b1cc..8b368e2 100644 --- a/mqtt-to-flipdot.py +++ b/mqtt-to-flipdot.py @@ -57,7 +57,7 @@ def on_message(client, userdata, msg): if len(payload)>0 and payload[0]=='~': payload=payload[1:] #remove first char #flipdot.send_text(payload,25) #send_text with animation - flipthread=Thread(target=flipdot.send_text, args=(payload,25)) + flipthread=Thread(target=flipdot.send_text, args=(payload,64)) else: #flipdot.send_text(payload) #without animation flipthread=Thread(target=flipdot.send_text, args=(payload,))