Skip to content

Make buf be the same #68

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

Closed
wants to merge 3 commits into from
Closed

Make buf be the same #68

wants to merge 3 commits into from

Conversation

rhooper
Copy link
Contributor

@rhooper rhooper commented Jan 18, 2020

This change should in theory make .buf behave the same as it did before, by making it the before-adjustment buffer by having NeoPixel hold onto the two buffers and adding a .buf property.

@caternuson HTH

@ladyada ladyada self-requested a review January 18, 2020 23:30
@@ -112,9 +112,11 @@ def __init__(self, pin, n, *, bpp=3, brightness=1.0, auto_write=True, pixel_orde
order[pixel_order] = order_chars[char_no]
pixel_order = ''.join(order)

super().__init__(n, bytearray(self.n * bpp),
self._buf = bytearray(self.n * bpp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally we would not allocate two buffers if they are not needed - the original code only alloc'd a new buffer when brightness was < 1

@rhooper rhooper closed this Jan 19, 2020
@rhooper rhooper reopened this Jan 19, 2020
"""
return self._rawbuf

@buf.setter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't support setting. NeoPixel_SPI and users shouldn't be doing this.

@tannewt
Copy link
Member

tannewt commented Jan 22, 2020

As of adafruit/Adafruit_CircuitPython_NeoPixel_SPI#10 NeoPixel SPI uses PixelBuf directly so this is no longer needed. Thanks anyway!

@tannewt tannewt closed this Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants