tinue / apa102-pi

Pure Python library to drive APA102 LED stripes; Use with Raspberry Pi.
GNU General Public License v2.0
201 stars 71 forks source link

Allow individual pixel brightness to be set. #12

Closed jmb closed 7 years ago

jmb commented 7 years ago

This change adds an optional parameter to the setPixel and setPixelRGB functions which allows individual pixel brightness settings to made. If left off, the default is to use the globalBrightness value.

tinue commented 7 years ago

Thank you for the pull request! Right now, I have no Pi Zero soldered to the strips, so I can't test your changes. They look good, but I would still like to see it working first ;) So please give me some time, before I merge.

One more thing: The global brightness is very useful to limit the current with large strips. So an even better change would be to have the local brightness relative to the global one. For example, if the local brightness is 31, the pixel would have the global brightness value (say 10). If it is 15, then the value would be 5. For full control, one would simply set the global brightness to 31.

jmb commented 7 years ago

Great idea, I'll have a look at my code and update - should be pretty straightforward.