Skip to content

Commit 2aa4614

Browse files
authored
Merge pull request #16 from makermelissa/main
Bug fixes and updating docstring
2 parents aab20a5 + 06ee9c1 commit 2aa4614

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

adafruit_qualia/displays/__init__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ def transform(self, x, y):
4545
if self._rotation == 0:
4646
return x, y
4747
elif self._rotation == 90:
48-
return y, self._height - x
48+
return y, self._width - x
4949
elif self._rotation == 180:
5050
return self._width - x, self._height - y
5151
elif self._rotation == 270:
52-
return self._width - y, x
52+
return self._height - y, x
5353
else:
5454
raise ValueError("Rotation must be 0, 90, 180, or 270")
5555

@@ -170,9 +170,10 @@ def rotation(self, value: int):
170170
"""Set the display rotation"""
171171
if value not in {0, 90, 180, 270}:
172172
raise ValueError("Rotation must be 0, 90, 180, or 270")
173-
self._touch.rotation = value
173+
if self._touch:
174+
self._touch.rotation = value
174175
# Update the display rotation if already initialized
175-
if self.display is not None:
176+
if self.display:
176177
self.display.rotation = value
177178

178179
@property

adafruit_qualia/graphics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class Graphics(GraphicsBase):
6767
:param auto_refresh: Set to False to disable auto refresh. Defaults to True.
6868
:param default_bg: The path to your default background image file or a hex color.
6969
Defaults to 0x000000.
70-
:param rotation: Default rotation is landscape (270) but can be 0, 90, 180 for portrait/rotated
70+
:param rotation: Default rotation is portrait (0) but can be 90, 180, 270 for landscape/rotated
7171
:param debug: Turn on debug print outs. Defaults to False.
7272
7373
"""

0 commit comments

Comments
 (0)