Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add period property to pulse and sparklepulse, fix typo #123

Merged
merged 1 commit into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
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
14 changes: 13 additions & 1 deletion adafruit_led_animation/animation/pulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Pulse(Animation):
:param period: Period to pulse the LEDs over. Default 5.
:param breath: Duration to hold minimum and maximum intensity levels. Default 0.
:param min_intensity: Lowest brightness level of the pulse. Default 0.
:param max_intensity: Highest brightness elvel of the pulse. Default 1.
:param max_intensity: Highest brightness level of the pulse. Default 1.
"""

# pylint: disable=too-many-arguments
Expand Down Expand Up @@ -80,3 +80,15 @@ def reset(self):
)

self._generator = pulse_generator(self._period, self, dotstar_pwm=dotstar)

@property
def period(self):
"""
Period to pulse the LEDs over in seconds
"""
return self._period

@period.setter
def period(self, new_value):
self._period = new_value
self.reset()
18 changes: 18 additions & 0 deletions adafruit_led_animation/animation/sparklepulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,21 @@ def draw(self):

def after_draw(self):
self.show()

@property
def period(self):
"""
Period to pulse the LEDs over in seconds
"""
return self._period

@period.setter
def period(self, new_value):
self._period = new_value
self.reset()

def reset(self):
dotstar = len(self.pixel_object) == 4 and isinstance(
self.pixel_object[0][-1], float
)
self._generator = pulse_generator(self._period, self, dotstar_pwm=dotstar)
Loading