...
 
Commits (2)
...@@ -65,6 +65,7 @@ def main(): ...@@ -65,6 +65,7 @@ def main():
stopping.wait() stopping.wait()
stopping.clear() stopping.clear()
socket.send_string("events abort")
print("Removing callback...") print("Removing callback...")
stage.remove_callback(stage_changed) stage.remove_callback(stage_changed)
stage.remove() stage.remove()
......
...@@ -34,7 +34,10 @@ class ColorManager(Thread): ...@@ -34,7 +34,10 @@ class ColorManager(Thread):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.spi.open(1, 0) self.spi.open(1, 0)
ws2812.write2812(self.spi, [(0,0,0) * 4]) self.lights_off()
def lights_off(self):
ws2812.write2812(self.spi, [(0, 0, 0) * 4])
def get_color(self): def get_color(self):
if self.current_color.green + self.current_rand > 80: if self.current_color.green + self.current_rand > 80:
...@@ -106,6 +109,8 @@ def main(): ...@@ -106,6 +109,8 @@ def main():
elif messagedata == b"stage_2_separation": elif messagedata == b"stage_2_separation":
burn() burn()
cm.start_fade() cm.start_fade()
elif messagedata == b"abort":
cm.lights_off()
else: else:
print("Unhandled message") print("Unhandled message")
......
...@@ -45,6 +45,8 @@ def main(): ...@@ -45,6 +45,8 @@ def main():
separate_stage_one() separate_stage_one()
elif messagedata == b"stage_2_separation": elif messagedata == b"stage_2_separation":
separate_stage_two() separate_stage_two()
elif messagedata == b"abort":
prime_stages()
else: else:
print("Unhandled message") print("Unhandled message")
......
...@@ -53,6 +53,8 @@ def main(): ...@@ -53,6 +53,8 @@ def main():
pg.mixer.Channel(2).play(stageTwo) pg.mixer.Channel(2).play(stageTwo)
t = Timer(30.0, endMission) t = Timer(30.0, endMission)
t.start() t.start()
elif messagedata == b"abort":
endMission()
else: else:
print("Unhandled message") print("Unhandled message")
......