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

Button press cleanup #510

Closed
wants to merge 2 commits into from
Closed

Button press cleanup #510

wants to merge 2 commits into from

Conversation

skot
Copy link
Owner

@skot skot commented Nov 23, 2024

looking at the button handling code after @ACSBEN noticed #506 I found a way to optimize it.

Now it uses interrupt for the button presses, and a timer to determine if it's a long press or not. The regular display update interval is an event group now, and it can be interrupted by a BUTTON_PRESS event.

@mutatrum
Copy link
Contributor

It works, but I have quite a hard time following the code, especially the distinction between short/long press, and the fact there's a timer. I wonder if the code wouldn't be simpler without the event group.

Anyways, a bit of future looking: it is possible to offload button handling and screen transitions to LVGL. See https://docs.lvgl.io/master/details/main-components/indev.html#hardware-button

I can have a stab at that, to see how it looks. I think it would clean up the system task quite a bit, and possible eliminate the system task completely.

@skot
Copy link
Owner Author

skot commented Nov 24, 2024

system.c is getting really big and unwieldy. I think breaking it up into a couple more focused files would help, but that's a "big project".

I'm definitely interested in how this could be done with LVGL.. even if we have to rethink the long press functionality..

@skot
Copy link
Owner Author

skot commented Nov 28, 2024

@mutatrum should we merge this or wait for your LVGL button handling?

@mutatrum
Copy link
Contributor

mutatrum commented Nov 29, 2024 via email

@skot
Copy link
Owner Author

skot commented Nov 29, 2024

It's almost done, only the self test is left. Hope to wrap it up tomorrow. It's gonna be real nice 😎

lots of selftest changes in #524 ...

@skot skot closed this Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants