Skip to content

Screen updating problem in mipidsi #10708

@dhalbert

Description

@dhalbert

Originally posted by @RetiredWizard in #10703 (comment)

I don't know if this is something that should be addressed in this PR or if it's a separate issue but I worked up some code that demonstrates the bottom of the screen refresh issue I'm seeing.

when I run this code.py the program stops at the first input prompt but the MIPI DSI display doesn't show the correct output at the bottom of the screen, then when you press enter, the screen is updated and when it stops at the second input prompt (which inserts a display.refresh() while waiting for input) the entire display is properly updated.

from sys import stdin
import supervisor
import mipidsi
import displayio
import digitalio
import framebufferio
import board
import time

displayio.release_displays()
bus = mipidsi.Bus(frequency=1000000000)
init_sequence = (
    b"\xb2\x01\x10"
    b"\x80\x01\x8b"
    b"\x81\x01\x78"
    b"\x82\x01\x84"
    b"\x83\x01\x88"
    b"\x84\x01\xa8"
    b"\x85\x01\xe3"
    b"\x86\x01\x88"
    b"\x11\x80\x78"
)

reset_pin = digitalio.DigitalInOut(board.IO27)
reset_pin.direction = digitalio.Direction.OUTPUT
reset_pin.value = False
time.sleep(0.1)
reset_pin.value = True
time.sleep(0.2)

fb = mipidsi.Display(
    bus,
    init_sequence=init_sequence,
    width=1024,
    height=600,
    color_depth=24,
    pixel_clock_frequency=52000000,
    hsync_pulse_width=10,
    hsync_front_porch=160,
    hsync_back_porch=160,
    vsync_pulse_width=1,
    vsync_front_porch=12,
    vsync_back_porch=23,
    backlight_pin=board.IO26,
)
display = framebufferio.FramebufferDisplay(fb)
supervisor.runtime.display=display

for i in range(23):
    print(i)
n = input('[input] waiting for input: ')
print(chr(27)+'[2J')
time.sleep(.5)

for i in range(23):
    print(i)
print('[stdin] waiting for input: ',end="")
key = ''
keys = ''
while key != '\n':
    display.refresh()
    if supervisor.runtime.serial_bytes_available:
        key = stdin.read(1)
        keys = keys + key

Putting time.sleep(.1) after the print statements in the for loops caused both loops to have display issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions