From 6c7ef3aaaccbb3a4e96418bf7e04738093cc5a7b Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Wed, 27 May 2020 20:08:01 -0400 Subject: [PATCH 1/2] fix for rainbowcomet on regular python (Fixes #32) --- adafruit_led_animation/animation/comet.py | 6 +++--- adafruit_led_animation/animation/rainbowcomet.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/adafruit_led_animation/animation/comet.py b/adafruit_led_animation/animation/comet.py index f61969c..d18d534 100644 --- a/adafruit_led_animation/animation/comet.py +++ b/adafruit_led_animation/animation/comet.py @@ -94,7 +94,7 @@ def __init__( def _recompute_color(self, color): pass - def __recompute_color(self, color): + def _comet_recompute_color(self, color): self._comet_colors = [BLACK] + [ [ int(color[rgb] * ((n * self._color_step) + self._color_offset)) @@ -115,7 +115,7 @@ def _comet_generator(self): cycle_passes = 0 while True: if self._color != self._computed_color or not self._comet_colors: - self.__recompute_color(self._color) + self._comet_recompute_color(self._color) colors = self._reverse_comet_colors if self.reverse else self._comet_colors for start in self._get_range(num_pixels): @@ -126,7 +126,7 @@ def _comet_generator(self): if start <= 0: num_visible = self._tail_length + start self.pixel_object[0:num_visible] = colors[ - self._tail_length - num_visible : + self._tail_length - num_visible: ] else: self.pixel_object[start : start + end] = colors[0:end] diff --git a/adafruit_led_animation/animation/rainbowcomet.py b/adafruit_led_animation/animation/rainbowcomet.py index 01c65cc..785b795 100644 --- a/adafruit_led_animation/animation/rainbowcomet.py +++ b/adafruit_led_animation/animation/rainbowcomet.py @@ -84,7 +84,7 @@ def _calc_brightness(self, n, color): color = (color & 0xFF, ((color & 0xFF00) >> 8), (color >> 16)) return [int(i * brightness) for i in color] - def __recompute_color(self, color): + def _comet_recompute_color(self, color): factor = int(256 / self._tail_length) self._comet_colors = [BLACK] + [ self._calc_brightness( From 6433e785db4989f30a0c5a06a94f5600e2b37895 Mon Sep 17 00:00:00 2001 From: Roy Hooper Date: Thu, 28 May 2020 13:59:38 -0400 Subject: [PATCH 2/2] black... --- adafruit_led_animation/animation/comet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_led_animation/animation/comet.py b/adafruit_led_animation/animation/comet.py index d18d534..0d13cf9 100644 --- a/adafruit_led_animation/animation/comet.py +++ b/adafruit_led_animation/animation/comet.py @@ -126,7 +126,7 @@ def _comet_generator(self): if start <= 0: num_visible = self._tail_length + start self.pixel_object[0:num_visible] = colors[ - self._tail_length - num_visible: + self._tail_length - num_visible : ] else: self.pixel_object[start : start + end] = colors[0:end]