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

ploopyco/trackball_mini: always update encoder #18561

Merged
merged 1 commit into from
Dec 30, 2022

Conversation

alaviss
Copy link
Contributor

@alaviss alaviss commented Oct 1, 2022

Description

The encoder derives scroll direction based on the last known wheel position, as such it needs up-to-date wheel state at all times to compute the right direction.

When using opt_encoder_simple.c as the implementation, the default delay may cause the encoder to see "impossible" states (which requires recalibration) or states that imply an opposite direction to the actual scrolling direction. This is very evident when the wheel is free-spinning.

This commit reorders the code to make sure the optical encoder state is always updated, but only apply scrolling when specified conditions are met (ie. after debounce period, middle mouse released, etc.).

Tested with opt_encoder_simple.c, where a free-spinning wheel now generates very smooth scrolling with no apparent glitches. This has not been tested with the default encoder, but similar benefits should be found there.

Since all Ploopy devices share the same encoder glue, this change can potentially be replicated to other devices for similar benefits.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

The encoder derives scroll direction based on the last known wheel
position, as such it needs up-to-date wheel state at all times
to compute the right direction.

When using opt_encoder_simple.c as the implementation, the default delay
may cause the encoder to see "impossible" states (which requires
recalibration) or states that imply an opposite direction to the actual
scrolling direction. This is very evident when the wheel is
free-spinning.

This commit reorders the code to make sure the optical encoder state is
always updated, but only apply scrolling when specified conditions
are met (ie. after debounce period, middle mouse released, etc.).

Tested with opt_encoder_simple.c, where a free-spinning wheel now
generates very smooth scrolling with no apparent glitches. This has not
been tested with the default encoder, but similar benefits should be
found there.
@drashna
Copy link
Member

drashna commented Oct 1, 2022

Technically, should be applied to all of the ploopy devices.

@github-actions
Copy link

Thank you for your contribution!
This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready.
For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

@github-actions github-actions bot added the stale Issues or pull requests that have become inactive without resolution. label Dec 25, 2022
@drashna drashna self-assigned this Dec 27, 2022
@drashna drashna requested a review from a team December 27, 2022 20:24
@github-actions github-actions bot removed the stale Issues or pull requests that have become inactive without resolution. label Dec 28, 2022
@tzarc tzarc merged commit 444760e into qmk:master Dec 30, 2022
sbhal pushed a commit to sbhal/qmk_firmware that referenced this pull request Dec 30, 2022
@alaviss alaviss deleted the mini-update-scroll branch January 1, 2023 17:39
jasonisgraham pushed a commit to jasonisgraham/qmk_firmware that referenced this pull request Jan 2, 2023
omikronik pushed a commit to omikronik/qmk_firmware that referenced this pull request Jan 22, 2023
ideas32 pushed a commit to ideas32/qmk_firmware that referenced this pull request Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants