Skip to content

Commit f6de8b0

Browse files
committed
apply same rotation logic to 64x48
1 parent 16d621d commit f6de8b0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

adafruit_displayio_ssd1306.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,21 @@ def __init__(self, bus: Union[FourWire, I2CDisplayBus], **kwargs) -> None:
8989
col_offset = (
9090
0 if width == 128 else (128 - width) // 2
9191
) # https://github.com/micropython/micropython/pull/7411
92-
row_offset = (
93-
col_offset if (kwargs["height"] != 48 or kwargs["width"] != 64) else 0
94-
) # fix for 0.66" 64x48 OLED
92+
row_offset = col_offset
93+
94+
# for 64x48
95+
if kwargs["height"] == 48 and kwargs["width"] == 64:
96+
col_offset = (128 - kwargs["width"]) // 2
97+
row_offset = 0
98+
99+
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
100+
init_sequence[16] = kwargs["height"] - 1
101+
kwargs["height"] = height
102+
kwargs["width"] = width
95103

96104
# for 72x40
97105
if kwargs["height"] == 40 and kwargs["width"] == 72:
98-
col_offset = 28
106+
col_offset = (128 - kwargs["width"]) // 2
99107
row_offset = 0
100108

101109
# add Internal IREF Setting for the 0.42 OLED as per

0 commit comments

Comments
 (0)