PyPortal - No background images

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
steve220
 
Posts: 36
Joined: Sat Sep 16, 2017 10:52 pm

PyPortal - No background images

Post by steve220 »

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?

User avatar
danhalbert
 
Posts: 4653
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

Post by danhalbert »

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

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

Re: PyPortal - No background images

Post by jcalvin »

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.

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

Re: PyPortal - No background images

Post by steve220 »

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

      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?

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

Re: PyPortal - No background images

Post by steve220 »

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.

User avatar
danhalbert
 
Posts: 4653
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

Post by danhalbert »

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.

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

Re: PyPortal - No background images

Post by jcalvin »

That did indeed fix the problem!

Thanks Dan!

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

Re: PyPortal - No background images

Post by steve220 »

Ditto for me. Works great. Thanks!

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

Re: PyPortal - No background images

Post by steve220 »

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

# 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

/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.

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

Re: PyPortal - No background images

Post by steve220 »

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

            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

            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?

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

Re: PyPortal - No background images

Post by steve220 »

Bump. Is a library update available to fix this?

User avatar
danhalbert
 
Posts: 4653
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

Post by danhalbert »

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

User avatar
danhalbert
 
Posts: 4653
Joined: Tue Aug 08, 2017 12:37 pm

Re: PyPortal - No background images

Post by danhalbert »

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.

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

Re: PyPortal - No background images

Post by steve220 »

Awesome! Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”