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

Return the correct value for rgb_color in get_pixel_rgb #55

Closed leewillis77 closed 1 year ago

leewillis77 commented 1 year ago

Fixes the issue where get_pixel_rgb() returns an incorrect value for rgb_color due to a bit-shifting error.

Script to show the issue:

#!/usr/bin/python3

from apa102_pi.driver import apa102

strip = apa102.APA102(30, 'rgb')
strip.clear_strip()
strip.set_pixel_rgb(1, 8421504, bright_percent=100)
stored_data = strip.get_pixel_rgb(1)
print('color returned: ' + str(stored_data['rgb_color']))

The expected output is: color returned: 8421504

The actual output is: color returned: 32896

leewillis77 commented 1 year ago

Thanks for the quick merge & release!