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

[WIP] Refactoring LVGL integration #20853

Draft
wants to merge 5 commits into
base: bugfix-2.1.x
Choose a base branch
from

Conversation

belese
Copy link

@belese belese commented Jan 22, 2021

The goal is to remove LVGL configuration stuff from UI code and make lvgl already configured for extui that want to use it.
It doesn't add anything in Marlin Core.
It also add SDL display (Linux Only), mainly for developpement

  • Add lvgl and lvgl drivers
  • Add sdl display (use lvgl drivers)
  • Wrapper around TFT_io for SPI/FSMC TFT (it's done, but it need a bit clean)

And i would also initialise LVGL filesystem for SD Card and Flash storage and upload assets if found on sd card

My Idea for flash storage, was to split it in 3 'lvgl filesystem'.

one for Font
one for Bitmap (with a lvgl image decoder for compressed image)
one for the Ui data

PS : Last commit is Linux configuration and hello world ui for lvgl.
Capture d’écran de 2021-01-22 19-48-20

Requirements

Linux or tft screen
for linux, sdl libraries
apt-get install gcc-multilib g++-multilib libsdl2-dev

Benefits

Easier to add LVGL UI, and developpe UI faster with SDL
LVGL also support lcd screen, but i haven't one, so i' will not add it.

Any thought are welcome.

Johan

@X-Ryl669
Copy link
Contributor

Do you know about the MKS's UI ? It's already using LVGL internally and it's quite complete already.

I agree that developing on Linux is easier than on the printer itself, but in the end, you'll have to simulate so many stuff (touch position, printer's interaction, G-Code, etc...) that I doubt you'll gain time.

@belese
Copy link
Author

belese commented Jan 24, 2021

Yes i know, but it used an old lvgl with no font loading support.(7.2)
It only suipport one resolution, and dosen't follow all Marlin definition.
Lvgl initilialisaton has problem, rotate screen dosn't work well for me, and there's few 'strange' code in MKS UI. Display Buffer is used for other thing that lvgl display buffer, so you can't use doubble buffer. Goal is to move lgl out fro ui, and make it accessible for all extui. And lvgl will be already configurer, with right touch input, right screen , right fylesystemI, and will manage assets uploading. Next step would be to make MKS ui use this library, and probably move it to EXTui. In fact, For now, i cannot print with MKS UI( don't test this branch), but 2.0.7 don't ever compile for me without few change and when compilation is fine, it pause itself during print with no info, but i can print via USB.

And for linux display, mouse is used as touch input, and mousewheel as encoder. so you can test some part of ui. you can't test everything, but designing the windows, etc is easier. and it add no code in Marlin as it use external lvgl driver library.

@X-Ryl669
Copy link
Contributor

Currently, MKS makes an hacky use of LVGL filesystem to implement the G-Code preview icon feature. You'll have hard time fixing this (I've done it here, but it was rejected since it was solving a deprecated issue). Also, there is some outgoing effort to use LVGL 7 here. I don't know how good it is however.

@rhapsodyv
Copy link
Member

I already did the mks ui working on lvgl 7, a long time ago. I will resurrect the branch.

@rhapsodyv rhapsodyv closed this Feb 1, 2021
@rhapsodyv rhapsodyv reopened this Feb 1, 2021
@belese
Copy link
Author

belese commented Feb 2, 2021

Hello, i don't stop working on it, but can't work on it every week. Feel free to close it if you want, i'll reopen it when development from my side will be finished.

@rhapsodyv rhapsodyv marked this pull request as draft February 2, 2021 21:32
@rhapsodyv rhapsodyv added C: LCD & Controllers Needs: Work More work is needed S: Don't Merge Work in progress or under discussion. labels Feb 2, 2021
@thinkyhead
Copy link
Member

This has been brought up to date, cleaned up, and tweaked to conform better to Marlin S&P. Please work up a test compilation that succeeds and we can add it as a new CI test for continued development.

@belese
Copy link
Author

belese commented Feb 18, 2021

Thanks, i'm a bit busy now as my work is in bankrupt, and i have to do a lot of things for that.
Hope i've more time in one month.

@X-Ryl669
Copy link
Contributor

@rhapsodyv What is your LVGL7 branch you are referring to ?

@rhapsodyv
Copy link
Member

@rhapsodyv What is your LVGL7 branch you are referring to ?

It's a stash. I updated it with the last marlin bugfix.

I need to update the style code, that changed from 6 to 7.

I might send a PR in the next days. I'm just waiting the 2.0.8 release.

This pic is of the lastest lvgl (as you see, just re apply the styles now)

image

@X-Ryl669
Copy link
Contributor

X-Ryl669 commented Feb 25, 2021

I've reworked the color picker widget in LVGL7 (submitted to lvgl repository, but they merged it in v8), so please @ mention me when you post your PR so I can send you the new code. It's required for #21158. Thanks!

@rhapsodyv
Copy link
Member

I've reworked the color picker widget in LVGL7 (submitted to lvgl repository, but they merged it in v8), so please @ mention me when you post your PR so I can send you the new code. It's required for #21158. Thanks!

Using standard LVGL, we can just enable/disable it right on marlin lv_conf.h .

@X-Ryl669
Copy link
Contributor

That's one of the things to do, but the cpicker is:

  1. too slow to draw without rewriting the drawing code
  2. expecting the TFT to send "PRESSING" event continuously (so you can switch the mode from HUE => Saturation => Value by long pressing the center of the wheel). This does not work with MKS's TFT code since it never send PRESSING more than once.
  3. styles are messed up in the current code base, so it display a white colorwheel that's unusable unless it's fixed.

See here for (1), the change for V8 is merged already
See here for (2) and (3)

I don't know if (3) is fixed in your code (it might be), but (1) and (2) is really required for a working color wheel.

@X-Ryl669
Copy link
Contributor

Anyway, I'll adapt once your code is merged.

@rhapsodyv
Copy link
Member

I'm using lvgl v7.10.1, but we can point it to their dev branch.

@X-Ryl669
Copy link
Contributor

Honestly, the v8's dev branch is very far from the v6/v7. They reworked almost everything. So, it'll be a hard work to do. If your code is using v7.10, it's ok for me as my patch will apply (it applied on v7.11).

@rhapsodyv
Copy link
Member

Honestly, the v8's dev branch is very far from the v6/v7. They reworked almost everything. So, it'll be a hard work to do. If your code is using v7.10, it's ok for me as my patch will apply (it applied on v7.11).

Won't they apply your patch on v7??

@X-Ryl669
Copy link
Contributor

They approved it, but after discussing with the original author, they decided they won't apply any more patch to v7 and instead switched to v8. v7 is now in support-mode, it won't receive any change, only bug fix as far as I understood. See first link in my previous comment for the history and the patch.

Co-Authored-By: belese <2719742+belese@users.noreply.github.com>
@thinkyhead
Copy link
Member

This is still interesting, though it might be more suitable as an addition to the MarlinSimUI project. I went ahead and rebased it in case anyone still wants to experiment with this.

@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 2 times, most recently from 9c65146 to 4f65466 Compare January 26, 2024 00:13
@thisiskeithb thisiskeithb changed the title Refactoring LVGL integration (WIP) [WIP] Refactoring LVGL integration Apr 13, 2024
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 3 times, most recently from 37d77d6 to aa44542 Compare September 28, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: LCD & Controllers Needs: Work More work is needed S: Don't Merge Work in progress or under discussion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants