Skip to content

Default pixel_order and bpp don't match #46

Closed
@caternuson

Description

@caternuson

If NeoPixels are created without specifying a bpp or a pixel_order:

pixels = neopixel.NeoPixel(board.D18, 8)

then this would get used:

if pixel_order is None:
self.order = GRBW
self.bpp = bpp

and bpp=3 by default:

 def __init__(self, pin, n, *, bpp=3, brightness=1.0, auto_write=True, pixel_order=None):

so you end up with bpp=3 and GRBW for pixel_order, which is bpp=4.

This is my bad, since it was introduced with #24 to fix #1. I think there was some attempt to maintain backwards compatibility with the older style of using bpp only. So that's why both bpp and pixel_order are still there:
#1 (comment)

But might be good to somehow check and protect against this:
https://forums.adafruit.com/viewtopic.php?f=47&t=151980

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions