Closed cheops closed 6 months ago
I reverted back this change, I still have to test, I remember getting an error that set_buffers
was not defined
I might need to checkout the latest master branch in the LVGL submodule. I don't remember when that change was made.
I get this error:
File "display_driver_framework.py", line 293, in __init__
AttributeError: 'lv_display_t' object has no attribute 'set_buffers'
this are the member functions
['__class__', '__SIZE__', '__cast__', '__cast_instance__', '__dereference__', 'act_scr', 'add_event_cb', 'antialiasing', 'bottom_layer', 'buf_1', 'buf_2', 'buf_act', 'color_format', 'del_prev', 'delete', 'delete_event', 'delete_refr_timer', 'dpi', 'dpx', 'draw_dispatch_layer', 'draw_prev_over_act', 'driver_data', 'enable_invalidation', 'event_list', 'flush_cb', 'flush_is_last', 'flush_ready', 'flush_wait_cb', 'flushing', 'flushing_last', 'get_antialiasing', 'get_color_format', 'get_dpi', 'get_driver_data', 'get_event_count', 'get_event_dsc', 'get_horizontal_resolution', 'get_inactive_time', 'get_layer_bottom', 'get_layer_sys', 'get_layer_top', 'get_next', 'get_offset_x', 'get_offset_y', 'get_physical_horizontal_resolution', 'get_physical_vertical_resolution', 'get_refr_timer', 'get_rotation', 'get_screen_active', 'get_screen_prev', 'get_theme', 'get_user_data', 'get_vertical_resolution', 'hor_res', 'inv_area_joined', 'inv_areas', 'inv_en_cnt', 'inv_p', 'is_double_buffered', 'is_invalidation_enabled', 'last_activity_time', 'last_area', 'last_part', 'layer_deinit', 'layer_head', 'layer_init', 'offset_x', 'offset_y', 'physical_hor_res', 'physical_ver_res', 'prev_scr', 'refr_timer', 'refreshed_area', 'remove_event_cb_with_user_data', 'render_mode', 'rendering_in_progress', 'rotation', 'scr_to_load', 'screen_cnt', 'screens', 'send_event', 'set_antialiasing', 'set_color_format', 'set_default', 'set_dpi', 'set_draw_buffers', 'set_driver_data', 'set_flush_cb', 'set_flush_wait_cb', 'set_offset', 'set_physical_resolution', 'set_resolution', 'set_rotation', 'set_theme', 'set_user_data', 'sw_rotate', 'sync_areas', 'sys_layer', 'theme', 'top_layer', 'trig_activity', 'user_data', 'ver_res']
the example here also uses set_draw_buffers
https://github.com/lvgl/lvgl/blob/master/tests/micropy_test/micropy.py
the use of set_draw_buffers is because of this line
buf = lv.draw_buf_create(WIDTH, HEIGHT, lv.COLOR_FORMAT.RGB888, 0)
That function returns an lv_draw_buf_t
when using that method there is no way to control the placement of the buffer in memory. the user is not able to specify if they want it to be in internal ram or in spiram. nor can they set the memory as being DMA memory which is where using double buffering comes into play. If the buffers are not set into DMA memory it is completely pointless to use double buffering.
When creating the buffers in the binding I have written the returned data type is a pointer to a location in memory not a structure. so I cannot call set_draw_buffers
to set the buffer pointers.
If you are getting an error it is because I need to update the submodule pointer to the latest master branch. You can do this manually bu going into the lib/lvgl folder and typing in git checkout master
and that should update the files to the latest master branch and then try compiling it again and see if it runs.
Getting this to work needs a little patching in the build scripts builder/__init__.py
get_lvgl()
updates (resets) the submodule to the committed version, so I temporarily removed that git command. Another option is the (locally) commit that updated submodule.
(there is a similar issue with esp-idf version and micropython version when you try to locally upgrade those)
So I did
cd lib/lvgl
git checkout master
git pull
cd ../micropython/ports/esp32
rm -rf build-ESP32_GENERIC_S3-SPIRAM_OCT
cd ../../../..
python3 make.py esp32 mpy_cross submodules clean BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT
then erase + flash
and everything executes without errors!
I still get nothing on my screen, but that might be due to something else, still investigating
another error with SPI bus and providing the buffer, I will report that separately: https://github.com/kdschlosser/lvgl_micropython/issues/10
I know there are still some issues in the code and that the submodule for LVGL needs to be updated. am making a change to remove something that i Believe is causing problems with the driver. I had opted to not have a lot of repeat code for handling the bus drivers when I added the bit-bang drivers so other MCU's and I believe that extra code that I added to handle the "sharing" of the micropython api side of things is causing an issue. I still have to run some tests to see if the code changes will stop the crashing/not functioning.
The 2 changes remaining in this pull request are still valid (rotation for MADCTL register + 0xB6 register parameter count)
I appreciate the changes. Thanks for fixing the rotation and the indexes for sending the initialization commands.
The changes made to the display driver framework for setting the buffers is incorrect
https://github.com/lvgl/lvgl/blob/c326e31a87e29fe77a6403bd96b13bf9448d18a5/src/display/lv_display.h#L230
set_buffers
is for setting raw buffers, akavoid *
. Whereset_draw_buffers
is for settinglv_draw_buf_t
structures.This was a change made for version 9.0