Skip to content

update for use with eink displays, #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2020
Merged
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
11 changes: 8 additions & 3 deletions adafruit_slideshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -276,7 +280,7 @@ def _set_backlight(self, brightness):
else:
try:
self._display.brightness = brightness
except RuntimeError:
except (RuntimeError, AttributeError):
pass

@property
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -380,6 +383,8 @@ def advance(self):
)
self._group.append(sprite)

if hasattr(self._display, "refresh"):
Copy link
Member

Choose a reason for hiding this comment

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

How does this work with a tft? It also has refresh: https://circuitpython.readthedocs.io/en/5.3.x/shared-bindings/displayio/Display.html#displayio.Display.refresh

Shouldn't you be able to call it every time?

Copy link
Member Author

Choose a reason for hiding this comment

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

eink needs a force-refresh, perhaps there are some that dont have refresh? i wasnt sure... i can remove the test

Copy link
Member

Choose a reason for hiding this comment

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

I think you can call refresh on all displays. On TFTs it'll just refresh immediately when auto_refresh is on.

self._display.refresh()
self._fade_up()
self._img_start = time.monotonic()

Expand Down