Skip to content

Fixes issue with one/two images failing #5

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
Oct 11, 2018
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
8 changes: 4 additions & 4 deletions adafruit_slideshow.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,15 @@ def advance(self):
elif not self.loop:
return False
else:
image_count = len(self._file_list) - 1
image_count = len(self._file_list)
if self._current_image < 0:
self._current_image += image_count
elif self._current_image > image_count:
elif self._current_image >= image_count:
self._current_image -= image_count
self._reorder_images()

imagename = self._file_list[self._current_image]
self._image_file = open(imagename, "rb")
image_name = self._file_list[self._current_image]
self._image_file = open(image_name, "rb")
try:
odb = displayio.OnDiskBitmap(self._image_file)
except ValueError:
Expand Down