Skip to content

Commit beaa41f

Browse files
committed
fix sparklepulse to use _set_color
1 parent 7b5ba82 commit beaa41f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

adafruit_led_animation/animation/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,15 +185,15 @@ def color(self):
185185
def color(self, color):
186186
if self._color == color:
187187
return
188+
if isinstance(color, int):
189+
color = (color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF)
188190
self._set_color(color)
189191

190192
def _set_color(self, color):
191193
"""
192194
Called after the color is changed, which includes at initialization.
193195
Override as needed.
194196
"""
195-
if isinstance(color, int):
196-
color = (color >> 16 & 0xFF, color >> 8 & 0xFF, color & 0xFF)
197197
self._color = color
198198

199199
@property

adafruit_led_animation/animation/sparklepulse.py

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def __init__(
8080
)
8181
self._generator = pulse_generator(self._period, self, dotstar_pwm=dotstar)
8282

83+
def _set_color(self, color):
84+
self._color = color
85+
8386
def draw(self):
8487
self._sparkle_color = next(self._generator)
8588
super().draw()

0 commit comments

Comments
 (0)