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 min and max_intensity feature back to Pulse animation #53

Open
rdagger opened this issue Jun 22, 2020 · 4 comments
Open

Add min and max_intensity feature back to Pulse animation #53

rdagger opened this issue Jun 22, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@rdagger
Copy link

rdagger commented Jun 22, 2020

After upgrading to the latest Circuit Python Bundle (circuitpython-bundle-5.x-mpy-20200621), I'm getting the following error with the adafruit_led_animation library on the Feather nRF52840 Express:
File "code.py", line 7, in TypeError: 'module' object is not callable
Here is a sample program to reproduce the error:

from adafruit_led_animation.animation import Pulse, Solid
import adafruit_led_animation.color as color
from neopixel import NeoPixel
from time import sleep
from board import NEOPIXEL
pixel = NeoPixel(NEOPIXEL, 1)
solid = Solid(pixel, color.GREEN)  # THIS LINE THROWS THE ERROR
solid.animate()  
sleep(4)

The code works with circuitpython-bundle-5.x-mpy-20200516
The code stops working with circuitpython-bundle-5.x-mpy-20200518

I'm running CircuitPython 5.4.0-beta.1-43-g1504d9005 on 2020-06-22; on Feather nRF52840 Express.

@tannewt tannewt transferred this issue from adafruit/Adafruit_CircuitPython_Bundle Jun 22, 2020
@tannewt
Copy link
Member

tannewt commented Jun 22, 2020

Looks like it was 2.0.0 that was included. The notes are here: https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation/releases/2.0.0

Here is an example change: cbfa114#diff-879798843e31cea6b37d583453edd26f

It looks like you may need to modify the first import for another level of abstraction.

@rdagger
Copy link
Author

rdagger commented Jun 23, 2020

Thanks that worked! Unfortunately, it looks like the min_intensity and max_intensity parameters have been removed from the Pulse animation. Any chance of getting those back? It really helps to dial in a smooth LED pulse.

class Pulse(Animation):
    """
    Pulse all pixels a single color.
    :param pixel_object: The initialised LED object.
    :param int speed: Animation refresh rate in seconds, e.g. ``0.1``.
    :param color: Animation color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
    :param period: Period to pulse the LEDs over.  Default 5.
    :param max_intensity: The maximum intensity to pulse, between 0 and 1.0.  Default 1.
    :param min_intensity: The minimum intensity to pulse, between 0 and 1.0.  Default 0.
    """


class Pulse(Animation):
    """
    Pulse all pixels a single color.
    :param pixel_object: The initialised LED object.
    :param float speed: Animation refresh rate in seconds, e.g. ``0.1``.
    :param color: Animation color in ``(r, g, b)`` tuple, or ``0x000000`` hex format.
    :param period: Period to pulse the LEDs over.  Default 5.
    """

@rdagger
Copy link
Author

rdagger commented Jun 23, 2020

Also the min_intensity and max_intensity parameters are still present in the SparklePulse animation but don't appear to be wired up.

@rhooper
Copy link

rhooper commented Jun 26, 2020

Good catch on SparklePulse.

Restoring min/max intensity shouldn't be difficult.

With regards to the import issue, I'd love to add backward compatibility for imports, but will need to test see how that affects memory use.

@evaherrada evaherrada added the bug Something isn't working label Jun 30, 2020
@kattni kattni added enhancement New feature or request and removed bug Something isn't working labels Nov 3, 2021
@kattni kattni changed the title adafruit_led_animation Add min and max_intensity feature back to Pulse animation Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants