diff --git a/adafruit_qualia/displays/__init__.py b/adafruit_qualia/displays/__init__.py index 291eb97..b95c2b5 100755 --- a/adafruit_qualia/displays/__init__.py +++ b/adafruit_qualia/displays/__init__.py @@ -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") @@ -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: self.display.rotation = value @property diff --git a/adafruit_qualia/graphics.py b/adafruit_qualia/graphics.py index b6ed949..e47723f 100755 --- a/adafruit_qualia/graphics.py +++ b/adafruit_qualia/graphics.py @@ -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. """