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

Keep track of encoder activity #11595

Merged
merged 2 commits into from
Jan 21, 2021
Merged

Keep track of encoder activity #11595

merged 2 commits into from
Jan 21, 2021

Conversation

tzarc
Copy link
Member

@tzarc tzarc commented Jan 17, 2021

Description

Addition to the "last matrix activity" PR, this time around it keeps track of encoder activity too.

Adds four new APIs:

uint32_t last_input_activity_time(void);     // Timestamp of the last matrix or encoder activity
uint32_t last_input_activity_elapsed(void);  // Number of milliseconds since the last matrix or encoder activity

uint32_t last_encoder_activity_time(void);     // Timestamp of the last encoder activity
uint32_t last_encoder_activity_elapsed(void);  // Number of milliseconds since the last encoder activity

Tested on the Djinn rev1.

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).

@tzarc tzarc requested a review from a team January 17, 2021 18:33
@github-actions github-actions bot added the core label Jan 17, 2021
@tzarc
Copy link
Member Author

tzarc commented Jan 19, 2021

Interesting bug:

https://github.com/tzarc/qmk_firmware/blob/1274f566458fb64351202447fca145853730fa53/tmk_core/common/keyboard.c#L395...L412

Ends up with the following build error when there's no RGBLIGHT or Backlight enabled:

Compiling: tmk_core/common/keyboard.c                                                              In file included from tmk_core/common/keyboard.h:20,
                 from tmk_core/common/keyboard.c:19:
tmk_core/common/keyboard.c: In function 'keyboard_task':
tmk_core/common/keyboard.c:412:5: error: a label can only be part of a statement and a declaration is not a statement
  412 |     bool encoders_changed = encoder_read();
      |     ^~~~
 [ERRORS]

@tzarc tzarc force-pushed the last-encoder-activity branch 2 times, most recently from 2fd5a6a to 4648470 Compare January 19, 2021 00:32
@tzarc tzarc force-pushed the last-encoder-activity branch from 4648470 to 206bf2c Compare January 19, 2021 00:33
@tzarc tzarc merged commit 1108210 into qmk:develop Jan 21, 2021
@tzarc tzarc deleted the last-encoder-activity branch March 2, 2021 05:00
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* Keep track of encoder activity, provide API for either matrix/encoder.

* Fixup build when no RGBLIGHT or Backlight enabled.
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