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

Customizable mousekey accel #5043

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
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
19 changes: 13 additions & 6 deletions docs/feature_mouse_keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ You can see an example in the `_ML` here: https://github.com/qmk/qmk_firmware/bl
The default speed for controlling the mouse with the keyboard is intentionally slow. You can adjust these parameters by adding these settings to your keymap's `config.h` file. All times are specified in milliseconds (ms).

```
#define MOUSEKEY_DELAY 300
#define MOUSEKEY_INTERVAL 50
#define MOUSEKEY_MAX_SPEED 10
#define MOUSEKEY_TIME_TO_MAX 20
#define MOUSEKEY_WHEEL_MAX_SPEED 8
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
#define MOUSEKEY_DELAY 300
#define MOUSEKEY_INTERVAL 50
#define MOUSEKEY_MAX_SPEED 10
#define MOUSEKEY_TIME_TO_MAX 20
#define MOUSEKEY_WHEEL_MAX_SPEED 8
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
#define MOUSEKEY_ACCEL0_SPEED(max_speed) max_speed / 4
drashna marked this conversation as resolved.
Show resolved Hide resolved
#define MOUSEKEY_ACCEL1_SPEED(max_speed) max_speed / 2
#define MOUSEKEY_ACCEL2_SPEED(max_speed) max_speed
```


Expand All @@ -79,3 +82,7 @@ The top speed for scrolling movements.
### `MOUSEKEY_WHEEL_TIME_TO_MAX`

How long you want to hold down a scroll key for until `MOUSEKEY_WHEEL_MAX_SPEED` is reached. This controls how quickly your scrolling will accelerate.

### `MOUSEKEY_ACCEL*_SPEED`

How movement is accelerated with acceleration keys (`KC_ACL*`). This macro takes max speed as an argument, which equals to `MOUSEKEY_MOVE_DELTA * MOUSEKEY_MAX_SPEED`, unless it is customized via [Command Console](feature_command.md).
6 changes: 3 additions & 3 deletions tmk_core/common/mousekey.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ static uint8_t move_unit(void)
{
uint16_t unit;
if (mousekey_accel & (1<<0)) {
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed)/4;
unit = MOUSEKEY_ACCEL0_SPEED((MOUSEKEY_MOVE_DELTA * mk_max_speed));
drashna marked this conversation as resolved.
Show resolved Hide resolved
} else if (mousekey_accel & (1<<1)) {
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed)/2;
unit = MOUSEKEY_ACCEL1_SPEED((MOUSEKEY_MOVE_DELTA * mk_max_speed));
} else if (mousekey_accel & (1<<2)) {
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed);
unit = MOUSEKEY_ACCEL2_SPEED((MOUSEKEY_MOVE_DELTA * mk_max_speed));
} else if (mousekey_repeat == 0) {
unit = MOUSEKEY_MOVE_DELTA;
} else if (mousekey_repeat >= mk_time_to_max) {
Expand Down
9 changes: 9 additions & 0 deletions tmk_core/common/mousekey.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
#endif

#ifndef MOUSEKEY_ACCEL0_SPEED
#define MOUSEKEY_ACCEL0_SPEED(max_speed) max_speed / 4
#endif
#ifndef MOUSEKEY_ACCEL1_SPEED
#define MOUSEKEY_ACCEL1_SPEED(max_speed) max_speed / 2
#endif
#ifndef MOUSEKEY_ACCEL2_SPEED
#define MOUSEKEY_ACCEL2_SPEED(max_speed) max_speed
#endif

#ifdef __cplusplus
extern "C" {
Expand Down