mirror of
https://github.com/brendanhaines/ECEN5458_Project.git
synced 2024-12-27 03:17:06 -07:00
more thread fixes
This commit is contained in:
parent
c09b17b9fb
commit
e66e7f1bd0
|
@ -139,7 +139,7 @@ def controller():
|
||||||
# TODO: replace sleep statement with something that doesn't depend on execution time of loop
|
# TODO: replace sleep statement with something that doesn't depend on execution time of loop
|
||||||
time.sleep(sample_interval)
|
time.sleep(sample_interval)
|
||||||
|
|
||||||
control_thread = threading.Thread(target=controller)
|
control_thread = None
|
||||||
|
|
||||||
# Callback functions
|
# Callback functions
|
||||||
def update_plots(attrname=None, old=None, new=None):
|
def update_plots(attrname=None, old=None, new=None):
|
||||||
|
@ -163,13 +163,18 @@ def start_controller(attrname=None, old=None, new=None):
|
||||||
global control_thread
|
global control_thread
|
||||||
global control_thread_run
|
global control_thread_run
|
||||||
control_thread_run = True
|
control_thread_run = True
|
||||||
|
control_thread = threading.Thread(target=controller)
|
||||||
control_thread.start()
|
control_thread.start()
|
||||||
|
|
||||||
def stop_controller(attrname=None, old=None, new=None):
|
def stop_controller(attrname=None, old=None, new=None):
|
||||||
global control_thread
|
global control_thread
|
||||||
global control_thread_run
|
global control_thread_run
|
||||||
|
try:
|
||||||
control_thread_run = False
|
control_thread_run = False
|
||||||
control_thread.join()
|
control_thread.join()
|
||||||
|
control_thread = None
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# GUI elements
|
# GUI elements
|
||||||
cal_white_button = Button(label="Cal White")
|
cal_white_button = Button(label="Cal White")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user