Skip to content

Commit 9cfed13

Browse files
authored
Merge pull request #26 from ladyada/master
update for use with eink displays,
2 parents 2ac4518 + 1c20099 commit 9cfed13

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

adafruit_slideshow.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ def __init__(
238238
display.show(self._group)
239239

240240
self._backlight_pwm = backlight_pwm
241-
if not backlight_pwm and fade_effect:
241+
if (
242+
not backlight_pwm
243+
and fade_effect
244+
and hasattr(self._display, "auto_brightness")
245+
):
242246
self._display.auto_brightness = False
243247

244248
# Show the first image
@@ -276,7 +280,7 @@ def _set_backlight(self, brightness):
276280
else:
277281
try:
278282
self._display.brightness = brightness
279-
except RuntimeError:
283+
except (RuntimeError, AttributeError):
280284
pass
281285

282286
@property
@@ -316,7 +320,6 @@ def update(self):
316320
now = time.monotonic()
317321
if not self.auto_advance or now - self._img_start < self.dwell:
318322
return True
319-
320323
return self.advance()
321324

322325
# pylint: disable=too-many-branches
@@ -380,6 +383,8 @@ def advance(self):
380383
)
381384
self._group.append(sprite)
382385

386+
if hasattr(self._display, "refresh"):
387+
self._display.refresh()
383388
self._fade_up()
384389
self._img_start = time.monotonic()
385390

0 commit comments

Comments
 (0)