Skip to content
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

With the examples, updating a label results in a black box being displayed #17

Open
pedasmith opened this issue Sep 25, 2023 · 9 comments

Comments

@pedasmith
Copy link

After updating the existing samples to display a label and then update it, I've run into a big problem: the label may (or may not) be drawn as a solid black box when it's refreshed.

My hardware: the NRF52840 and the 2.13 inch e-ink display as a feather.

Things that make a difference:

  1. The scale of the label. In the example code below, scale=1 will show the issue, but scale=2 will not
  2. The length of the text. In the example code below, using scale=2 and a longer text "Snake say what?" and then "hissssss!" will show the issue. The issue seems to happen at a
    ssd1680_simpletest.py.txt
    text length of 7
  3. Even with short texts, having multiple texts will show the issue
  4. When using two background bitmaps and labels overlapping the two, half of the box might be red and half black.

In my code, the only robust solution I've found is remake the display (displayio.release_displays() followed by making a new display_bus and display) and doing a display.show(). I don't have to rebuild all of my visuals (e.g. the labels and groups)

With a little luck, here's my code:
https://github.com/pedasmith/Adafruit_CircuitPython_SSD1680/blob/LabelRefreshExample/examples/ssd1680_simpletest.py

A full project with the complete workaround is at https://github.com/pedasmith/ElectronicsProjects/tree/main/2023-Adafruit-Python-InkGoveeListener/code

(I've attached my code as a .py file renamed to be a .py.txt file. it should be called "code.py" to run on the nrf52840.)

@pedasmith
Copy link
Author

Example of the display where a label is refreshed and becomes a black box.
Issue17-EInk-label-update-fails

@tannewt
Copy link
Member

tannewt commented Sep 25, 2023

What version of CircuitPython? This may be a core issue.

@pedasmith
Copy link
Author

What version of CircuitPython? This may be a core issue.

boot_out.txt says:
Adafruit CircuitPython 8.2.2 on 2023-07-31; Adafruit Feather nRF52840 Express with nRF52840
Board ID:feather_nrf52840_express
UID:7D6217A39866847D

I used a very recent CircuitPython. I'm happy to provide whatever help in testing out new versions, etc. -- I'm very much wanting to make these e-ink displays work well. And this update thing: let me just say, I had any number of false starts in coming up with an reasonable explanation for the failures (wrong kind of bitmap / background / etc.)

Just for fun: Youtube link of the current mostly-completed project

@tannewt
Copy link
Member

tannewt commented Sep 26, 2023

Please give 8.2.6 and absolute latest a try to see if we've fixed the issue already. Thanks!

@pedasmith
Copy link
Author

Please give 8.2.6 and absolute latest a try to see if we've fixed the issue already. Thanks!

Thanks, I'll give this a try in the next day or two.

@pedasmith
Copy link
Author

Update: latest version doesn't help. I've just tried 8.2.6; it fails in the exact same way on the same code. I also updated the bundle lib files from adafruit-circuitpython-bundle-8.x-mpy-20230927.zip to get the latest e.g., adafruit_ssd1680.mpy files.

I tried the absolute latest CircuitPython from the amazon S3 buckets such as adafruit-circuitpython-feather_nrf52840_express-en_US-20230928-aa0d7aa.uf2 -- but every .uf2 after the 8.2.6 release is a new "9.0" and just gives me an "incompatible .mpy" file error when I try the code.

Contents of the 8.2.6 boot_out.txt:
Adafruit CircuitPython 8.2.6 on 2023-09-12; Adafruit Feather nRF52840 Express with nRF52840
Board ID:feather_nrf52840_express
UID:7D6217A39866847D

@tannewt
Copy link
Member

tannewt commented Sep 28, 2023

Thanks for trying! The 9.x version only works with .py files at the moment because we are in the middle of a MicroPython upgrade.

@pedasmith
Copy link
Author

Thanks for trying! The 9.x version only works with .py files at the moment because we are in the middle of a MicroPython upgrade.

That's what I figured. Let me know if there's any other debugging, traces, or tests I should do. I'd love to get this fixed

@tannewt
Copy link
Member

tannewt commented Feb 15, 2024

I failed to reproduce this on a MagTag with the code below. Does it show the error for you?

import displayio
import board
import terminalio
import time

from adafruit_display_text import label

display = board.DISPLAY

INK_WIDTH = display.width
INK_HEIGHT = display.height

INK_WHITE = 0xffffff
INK_BLACK = 0x000000

display_group = displayio.Group()

pic = displayio.OnDiskBitmap("/display-ruler.bmp")
# CircuitPython 6 compatible
# t = displayio.TileGrid(
#    pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
# )
t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
display_group.append(t)
display.root_group = display_group

time.sleep(display.time_to_refresh + 0.1)
display.refresh()

text_area = label.Label(terminalio.FONT, text="LED", color=INK_BLACK)
text_area.x = 70
text_area.y = 100
text_area.scale = 1
display_group.append(text_area)

# without these two lines, the "LED" text will appear at the top of the display rather than at y=100
time.sleep(display.time_to_refresh + 0.1)
display.refresh()

text_area.text = "much longer text"

# without these two lines, the "LED" text will appear at the top of the display rather than at y=100
time.sleep(display.time_to_refresh + 0.1)
display.refresh()

while True:
  pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants