changed thread running condition to .isAlive()
This commit is contained in:
parent
c2804d8ac1
commit
b3132e31cb
|
@ -41,17 +41,24 @@ def on_message(client, userdata, msg):
|
||||||
text = payload
|
text = payload
|
||||||
|
|
||||||
#flipdot.send_marquee(text, speed)
|
#flipdot.send_marquee(text, speed)
|
||||||
if flipthread is not None:
|
if flipthread is not None and flipthread.isAlive():
|
||||||
flipdot.stopAnimation()
|
flipdot.stopAnimation()
|
||||||
|
while flipthread.isAlive():
|
||||||
|
flipdot.stopAnimation() #try to stop animation
|
||||||
|
time.sleep(0.1)
|
||||||
flipthread.join() #wait for thread to finish
|
flipthread.join() #wait for thread to finish
|
||||||
|
|
||||||
flipthread=Thread(target=flipdot.send_marquee, args=(text,speed))
|
flipthread=Thread(target=flipdot.send_marquee, args=(text,speed))
|
||||||
flipthread.start()
|
flipthread.start()
|
||||||
|
|
||||||
if msg.topic == "raum2/flipdot/text/set":
|
if msg.topic == "raum2/flipdot/text/set":
|
||||||
payload = msg.payload.decode("utf-8")
|
payload = msg.payload.decode("utf-8")
|
||||||
|
|
||||||
if flipthread is not None:
|
if flipthread is not None and flipthread.isAlive():
|
||||||
flipdot.stopAnimation()
|
flipdot.stopAnimation()
|
||||||
|
while flipthread.isAlive():
|
||||||
|
flipdot.stopAnimation() #try to stop animation
|
||||||
|
time.sleep(0.1)
|
||||||
flipthread.join()
|
flipthread.join()
|
||||||
|
|
||||||
if len(payload)>0 and payload[0]=='~':
|
if len(payload)>0 and payload[0]=='~':
|
||||||
|
|
Loading…
Reference in New Issue