XuNeo / luavgl

lua + lvgl = luavgl An optimized lvgl Lua binding
MIT License
57 stars 13 forks source link

ToDos #2

Open XuNeo opened 1 year ago

XuNeo commented 1 year ago
LinZeb906791229 commented 1 year ago
call_protectedcall lua_result call_flappyBird lua_result

This is the error I encountered when executing protectedcall.lua and flappyBird.lua respectively. Is this a problem with my environment? I initially used Lua version 5.4.4.

LinZeb906791229 commented 1 year ago
call_protectedcall lua_result call_flappyBird lua_result

This is the error I encountered when executing protectedcall.lua and flappyBird.lua respectively. Is this a problem with my environment? I initially used Lua version 5.4.4.

Based on the analysis of the code in flappyBird.lua, it seems that the image file "pipe_up.png" has not been successfully opened or loaded. This can be seen from the fact that when printing the values up.h and up.w, they are both nil which indicates that the image dimensions have not been set.

XuNeo commented 1 year ago

The protectedcall demo is designed to crash in 1second, it shows the ability to print call stack on screen.

However the flappyBird should not crash. I have adjusted the image path days ago, you may need to update the code and recompile again.

LinZeb906791229 commented 1 year ago

The protectedcall demo is designed to crash in 1second, it shows the ability to print call stack on screen.

However the flappyBird should not crash. I have adjusted the image path days ago, you may need to update the code and recompile again.

Thank you for your reply.I have solved the issue I was having. I am currently using Windows' QT5.14 simulation and I resolved the issue by making the following two modifications:

1-For LVGL's FS in QT, "LV_FS_WIN32_LETTER" and "LV_FS_WIN32_PATH" must be defined as the first letter of the user's home directory. This can be seen from the "lv_fs_get_drv" function where it performs a letter comparison. Since my home directory is "./examples", both paths must be set to ".".

2-In the "flappyBird.lua" example, the code "IMAGE_PATH = IMAGE PATH .. "/flappyBird/"" must be written as "IMAGE_PATH = IMAGE_PATH .. "flappyBird/"", otherwise an extra "/" symbol will be added to the "IMAGE PATH" concatenation.

LinZeb906791229 commented 1 year ago

The current code is only suitable for embedded devices with large memory capacities. When running on a microcontroller with built-in SRAM of 128K and external SDRAM of 8M, loading the Flappy Bird demo image consumes a significant amount of memory. Do you have any suggestions regarding image processing? If we open the image using a C library and save the pointer to the opened image data, could we then pass the image pointer to the Lua virtual machine to reduce heap memory usage by Lua? I just started learning Lua last week and I have a limited understanding of it.

LinZeb906791229 commented 1 year ago

The current code is only suitable for embedded devices with large memory capacities. When running on a microcontroller with built-in SRAM of 128K and external SDRAM of 8M, loading the Flappy Bird demo image consumes a significant amount of memory. Do you have any suggestions regarding image processing? If we open the image using a C library and save the pointer to the opened image data, could we then pass the image pointer to the Lua virtual machine to reduce heap memory usage by Lua? I just started learning Lua last week and I have a limited understanding of it.

In order to make Lua run on my microcontroller, I made some modifications to the Lua system to adapt it, and I finally managed to run all the demo except for Flappy Bird. However, running Flappy Bird still leads to a HardFault.

XuNeo commented 1 year ago

All the images in examples are png, change them to lvgl bin format and use indexed_8 will reduce memory significantly. Don't forget to update lua file with correct file extension name.

When hardfault occurs, try to get a backtrace or simply which piece of code causes it, so can do further analysis.

XuNeo commented 1 year ago

For images that need transformation, use lvgl true_color_alpha format, do not use indexed_8 which is not supported. Images include: the bird, the score result backgroud etc.

LinZeb906791229 commented 1 year ago

For images that need transformation, use lvgl true_color_alpha format, do not use indexed_8 which is not supported. Images include: the bird, the score result backgroud etc.

I am currently attempting to convert the image data to a bin file format utilizing the RGB555 TrueColor specification. I would like to express my gratitude once again for your assistance.

jinsc123654 commented 5 months ago

You can try to modify this definition

VeryCapture_20240117160536