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

Make the rotary encoder more responsive #16931

Closed
wants to merge 2 commits into from
Closed

Make the rotary encoder more responsive #16931

wants to merge 2 commits into from

Conversation

mwyborski
Copy link

@mwyborski mwyborski commented Apr 24, 2022

The resolution 4 rotary encoder on my Keychron Q2 is missing a lot of ticks, when not all 4 pulses are detected. By putting a constraint on the default state 0xF of the encoder it is possible to catch a lot of these lost ticks and the performance of the rotary encoder improves noticeable and is reliable.

Description

Modified encoder_update to be more permissive about lost pulses when returning to the default state 0xF (no movement) to detect if a tick has happened. E.g. on resolution 4 rotary encoder all ticks with only 1, 2 or 3 detected pulses have been discarded in the original code, but when the rotary encoder returns to the recognized state of no movement and pulses are present, we can be sure, that a tick has happened. This PR catches all these lost ticks with only 1,2 or 3 pulses, which results in a more reliable performance of the rotary encoder.

Types of Changes

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

Issues Fixed or Closed by This PR

Rotary encoder losing a lot of ticks, when not all pulses have been recognized.

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 resolution 4 rotary encoder on my Keychron Q2 is missing a lot of ticks, when not all 4 pulses are detected. By putting a constraint on the default state 0xF of the encoder it is possible to catch a lot of these lost ticks and the performance of the rotary encoder improves noticeable and is reliable.
Make the rotary encoder more responsive
@github-actions github-actions bot added the core label Apr 24, 2022
@mwyborski mwyborski changed the title Develop Make the rotary encoder more responsive Apr 24, 2022
@mwyborski
Copy link
Author

This also fixes ENCODER_DEFAULT_POS problem with the encoder skipping pulses when it changes direction. I will submit a new PR with this in mind and make it only active if it is defined and keep the code backward compatible.

@mwyborski mwyborski closed this Apr 24, 2022
@tzarc
Copy link
Member

tzarc commented Apr 24, 2022

Any particular reason you closed this? Accidental?

@mwyborski
Copy link
Author

Hi!
The reason i closed this is because i modified the patch to be more compatible with the current approach and i made a new PR:
#16932

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.

2 participants