From 28c2ef294cacd6218b55bd74109ebca0637d1f59 Mon Sep 17 00:00:00 2001 From: Sniffleupagus Date: Mon, 17 Mar 2025 15:36:16 -0700 Subject: [PATCH] Support 90 and 270 rotation --- pwnagotchi/ui/display.py | 4 ++-- pwnagotchi/ui/view.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/ui/display.py b/pwnagotchi/ui/display.py index cb29a6b8..f8e7baa8 100644 --- a/pwnagotchi/ui/display.py +++ b/pwnagotchi/ui/display.py @@ -319,7 +319,7 @@ class Display(View): def image(self): img = None if self._canvas is not None: - img = self._canvas if self._rotation == 0 else self._canvas.rotate(-self._rotation) + img = self._canvas if self._rotation == 0 else self._canvas.rotate(-self._rotation, expand=True) return img def _render_thread(self): @@ -338,7 +338,7 @@ class Display(View): logging.error("%s" % e) if self._enabled: - self._canvas = (img if self._rotation == 0 else img.rotate(self._rotation)) + self._canvas = (img if self._rotation == 0 else img.rotate(self._rotation, expand=True)) if self._implementation is not None: self._canvas_next = self._canvas self._canvas_next_event.set() diff --git a/pwnagotchi/ui/view.py b/pwnagotchi/ui/view.py index 0c5ad5da..d876fde4 100644 --- a/pwnagotchi/ui/view.py +++ b/pwnagotchi/ui/view.py @@ -49,8 +49,14 @@ class View(object): self._voice = Voice(lang=config['main']['lang']) self._implementation = impl self._layout = impl.layout() - self._width = self._layout['width'] - self._height = self._layout['height'] + self._rotation = config['ui']['display'].get('rotation',0) + if (self._rotation/90)%2 == 0: + self._width = self._layout['width'] + self._height = self._layout['height'] + else: + self._width = self._layout['height'] + self._height = self._layout['width'] + self._state = State(state={ 'channel': LabeledValue(color=BLACK, label='CH', value='00', position=self._layout['channel'], label_font=fonts.Bold,