Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

PyPortal - No background images
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PyPortal - No background images

by steve220 on Fri Nov 26, 2021 2:59 pm

After updating the PyPortal to the latest bootloader and Circuitpython version, I'm not getting either the startup BMP or background BMP images displayed. The quotes show up fine.
I'm using the version 5 sample code. Any thoughts on what I'm doing wrong?

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by danhalbert on Tue Nov 30, 2021 2:18 pm

Did you update the libraries also? Also, a problem with OnDiskBitmap was just fixed in a library recently.

danhalbert
 
Posts: 2954
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

by jcalvin on Tue Nov 30, 2021 5:32 pm

I'm current seeing something similar. I've tried 3 different projects. Downloaded the latest libraries. Even tried 7.1 beta (briefly) all to no avail.
Currently trying with the ISS project. The map.bmp file never shows on the screen. Nice track builds up, but no map image.

Also tried the Cleveland Art and NASA image projects - no images from Cleveland (although cache.bmp looks fine on the SD card). The
NASA logo as a background image never shows on screen.

BTW, the NASA image display project was having an additional problem: when I was trying this, NASA was handing over something from youtube (animated/movie)
and Adafruit was handing back a badly formatted .BMP (not a complete surprise). So cache.bmp was invalid.

jcalvin
 
Posts: 52
Joined: Mon Jan 04, 2016 3:37 pm

Re: PyPortal - No background images

by steve220 on Wed Dec 01, 2021 3:14 am

Libraries are up to date. I'm probably not smart enough to wade through the library code effectively, but the "TODO" comment in the following section of code seems germane.
Code: Select all | TOGGLE FULL SIZE
      if isinstance(file_or_color, str):  # its a filenme:
            with open(file_or_color, "rb") as self._bg_file:
                background = displayio.OnDiskBitmap(self._bg_file)
            self._bg_sprite = displayio.TileGrid(
                background,
                pixel_shader=getattr(
                    background, "pixel_shader", displayio.ColorConverter()
                ),
                # TODO: Once CP6 is no longer supported, replace the above line with below
                # pixel_shader=background.pixel_shader,
                x=position[0],
                y=position[1],
            )

Since I'm running CP7, should this be changed?

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by steve220 on Wed Dec 01, 2021 8:58 am

FYI, I tried changing the code above in the library (adafruit_portalbase\graphics.py), but I still don't see any images displayed.

Also, the beta and absolute newest circuitpython versions don't change this behavior.

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by danhalbert on Wed Dec 01, 2021 10:41 am

There was a fix for this but it wasn't merged yet. I just merged it. Use the 1.10.0 or later version of the PortalBase library: https://github.com/adafruit/Adafruit_Ci ... ses/latest. It will be in the bundle after tonight, but you can download it from that link now.

danhalbert
 
Posts: 2954
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

by jcalvin on Wed Dec 01, 2021 3:10 pm

That did indeed fix the problem!

Thanks Dan!

jcalvin
 
Posts: 52
Joined: Mon Jan 04, 2016 3:37 pm

Re: PyPortal - No background images

by steve220 on Wed Dec 01, 2021 11:50 pm

Ditto for me. Works great. Thanks!

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by steve220 on Sun Dec 05, 2021 12:59 am

Well, I may have spoke too soon. The loading image and background image load fine for the sample "quotes" project.
When using the SlideShow library with the examples here:
https://learn.adafruit.com/creating-sli ... n?view=all
The slides are blank. I've inserted code that prints out the current image file name and that is working. The code "transitions" to the next file, but the screen stays blank (backlight remains on). Here is the code...

Code: Select all | TOGGLE FULL SIZE
# CircuitPython Slideshow - uses the adafruit_slideshow.mpy library
import board
import time
from adafruit_slideshow import PlayBackOrder, SlideShow

# Create the slideshow object that plays through once alphabetically.
slideshow = SlideShow(board.DISPLAY,
                      folder="/images",
                      loop=True,
                      fade_effect=False,
                      order=PlayBackOrder.ALPHABETICAL,
                      dwell=1)

while slideshow.update():
    print(slideshow.current_slide_name)
    time.sleep(5)
    pass

Here is the output (loops continuously)
Code: Select all | TOGGLE FULL SIZE
/images/002.bmp
/images/003.bmp
/images/004.bmp
/images/005.bmp
/images/006.bmp
/images/Nier_quote_background.bmp
/images/background-old.bmp
/images/pyportal_startup - Copy.bmp
/images/pyportal_startup.bmp

All libraries are from the 12/2/21 update.

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by steve220 on Sun Dec 05, 2021 2:37 am

After trying an old version of the slideshow library, I found that replacing this block of code in the current library file (starting at line 426)

Code: Select all | TOGGLE FULL SIZE
            file_name = self._file_list[self._current_slide_index]
            with open(file_name, "rb") as self._slide_file:
                if file_name.endswith(".bmp"):
                    try:
                        odb = displayio.OnDiskBitmap(self._slide_file)
                    except ValueError:
                        self._slide_file.close()
                        self._slide_file = None
                        del self._file_list[self._current_slide_index]
                elif file_name.endswith(".json"):
                    lbl = self._create_label(self._slide_file)


With this block from the 1.5.1 library file works great.

Code: Select all | TOGGLE FULL SIZE
            file_name = self._file_list[self._current_slide_index]
            self._slide_file = open(file_name, "rb")
            if file_name.endswith(".bmp"):
                try:
                    odb = displayio.OnDiskBitmap(self._slide_file)
                except ValueError:
                    self._slide_file.close()
                    self._slide_file = None
                    del self._file_list[self._current_slide_index]
            elif file_name.endswith(".json"):
                lbl = self._create_label(self._slide_file)


It seems there is something problematic being caused by the "with open...." command?

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by steve220 on Tue Dec 07, 2021 9:06 am

Bump. Is a library update available to fix this?

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Re: PyPortal - No background images

by danhalbert on Tue Dec 07, 2021 9:44 am

No, but it's on our short list. I just need to do a test setup to vet a fix.

danhalbert
 
Posts: 2954
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

by danhalbert on Tue Dec 07, 2021 10:48 am

Fixed, with release 1.7.2 and later: https://github.com/adafruit/Adafruit_Ci ... ses/latest. This release will be in the bundle after tonight.

danhalbert
 
Posts: 2954
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

by steve220 on Tue Dec 07, 2021 12:22 pm

Awesome! Thanks!

steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

Please be positive and constructive with your questions and comments.