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

Enable a default task throttle for split pointing. #15925

Merged
merged 1 commit into from
Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/feature_pointing_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void pointing_device_driver_set_cpi(uint16_t cpi) {}
|`POINTING_DEVICE_MOTION_PIN` | (Optional) If supported, will only read from sensor if pin is active. | _not defined_ |
|`POINTING_DEVICE_TASK_THROTTLE_MS` | (Optional) Limits the frequency that the sensor is polled for motion. | _not defined_ |
drashna marked this conversation as resolved.
Show resolved Hide resolved

!> When using `SPLIT_POINTING_ENABLE` the `POINTING_DEVICE_MOTION_PIN` functionality is not supported and would recommend `POINTING_DEVICE_TASK_THROTTLE_MS` be set to `1`. Increasing this value will increase transport performance at the cost of possible mouse responsiveness.
!> When using `SPLIT_POINTING_ENABLE` the `POINTING_DEVICE_MOTION_PIN` functionality is not supported and `POINTING_DEVICE_TASK_THROTTLE_MS` will default to `1`. Increasing this value will increase transport performance at the cost of possible mouse responsiveness.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth mentioning that setting it to 0 disables the throttling, too.g

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe? It's not really intended for it to be disabled when split pointing is active and more just a debugging option I guess.



## Split Keyboard Configuration
Expand Down
6 changes: 1 addition & 5 deletions quantum/pointing_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,12 @@ __attribute__((weak)) void pointing_device_task(void) {
};
#endif

#if defined(POINTING_DEVICE_TASK_THROTTLE_MS)
#if (POINTING_DEVICE_TASK_THROTTLE_MS > 0)
static uint32_t last_exec = 0;
if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) {
return;
}
last_exec = timer_read32();
#else
# if defined(SPLIT_POINTING_ENABLE)
# pragma message("It's recommended you enable a throttle when sharing pointing devices.")
# endif
#endif

// Gather report info
Expand Down
3 changes: 3 additions & 0 deletions quantum/pointing_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report);
#if defined(SPLIT_POINTING_ENABLE)
void pointing_device_set_shared_report(report_mouse_t report);
uint16_t pointing_device_get_shared_cpi(void);
# if !defined(POINTING_DEVICE_TASK_THROTTLE_MS)
# define POINTING_DEVICE_TASK_THROTTLE_MS 1
# endif
# if defined(POINTING_DEVICE_COMBINED)
void pointing_device_set_cpi_on_side(bool left, uint16_t cpi);
report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, report_mouse_t right_report);
Expand Down
2 changes: 1 addition & 1 deletion quantum/split_common/transactions.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ static void pointing_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s
# endif
report_mouse_t temp_report;
uint16_t temp_cpi;
# ifdef POINTING_DEVICE_TASK_THROTTLE_MS
# if (POINTING_DEVICE_TASK_THROTTLE_MS > 0)
static uint32_t last_exec = 0;
if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) {
return;
Expand Down