Skip to content

Default pixel_order and bpp don't match #46

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
caternuson opened this issue May 22, 2019 · 14 comments
Closed

Default pixel_order and bpp don't match #46

caternuson opened this issue May 22, 2019 · 14 comments

Comments

@caternuson
Copy link
Contributor

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

@ladyada
Copy link
Member

ladyada commented May 22, 2019

oops yeah we are usually wordy in the definitions - we could warn people for now they must define the color order?

@caternuson
Copy link
Contributor Author

Just to throw out the suggestion - how about removing bpp from the parameter list? pixel_order is all that is really needed. This would maybe break some things, but would be cleaner. And then any older examples that are still using bpp should be updated to use pixel_order.

@ladyada
Copy link
Member

ladyada commented May 22, 2019

im ok with that, do any of our examples use bpp?

@caternuson
Copy link
Contributor Author

All the examples here are using pixel_order. Not sure what else might be out there.

@tannewt You were more involved in the bpp approach. Any reason to keep it?

@tannewt
Copy link
Member

tannewt commented May 22, 2019

I'd ask @rhooper since he's got some big changes in the pipe for the RGB led libs.

@caternuson
Copy link
Contributor Author

@rhooper - see above. What are the changes?

@caternuson
Copy link
Contributor Author

@tannewt Any idea of status of above w.r.t. "big changes"? I'm in favor of getting rid of bpp in favor of just using pixel_order.

@rhooper
Copy link
Contributor

rhooper commented Aug 21, 2019

The changes will be to use _pixelbuf which will be using a string to compute everything to do with the byte order and bpp. Bpp will then be able to be based on that string. For backwards compatibility we can check its a sane value and ignore otherwise.

@caternuson
Copy link
Contributor Author

@rhooper thanks. can you link to where this is being done? it's still not clear to me how this applies here.

@rhooper
Copy link
Contributor

rhooper commented Aug 21, 2019

@rhooper
Copy link
Contributor

rhooper commented Jan 14, 2020

@caternuson is this still an issue?

@caternuson
Copy link
Contributor Author

@rhooper Thanks! Yah, this is probably fixed with the new logic. Let's close this for now. I think it might still be worth considering dumping bpp all together and use pixel_order for everything. But we can defer that to a new separate issue.

@houshmandX
Copy link

Hi all,

I have recently purchased a NeoPixel Ring - 12 x 5050 RGB LED from amazon.

I have also followed the link https://cdn-learn.adafruit.com/downloads/pdf/neopixels-on-raspberry-pi.pdf
to install NeoPixel Library.

So, I can turn the LEDS, but they are not acting as desired, for instance, colors are randomly changing/blinking.

So, for the test, I want to turn all the LEDs on and be colored red:

`import time
import board
import neopixel

pixel_pin = board.D18
num_pix = 12
order = neopixel.GRBW # won't matter if I use orders, RGB, RGBW, GRB

pixel = neopixel.NeoPixel(pixel_pin, num_pix, brightness = 0.2, auto_write = False, pixel_order = order)

while True:
pixel.fill((255,0,0))
pixel.show()
`

what am I missing, why, few of LED gets change colors, blinking and etc.

@caternuson
Copy link
Contributor Author

@houshmandX Please post in the forums with photos of your setup:
https://forums.adafruit.com/

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

No branches or pull requests

5 participants