Skip to content

Commit e11b25b

Browse files
authored
Update matrix_11x7.py
The new formula does not give the same result as the previous one, so it is both corrected and "optimized". With previous formula, the screen was mirror upside down. That was visible using the font scrolling demo. Also tested with display.pixel(0,0,50) that light up the top left pixel. All the tests were performed by Michael Horne: https://twitter.com/recantha/status/1369276823620751362?s=20
1 parent a85d015 commit e11b25b

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

adafruit_is31fl3731/matrix_11x7.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,4 @@ def __init__(self, i2c, address=0x75):
4242
@staticmethod
4343
def pixel_addr(x, y):
4444
"""Translate an x,y coordinate to a pixel index."""
45-
if x <= 5:
46-
r = x * 16 + y
47-
else:
48-
r = (x - 5) * 16 + y - 8
49-
return r
45+
return (x << 4) - y + (6 if x <= 5 else -82)

0 commit comments

Comments
 (0)