Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ev3dev2/led.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ def all_off(self):
if not self.leds:
return

self.animate_stop()

for led in self.leds.values():
led.brightness = 0

Expand Down Expand Up @@ -401,7 +403,7 @@ def animate_police_lights(self, color1, color2, group1='LEFT', group2='RIGHT', s
def _animate_police_lights():
self.all_off()
even = True
duration_ms = duration * 1000
duration_ms = duration * 1000 if duration is not None else None
stopwatch = StopWatch()
stopwatch.start()

Expand All @@ -413,7 +415,7 @@ def _animate_police_lights():
self.set_color(group1, color2)
self.set_color(group2, color1)

if self.animate_thread_stop or stopwatch.value_ms >= duration_ms:
if self.animate_thread_stop or (duration_ms is not None and stopwatch.value_ms >= duration_ms):
break

even = not even
Expand Down