Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit 3cb945a

Browse files
committed
Truncate brightness byte value, same as pixelbuf
1 parent e52c672 commit 3cb945a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

adafruit_pypixelbuf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ def _parse_color(self, value):
252252
# LED startframe is three "1" bits, followed by 5 brightness bits
253253
# then 8 bits for each of R, G, and B. The order of those 3 are configurable and
254254
# vary based on hardware
255-
# same as math.ceil(brightness * 31) & 0b00011111
256-
# Idea from https://www.codeproject.com/Tips/700780/Fast-floor-ceiling-functions
257-
w = (32 - int(32 - w * 31) & 0b00011111) | DOTSTAR_LED_START
255+
w = (int(w * 31) & 0b00011111) | DOTSTAR_LED_START
258256
elif (
259257
self._has_white
260258
and (isinstance(value, int) or len(value) == 3)

0 commit comments

Comments
 (0)