Commit c8832518 authored by Christian Wander's avatar Christian Wander
Browse files

rename and reformat

parent bbe276aa
......@@ -12,12 +12,12 @@ def main_page():
def hello_method():
return render_template('hello.html', name="foo")
@app.route('/threadfun')
@app.route('/start')
def threadfun():
t.doit()
return "Started work."
@app.route('/threadstop')
@app.route('/stop')
def threadstop():
t.stopit()
return "Stopped work"
\ No newline at end of file
import threading, queue
import threading
import queue
import time
import pixelframe.blink as blink
......@@ -6,17 +7,18 @@ import sacn
running = False
def doit():
global running
if running is True:
print(">> DEBUG: already running.")
return
return
print(f'>> Starting a thread ...')
running = True
x = threading.Thread(target=threaded_function, daemon=True)
x = threading.Thread(target=display_pixels, daemon=True)
x.start()
print(f'>> Thread started.')
......@@ -24,9 +26,9 @@ def doit():
def stopit():
global running
running = False
def threaded_function():
def display_pixels():
universe = 1
sender = sacn.sACNsender()
......@@ -39,7 +41,6 @@ def threaded_function():
pic = blink.Thing(file="data/cyber-12x12.png")
sender[universe].dmx_data = pic.snake_tuple()
time.sleep(2)
sender.stop()
print(f'>> Finished work within thread!')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment