From 1c2009947d1a22b8620f6c20919f367268e71588 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 14 Nov 2020 11:41:11 -0500 Subject: [PATCH] update for use with eink displays, mostly ignore no-backlight-attr and add manual refreshing on new image --- adafruit_slideshow.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/adafruit_slideshow.py b/adafruit_slideshow.py index e16c393..d7fcdb8 100755 --- a/adafruit_slideshow.py +++ b/adafruit_slideshow.py @@ -238,7 +238,11 @@ def __init__( display.show(self._group) self._backlight_pwm = backlight_pwm - if not backlight_pwm and fade_effect: + if ( + not backlight_pwm + and fade_effect + and hasattr(self._display, "auto_brightness") + ): self._display.auto_brightness = False # Show the first image @@ -276,7 +280,7 @@ def _set_backlight(self, brightness): else: try: self._display.brightness = brightness - except RuntimeError: + except (RuntimeError, AttributeError): pass @property @@ -316,7 +320,6 @@ def update(self): now = time.monotonic() if not self.auto_advance or now - self._img_start < self.dwell: return True - return self.advance() # pylint: disable=too-many-branches @@ -380,6 +383,8 @@ def advance(self): ) self._group.append(sprite) + if hasattr(self._display, "refresh"): + self._display.refresh() self._fade_up() self._img_start = time.monotonic()