Skip to content

gifio.OnDiskGif stops displaying next_frame() if web workflow is not enabled and USB not connected to host #9854

@RetiredWizard

Description

@RetiredWizard

CircuitPython version

Adafruit CircuitPython 9.2.1-13-g617915ee80 on 2024-12-02; Adafruit Feather ESP32-S3 Reverse TFT with ESP32S3
Adafruit CircuitPython 9.2.1 on 2024-11-20; Adafruit MatrixPortal S3 with ESP32S3

Code/REPL

import board,displayio,gifio,time
import digitalio
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

disp = board.DISPLAY

odgcc = gifio.OnDiskGif('classic40.gif')

with odgcc as odg:
    cs = displayio.Colorspace.RGB565_SWAPPED

    facecc = displayio.TileGrid(odg.bitmap, \
        pixel_shader=displayio.ColorConverter(input_colorspace=cs))

    splash = displayio.Group()
    splash.append(facecc)
    disp.root_group = splash

    start = 0
    next_delay = -1
    # Display repeatedly.
    while True:
        while time.monotonic() >= start and next_delay > time.monotonic()-start:
            pass
        next_delay = odg.next_frame()
        #next_delay = .5
        led.value = not led.value

        start = time.monotonic()

Behavior

If there is no WiFi credentials in settings.toml and the board is not connected to a host computer via USB a couple frames of the GIF file are displayed and then the animation stops. Oddly, the LED continues to blink. Connecting a host computer to the boards USB port when the animation is frozen causes the animation to begin and disconnecting it again causes it to stop again.

Description

If I comment out the call to odg.next_frame() and replace it with a statement setting the next_delay to .5 seconds the LED blinks steadily regardless of whether the host computer is connected to the USB port or not.

Additional information

Connecting the boards USB to a powerbank results in the same behavior as when it's not connected to anything so for the animation to work a host computer must be connected (or settings.toml must enable web workflow).

classic40.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions