-
-
Notifications
You must be signed in to change notification settings - Fork 40.2k
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
Started to add other acceleration modifiers #1169
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ uint8_t mk_max_speed = MOUSEKEY_MAX_SPEED; | |
uint8_t mk_time_to_max = MOUSEKEY_TIME_TO_MAX; | ||
/* ramp used to reach maximum pointer speed (NOT SUPPORTED) */ | ||
//int8_t mk_curve = 0; | ||
uint8_t mk_move_delta = MOUSEKEY_MOVE_DELTA; | ||
/* wheel params */ | ||
uint8_t mk_wheel_max_speed = MOUSEKEY_WHEEL_MAX_SPEED; | ||
uint8_t mk_wheel_time_to_max = MOUSEKEY_WHEEL_TIME_TO_MAX; | ||
|
@@ -60,17 +61,27 @@ static uint8_t move_unit(void) | |
{ | ||
uint16_t unit; | ||
if (mousekey_accel & (1<<0)) { | ||
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed)/4; | ||
unit = (mk_move_delta * mk_max_speed)*2; | ||
} else if (mousekey_accel & (1<<1)) { | ||
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed)/2; | ||
if (mk_move_delta < 10) mk_move_delta++; | ||
unit = (mk_move_delta * mk_max_speed); | ||
} else if (mousekey_accel & (1<<2)) { | ||
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed); | ||
if (mk_move_delta > 1) mk_move_delta--; | ||
unit = (mk_move_delta * mk_max_speed); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding and removing from the delta currently work, however it would be better if they could only change the value once per keypress |
||
// } else if (mousekey_accel & (1<<3)) { | ||
// unit = (mk_move_delta * mk_max_speed)*2; | ||
// } else if (mousekey_accel & (1<<4)) { | ||
// mk_move_delta++; | ||
// unit = (mk_move_delta * mk_max_speed); | ||
// } else if (mousekey_accel & (1<<5)) { | ||
// mk_move_delta--; | ||
// unit = (mk_move_delta * mk_max_speed); | ||
} else if (mousekey_repeat == 0) { | ||
unit = MOUSEKEY_MOVE_DELTA; | ||
unit = mk_move_delta; | ||
} else if (mousekey_repeat >= mk_time_to_max) { | ||
unit = MOUSEKEY_MOVE_DELTA * mk_max_speed; | ||
unit = mk_move_delta * mk_max_speed; | ||
} else { | ||
unit = (MOUSEKEY_MOVE_DELTA * mk_max_speed * mousekey_repeat) / mk_time_to_max; | ||
unit = (mk_move_delta * mk_max_speed * mousekey_repeat) / mk_time_to_max; | ||
} | ||
return (unit > MOUSEKEY_MOVE_MAX ? MOUSEKEY_MOVE_MAX : (unit == 0 ? 1 : unit)); | ||
} | ||
|
@@ -137,12 +148,12 @@ void mousekey_on(uint8_t code) | |
else if (code == KC_MS_WH_RIGHT) mouse_report.h = wheel_unit(); | ||
else if (code == KC_MS_BTN1) mouse_report.buttons |= MOUSE_BTN1; | ||
else if (code == KC_MS_BTN2) mouse_report.buttons |= MOUSE_BTN2; | ||
else if (code == KC_MS_BTN3) mouse_report.buttons |= MOUSE_BTN3; | ||
else if (code == KC_MS_BTN4) mouse_report.buttons |= MOUSE_BTN4; | ||
else if (code == KC_MS_BTN5) mouse_report.buttons |= MOUSE_BTN5; | ||
else if (code == KC_MS_ACCEL0) mousekey_accel |= (1<<0); | ||
else if (code == KC_MS_ACCEL1) mousekey_accel |= (1<<1); | ||
else if (code == KC_MS_ACCEL2) mousekey_accel |= (1<<2); | ||
else if (code == KC_MS_ACCEL3) mousekey_accel |= (1<<0); | ||
else if (code == KC_MS_UPSPED) mousekey_accel |= (1<<1); | ||
else if (code == KC_MS_DNSPED) mousekey_accel |= (1<<2); | ||
// else if (code == KC_MS_ACCEL3) mousekey_accel |= (1<<3); | ||
// else if (code == KC_MS_UPSPED) mousekey_accel |= (1<<4); | ||
// else if (code == KC_MS_DNSPED) mousekey_accel |= (1<<5); | ||
} | ||
|
||
void mousekey_off(uint8_t code) | ||
|
@@ -157,12 +168,12 @@ void mousekey_off(uint8_t code) | |
else if (code == KC_MS_WH_RIGHT && mouse_report.h > 0) mouse_report.h = 0; | ||
else if (code == KC_MS_BTN1) mouse_report.buttons &= ~MOUSE_BTN1; | ||
else if (code == KC_MS_BTN2) mouse_report.buttons &= ~MOUSE_BTN2; | ||
else if (code == KC_MS_BTN3) mouse_report.buttons &= ~MOUSE_BTN3; | ||
else if (code == KC_MS_BTN4) mouse_report.buttons &= ~MOUSE_BTN4; | ||
else if (code == KC_MS_BTN5) mouse_report.buttons &= ~MOUSE_BTN5; | ||
else if (code == KC_MS_ACCEL0) mousekey_accel &= ~(1<<0); | ||
else if (code == KC_MS_ACCEL1) mousekey_accel &= ~(1<<1); | ||
else if (code == KC_MS_ACCEL2) mousekey_accel &= ~(1<<2); | ||
// else if (code == KC_MS_ACCEL0) mousekey_accel &= ~(1<<0); | ||
// else if (code == KC_MS_ACCEL1) mousekey_accel &= ~(1<<1); | ||
// else if (code == KC_MS_ACCEL2) mousekey_accel &= ~(1<<2); | ||
else if (code == KC_MS_ACCEL3) mousekey_accel &= ~(1<<0); | ||
else if (code == KC_MS_UPSPED) mousekey_accel &= ~(1<<1); | ||
else if (code == KC_MS_DNSPED) mousekey_accel &= ~(1<<2); | ||
|
||
if (mouse_report.x == 0 && mouse_report.y == 0 && mouse_report.v == 0 && mouse_report.h == 0) | ||
mousekey_repeat = 0; | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to remove the existing MS_ACCEL because the last register 0xFF was already taken up