Skip to content

Watchdog based long press detection#1

Open
sakos wants to merge 6 commits into
paul-1:masterfrom
sakos:master
Open

Watchdog based long press detection#1
sakos wants to merge 6 commits into
paul-1:masterfrom
sakos:master

Conversation

@sakos
Copy link
Copy Markdown

@sakos sakos commented Aug 11, 2020

With these changes the long press detection is more natural and user friendly. Long press is activated when the specified time expires and not when the button is released. Furthermore the button press detection is more simple and elegant.

Sorry for the fragmented (and faulty) commits. I am git noob.

sakos added 6 commits August 10, 2020 17:28
Trial for individual handling of each button event  instead of scanning all buttons at every interrupt.
Longpress detection by watchdog to make the behavior more natural and user friendly
One more step to refactor pushbutton handling from polling and table scans to event controlled, since the trigger is interrupt.
@paul-1
Copy link
Copy Markdown
Owner

paul-1 commented Aug 11, 2020

Sounds fine what you did, I'll take a look.... Scanning all the GPIO all the time was brute force leftover from the original code, just never felt like changing. Since I don't have time to run a live test, can you make sure there is no recycle in the button pushes. When the long press times out, I would not want it to register a new button push until you let go.

I can squash all the commits in to one when it's merged.

@sakos
Copy link
Copy Markdown
Author

sakos commented Aug 11, 2020

It runs on my kitchen radio very well. Frankly speaking the original long push solution was weird. I did not see any side effect with my changes. Anyway, please review thoroughly as I am a hobby programmer only.
My button inputs have condensers also for noise filtering, so no bouncing button pushes or whatever can be seen with this single glitch filter in the code. Nevertheless, I do not think the double 50ms glitch filter was necessary. In case of issues the interval of remaining glitch filter can be increased, but I do not expect that.

Further optimisation of the code looks necessary. I am working on that.

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