mirror of
https://github.com/brendanhaines/ECEN5458_Project.git
synced 2024-12-26 10:57:55 -07:00
maybe fix threading stuff
This commit is contained in:
parent
0fa738e326
commit
c09b17b9fb
|
@ -81,9 +81,9 @@ time_plot.line('t', 'e', source=time_plot_source, line_width=3, line_alpha=0.6,
|
||||||
time_plot.line('t', 'c', source=time_plot_source, line_width=3, line_alpha=0.6, legend_label="c(t)", line_color = "green")
|
time_plot.line('t', 'c', source=time_plot_source, line_width=3, line_alpha=0.6, legend_label="c(t)", line_color = "green")
|
||||||
|
|
||||||
# Controller thread
|
# Controller thread
|
||||||
controller_thread_run = False
|
control_thread_run = False
|
||||||
|
|
||||||
def control_thread():
|
def controller():
|
||||||
global brightness
|
global brightness
|
||||||
global time_data
|
global time_data
|
||||||
global servos
|
global servos
|
||||||
|
@ -139,7 +139,7 @@ def control_thread():
|
||||||
# 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=control_thread)
|
control_thread = threading.Thread(target=controller)
|
||||||
|
|
||||||
# Callback functions
|
# Callback functions
|
||||||
def update_plots(attrname=None, old=None, new=None):
|
def update_plots(attrname=None, old=None, new=None):
|
||||||
|
@ -161,11 +161,13 @@ def cal_black(attrname=None, old=None, new=None):
|
||||||
|
|
||||||
def start_controller(attrname=None, old=None, new=None):
|
def start_controller(attrname=None, old=None, new=None):
|
||||||
global control_thread
|
global control_thread
|
||||||
|
global control_thread_run
|
||||||
control_thread_run = True
|
control_thread_run = True
|
||||||
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
|
||||||
control_thread_run = False
|
control_thread_run = False
|
||||||
control_thread.join()
|
control_thread.join()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user