Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions adafruit_qualia/displays/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ def transform(self, x, y):
if self._rotation == 0:
return x, y
elif self._rotation == 90:
return y, self._height - x
return y, self._width - x
elif self._rotation == 180:
return self._width - x, self._height - y
elif self._rotation == 270:
return self._width - y, x
return self._height - y, x
else:
raise ValueError("Rotation must be 0, 90, 180, or 270")

Expand Down Expand Up @@ -170,9 +170,10 @@ def rotation(self, value: int):
"""Set the display rotation"""
if value not in {0, 90, 180, 270}:
raise ValueError("Rotation must be 0, 90, 180, or 270")
self._touch.rotation = value
if self._touch:
self._touch.rotation = value
# Update the display rotation if already initialized
if self.display is not None:
if self.display:
Copy link
Member

@brentru brentru Dec 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ OK to change, you are simply checking object existence

self.display.rotation = value

@property
Expand Down
2 changes: 1 addition & 1 deletion adafruit_qualia/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Graphics(GraphicsBase):
:param auto_refresh: Set to False to disable auto refresh. Defaults to True.
:param default_bg: The path to your default background image file or a hex color.
Defaults to 0x000000.
:param rotation: Default rotation is landscape (270) but can be 0, 90, 180 for portrait/rotated
:param rotation: Default rotation is portrait (0) but can be 90, 180, 270 for landscape/rotated
:param debug: Turn on debug print outs. Defaults to False.

"""
Expand Down