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

refactor(color): UI code cleanup, speed up loading of complex pages #5031

Merged
merged 24 commits into from
Jun 6, 2024

Conversation

philmoz
Copy link
Collaborator

@philmoz philmoz commented May 17, 2024

Round 2 of the UI code refactoring.

Summary of changes:

  • Convert magic numbers to class constants and move layout constants to classes as well.
  • Speed up Radio Setup and Radio Hardware page layout.
  • Speed up flight modes and global variables pages (note: new layout for GV page with header at the top).
  • Speed up text entry and number entry field creation when pages are created.
  • Fix for Radio Hardware page not setting battery read state on exit.
  • Use a dialog popup for renaming files in the SD manager instead of a full screen.

The Lvgl textarea object used by the text entry and number entry fields is slow to create and layout. To avoid excessive overhead on pages and popups with a lot of text entry fields, these classes have been changed significantly.
Users should not see any difference (I hope); but under the hood they are now created as simple buttons. When the button is activated a text / number entry field is created over the top of the button and the appropriate UI activated to allow editing. On exit the text / number entry field is destroyed.

@philmoz
Copy link
Collaborator Author

philmoz commented May 19, 2024

Removing the flex layout in the Choice button speeds up pages with many Choice fields.
Requires moving the icon to the left to avoid expensive calculations on the length of the text field.

Before:
screenshot_tx16s_24-05-20_08-18-30

After:
screenshot_tx16s_24-05-20_08-19-21

@philmoz philmoz force-pushed the lvgl-layout-cleanup branch 3 times, most recently from 1630474 to 56c3feb Compare May 24, 2024 10:53
@pfeerick pfeerick added color Related generally to color LCD radios house keeping 🧹 Cleanup of code and house keeping labels May 26, 2024
@pfeerick pfeerick added this to the 2.11 milestone May 26, 2024
@philmoz philmoz force-pushed the lvgl-layout-cleanup branch 5 times, most recently from aeffe87 to 6d5e066 Compare June 1, 2024 09:17
@pfeerick
Copy link
Member

pfeerick commented Jun 6, 2024

When I try to go into Model Settings -> Curves -> +/new curve -> CV1 the radio just freezes.

One minor detail - the button matrix sizing for Model Settings -> Other seems to be a bit small

  • image

Otherwise, this looks fantastic... getting to the point I don't notice it being 🐌 "slow".

@philmoz
Copy link
Collaborator Author

philmoz commented Jun 6, 2024

Curve edit and center beeps should be fixed now.

@pfeerick pfeerick changed the title chore(color): more refactoring and cleanup of UI code. refactor(color): more UI code cleanup, speed up loading of complex pages Jun 6, 2024
@pfeerick pfeerick changed the title refactor(color): more UI code cleanup, speed up loading of complex pages refactor(color): UI code cleanup, speed up loading of complex pages Jun 6, 2024
@pfeerick
Copy link
Member

pfeerick commented Jun 6, 2024

One more minor one... Where it normally says "Loading" here the bottom part of the text is clipped.

image

One side effect of the

now created as simple buttons. When the button is activated a text / number entry field is created over the top of the button and the appropriate UI activated to allow editing.

seems to be that a long press on a "text' field can now oddly - where it will sometimes half-highlight it, and not actually activate/select it (with rotary encoder, touch seems fine)?

@philmoz
Copy link
Collaborator Author

philmoz commented Jun 6, 2024

One side effect of the

now created as simple buttons. When the button is activated a text / number entry field is created over the top of the button and the appropriate UI activated to allow editing.

seems to be that a long press on a "text' field can now oddly - where it will sometimes half-highlight it, and not actually activate/select it (with rotary encoder, touch seems fine)?

That probably needs the fixes in #5107 - will try it out.

@pfeerick
Copy link
Member

pfeerick commented Jun 6, 2024

That probably needs the fixes in #5107 - will try it out.

Just let me know which way you want to go with that one... I was thinking that since it relates to long press handling, so don't want to break that too much with any overlap from this PR...

@philmoz
Copy link
Collaborator Author

philmoz commented Jun 6, 2024

'Loading' message height fixed.
The button issue is fixed by 5107 - they can go in either order as they are mostly independent. A couple of minor fixes either way.

@pfeerick
Copy link
Member

pfeerick commented Jun 6, 2024

Thanks. Ok, lets keep them in order then... this one first, then 5107 soon.

@pfeerick pfeerick merged commit 97f9884 into EdgeTX:main Jun 6, 2024
44 checks passed
pfeerick added a commit that referenced this pull request Jun 22, 2024
Partially revert change in #5031 re:
`enableVBatBridge()` as this needs to be called
reguarly so that the RTC voltage is actually read.
The call to `disableVBatBridge()` while perhaps
technically not needed since `adcRead()` will
clear it itself once the voltage actually read
certainly won't hurt.
@philmoz philmoz deleted the lvgl-layout-cleanup branch August 6, 2024 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color Related generally to color LCD radios house keeping 🧹 Cleanup of code and house keeping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants