GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Clear ongoing taps when going to sleep by mark9064 · Pull Request #2108 · InfiniTimeOrg/InfiniTime

Conversation

@mark9064

@mark9064 mark9064 commented Aug 23, 2024

Copy link
Copy Markdown
Member

Currently if the touch panel is pressed when DisplayApp goes to sleep, the finger up event gets dropped. This causes LVGL to think the finger is never released from the touch panel, so it prevents the device from sleeping. This PR clears the tapped state when going to sleep so the internal LVGL state remains consistent with the real touch panel state.

Fixes part of #1790 #2012 (there may be other issues contributing to these, but this is probably part of it)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions

github-actions Bot commented Aug 23, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Build size and comparison to main:

Section Size Difference
text 374512B -48B
data 948B 0B
bss 63488B 0B
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Aug 25, 2024

Copy link
Copy Markdown
Member Author

Also fixes #1992

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064 mark9064 mentioned this pull request Aug 28, 2024
Watch sometimes doesn't sleep after chime #2111
Closed
1 task done
@mark9064

mark9064 commented Aug 28, 2024

Copy link
Copy Markdown
Member Author

Actually the same problem exists with TouchHandler. Should we clear the tap state there too? Or do we define calling its methods as UB when the touch panel is sleeping (as when it's sleeping, it's not possible to know whether the screen is touched or not)

TouchHandler doesn't cause any bugs, but it could certainly in the future. If we choose to define it as UB then we should guard

// DisplayApp.cpp
  if (touchHandler.IsTouching()) {
    currentScreen->OnTouchEvent(touchHandler.GetX(), touchHandler.GetY());
  }

with a state == Running check

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minacode

minacode commented Aug 29, 2024

Copy link
Copy Markdown
Contributor

I would avoid any UB.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Aug 29, 2024

Copy link
Copy Markdown
Member Author

I mean defining calling the methods as UB by documentation i.e the documentation for the function IsTouching() saying "if the device is sleeping, the value returned is undefined". There is no UB C++ spec wise

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@minacode

minacode commented Aug 29, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I think the perfect type of that function would not be bool but std::optional<bool>. The value std::nullopt would represent the case where no measurement can be made (screen asleep) and the bool would be the measurement, if possible (screen awake).

Otherwise return always false if the screen is asleep. Because no screen, no touch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

minacode
minacode reviewed Aug 29, 2024
View reviewed changes
Comment thread src/displayapp/LittleVgl.cpp Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mark9064

mark9064 commented Aug 29, 2024

Copy link
Copy Markdown
Member Author

Excellent idea, optional makes perfect sense here semantically. I will try it out

minacode reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JF002

JF002 commented Sep 14, 2024

Copy link
Copy Markdown
Collaborator

Actually the same problem exists with TouchHandler. Should we clear the tap state there too? Or do we define calling its methods as UB when the touch panel is sleeping (as when it's sleeping, it's not possible to know whether the screen is touched or not)

I think we could just clear the tap in TouchHandler as soon as the touch panel is sleeping as well, since I don't think we want to handle touch while the device is sleeping.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mark9064
mark9064 force-pushed the clear-taps branch from 24f0c6d to 167382d Compare September 27, 2024 23:44
@mark9064

mark9064 commented Sep 27, 2024

Copy link
Copy Markdown
Member Author

So this has turned out to be a bit trickier than I thought. TLDR the touch panel still delivers events when sleeping, so trying to pretend it doesn't with TouchController having a null state is incompatible with double tap wake / tap wake. So instead I've opted to unify the touch processing into something a little more sensible, so the TouchController always has up to date touch state even when the device is sleeping.

So the original problem is addressed with DisplayApp not receiving or processing any touch events while sleeping, and clearing touch state on sleep entry

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@NeroBurner NeroBurner added this to the 1.15.0 milestone Sep 28, 2024
@NeroBurner NeroBurner added the bug Something isn't working label Sep 28, 2024
NeroBurner added a commit to InfiniTimeOrg/InfiniSim that referenced this pull request Sep 28, 2024
@NeroBurner
sim: LittleVgl: add new function ClearTouchState for PR #2108
b86452f
Add function `LittleVgl::ClearTouchState` introduced with
InfiniTimeOrg/InfiniTime#2108

As it is a new function the change is compatible with current
v1.14.0-dev state (`main` branch of InfiniTime)
@NeroBurner NeroBurner mentioned this pull request Sep 28, 2024
sim: LittleVgl: add new function ClearTouchState for PR #2108 InfiniTimeOrg/InfiniSim#157
Merged
NeroBurner
NeroBurner approved these changes Sep 28, 2024
View reviewed changes

@NeroBurner NeroBurner left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes look sound, not tested on PineTime

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mark9064
mark9064 force-pushed the clear-taps branch from 167382d to 5b92537 Compare October 17, 2024 23:08
@mark9064

mark9064 commented Oct 17, 2024

Copy link
Copy Markdown
Member Author

Cleaned up the OnTouchEvent method as it was just an alias for PushMessage after Unify touch handling, no other changes

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JF002
JF002 approved these changes Oct 27, 2024
View reviewed changes

@JF002 JF002 left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Tested on my pinetime, works fine!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mark9064 added 4 commits October 27, 2024 16:42
@mark9064
Clear ongoing taps when going to sleep
184d16d
@mark9064
Process touch events only when awake
3a7343b
@mark9064
Unify touch panel handling
2dde34d
@mark9064
Remove OnTouchEvent
de8d669
@mark9064
mark9064 force-pushed the clear-taps branch from 5b92537 to de8d669 Compare October 27, 2024 16:45
@JF002
JF002 merged commit 57b6db8 into InfiniTimeOrg:main Oct 27, 2024
@mark9064 mark9064 mentioned this pull request Nov 17, 2024
Timer holds changing time when turning off the watch #1992
Closed
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@minacode minacode minacode left review comments
@JF002 JF002 JF002 approved these changes
@NeroBurner NeroBurner NeroBurner approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

bug Something isn't working

Projects

None yet

Milestone

1.15.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@mark9064 @minacode @JF002 @NeroBurner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.