Commit ac5ad742 authored by Aljaž Srebrnič's avatar Aljaž Srebrnič

So, I misunderstood what is_alive is supposed to do.

parent a28ab619
...@@ -30,6 +30,7 @@ class ColorManager(Thread): ...@@ -30,6 +30,7 @@ class ColorManager(Thread):
current_color = Color(0, 0, 0) current_color = Color(0, 0, 0)
activeFlag = True activeFlag = True
spi = spidev.SpiDev() spi = spidev.SpiDev()
running = True
def __init__(self): def __init__(self):
super().__init__() super().__init__()
...@@ -59,6 +60,9 @@ class ColorManager(Thread): ...@@ -59,6 +60,9 @@ class ColorManager(Thread):
if self.current_color.green > 0: if self.current_color.green > 0:
self.current_color.green -= 1 self.current_color.green -= 1
def stop(self):
self.running = False
def start_fade(self): def start_fade(self):
self.activeFlag = False self.activeFlag = False
...@@ -66,7 +70,7 @@ class ColorManager(Thread): ...@@ -66,7 +70,7 @@ class ColorManager(Thread):
self.unscaled_blue = 0 self.unscaled_blue = 0
def run(self): def run(self):
while self.is_alive(): while self.running:
if self.activeFlag: if self.activeFlag:
self.get_color() self.get_color()
else: else:
...@@ -111,6 +115,7 @@ def main(): ...@@ -111,6 +115,7 @@ def main():
cm.start_fade() cm.start_fade()
elif messagedata == b"abort": elif messagedata == b"abort":
cm.lights_off() cm.lights_off()
cm.stop()
else: else:
print("Unhandled message") print("Unhandled message")
......
Markdown is supported
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