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

rewrite of WPM.c (no float) #13359

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge branch 'develop' into wpm-no-float
  • Loading branch information
jurgen-kluft authored Aug 21, 2021
commit 14c28c1b52d76effae0dea5f8a931b860fb94ce6
17 changes: 8 additions & 9 deletions quantum/wpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,21 @@ __attribute__((weak)) bool wpm_keycode_user(uint16_t keycode) {
/* the actual WPM */
#define WPM_SHORT_WINDOW

#ifndef WPM_SHORT_WINDOW
#ifdef WPM_SHORT_WINDOW
/* Full range we capture here is 100 * 60 ms = 6 s, this also means that it will take */
/* ~6 seconds to display the actual WPM once you start typing. */
/* x*10 = x*8 + x*2 */
# define WPM_WINDOW_NUM 100
# define WPM_WINDOW_MS 60
# define WPM_WINDOW_TO_WPM(x) (((x) << 3) + ((x) << 1))
#else
/* Full range we capture here is 100 * 100 ms = 10 s, this also means that it will take */
/* ~10 seconds to display the actual WPM once you start typing. */
/* The computed WPM needs to be multiplied by 6 (6*10s=60s=1min) */
/* to get the actual WPM, see 'WPM_WINDOW_TO_WPM' (x*6 = x*4 + x*2) */
# define WPM_WINDOW_NUM 100
# define WPM_WINDOW_MS 100
# define WPM_WINDOW_TO_WPM(x) (((x) << 2) + ((x) << 1))

#else
/* Full range we capture here is 100 * 60 ms = 6 s, this also means that it will take */
/* ~6 seconds to display the actual WPM once you start typing. */
/* x*10 = x*8 + x*2 */
# define WPM_WINDOW_NUM 100
# define WPM_WINDOW_MS 60
# define WPM_WINDOW_TO_WPM(x) (((x) << 3) + ((x) << 1))
#endif

/* State names */
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.