Skip to content

Progress Bar slows down progressively #7

Closed
@gfbarros

Description

@gfbarros

With the example slightly modified to work with the Adafruit FeatherWing OLED screen, I see the progress bar progression across the screen slow down as the percentage increases. Any pointers on how to troubleshoot this?

Here is a video: https://youtu.be/B2AHjPbJh7c

And the code:

import time
import board
import displayio
import terminalio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text import label
import adafruit_displayio_ssd1306
from adafruit_progressbar import ProgressBar

displayio.release_displays()

i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)

splash = displayio.Group(max_size=10)
display.show(splash)

color_bitmap = displayio.Bitmap(128, 32, 1)
color_palette = displayio.Palette(1)
color_palette[0] = 0x0
bg_sprite = displayio.TileGrid(color_bitmap, x=0, y=0, pixel_shader=color_palette)
splash.append(bg_sprite)

progress_bar = ProgressBar(0, 0, 128, 32, 1.0)

splash.append(progress_bar)

textbox_bitmap = displayio.Bitmap(80,20,1)
textbox_palette = displayio.Palette(1)
textbox_palette[0] = 0x000000 #Black
textbox_sprite = displayio.TileGrid(textbox_bitmap, pixel_shader=textbox_palette,x=25, y=5)
splash.append(textbox_sprite)

text = "Fuel Pumping!"
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFFFF, x=27, y=14)
splash.append(text_area)

current_progress = 0.0
while True:
    while current_progress <= 1.0:
        print("Progress: {}%".format(current_progress * 100))
        progress_bar.progress = current_progress
        current_progress += 0.01
        if current_progress >= 1.0:
            current_progress = 0.0
        time.sleep(0.01)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions