Skip to content

Commit f16e519

Browse files
committed
Corrected variable scoping
1 parent fc1aefa commit f16e519

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

adafruit_led_animation/animation/pulse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ class Pulse(Animation):
4646
def __init__(self, pixel_object, speed, color, period=5, breath=0, min_intensity=0, max_intensity=1, name=None):
4747
super().__init__(pixel_object, speed, color, name=name)
4848
self._period = period
49-
self._breath = breath
50-
self._min_intensity = min_intensity
51-
self._max_intensity = max_intensity
49+
self.breath = breath
50+
self.min_intensity = min_intensity
51+
self.max_intensity = max_intensity
5252
self._generator = None
5353
self.reset()
5454

adafruit_led_animation/animation/sparklepulse.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ def __init__(
5555
min_intensity=0,
5656
name=None,
5757
):
58-
self._max_intensity = max_intensity
59-
self._min_intensity = min_intensity
6058
self._period = period
61-
self._breath = breath
59+
self.breath = breath
60+
self.min_intensity = min_intensity
61+
self.max_intensity = max_intensity
6262
dotstar = len(pixel_object) == 4 and isinstance(pixel_object[0][-1], float)
6363
super().__init__(
6464
pixel_object, speed=speed, color=color, num_sparkles=1, name=name

adafruit_led_animation/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ def pulse_generator(period: float, animation_object, dotstar_pwm=False):
322322
:param animation_object: An animation object to interact with.
323323
:param dotstar_pwm: Whether to use the dostar per pixel PWM value for brightness control.
324324
"""
325-
period = int((period + (animation_object._breath * 2)) * MS_PER_SECOND)
326-
breath = int(animation_object._breath * MS_PER_SECOND)
325+
period = int((period + (animation_object.breath * 2)) * MS_PER_SECOND)
326+
breath = int(animation_object.breath * MS_PER_SECOND)
327327
half_period = period // 2
328328

329329
last_update = monotonic_ms()
@@ -339,11 +339,11 @@ def pulse_generator(period: float, animation_object, dotstar_pwm=False):
339339
last_pos = pos
340340
if pos > half_period:
341341
pos = period - pos
342-
intensity = animation_object._min_intensity + ((pos / (half_period - breath)) * (animation_object._max_intensity - animation_object._min_intensity))
342+
intensity = animation_object.min_intensity + ((pos / (half_period - breath)) * (animation_object.max_intensity - animation_object.min_intensity))
343343
if pos < half_period and pos > (half_period - breath):
344-
intensity = animation_object._max_intensity
344+
intensity = animation_object.max_intensity
345345
if pos > (period - breath):
346-
intensity = animation_object._min_intensity
346+
intensity = animation_object.min_intensity
347347
if dotstar_pwm:
348348
fill_color = (
349349
animation_object.color[0],

0 commit comments

Comments
 (0)