Skip to content

Unix version demo code print no error but displays nothing #482

@1847123212

Description

@1847123212

I run ubuntu 22.04 in VBox verturl machine, and build as readme says
python3 make.py unix DISPLAY=sdl_display INDEV=sdl_pointer

and run demo code as below


from micropython import const  # NOQA
import display_driver_framework

_WIDTH = const(480)
_HEIGHT = const(320)

_BUFFER_SIZE = _WIDTH * _HEIGHT * 3
import lcd_bus  # NOQA

print("Intializing LCD Bus")
bus = lcd_bus.SDLBus(flags=0)

print("Creating buffers")
buf1 = bus.allocate_framebuffer(_BUFFER_SIZE, 0)
buf2 = bus.allocate_framebuffer(_BUFFER_SIZE, 0)

import lvgl as lv  # NOQA

import sdl_display  # NOQA

print("Initializing LVGL")
lv.init()
print("Creating Display")
display = sdl_display.SDLDisplay(
    data_bus=bus,
    display_width=480,
    display_height=320,
    frame_buffer1=buf1,
    frame_buffer2=buf2,
    color_space=lv.COLOR_FORMAT.RGB888
)
print(display)
print("Initializing display")
display.init()

print("Adding display to display driver")
display_driver_framework.DisplayDriver._displays.append(display)

import sdl_pointer

print("Creating SDL pointer")
mouse = sdl_pointer.SDLPointer()
print(mouse)

print("Starting task handler")
import task_handler
th = task_handler.TaskHandler()

print("Activating screen")
scrn = lv.screen_active()
print("Setting screen style")
# the byte order for the hex on this is reversed so a RGB calculator from online needs to swap bits BGR instead of RGB
scrn.set_style_bg_color(lv.color_hex(0x990000), 0)
print("Creating Slider")
slider = lv.slider(scrn)
print("Setting slider size")
slider.set_size(400, 25)
print("Centering slider")
slider.center()


def on_value_changed(_):
    print('VALUE_CHANGED:', slider.get_value())

print("Adding callback to slider")
slider.add_event_cb(on_value_changed, lv.EVENT.VALUE_CHANGED, None)

# import time

# while True:
#     lv.tick_inc(5)
#     lv.timer_handler()
#     time.sleep_ms(5)


but nothing display

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions