Enable a default task throttle for split pointing. (#15925)

This commit is contained in:
Dasky 2022-01-26 19:24:29 +00:00 committed by GitHub
parent c99cbd915f
commit 7b31fc54df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 7 deletions

View File

@ -204,7 +204,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_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_ | |`POINTING_DEVICE_TASK_THROTTLE_MS` | (Optional) Limits the frequency that the sensor is polled for motion. | _not defined_ |
!> 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.
## Split Keyboard Configuration ## Split Keyboard Configuration

View File

@ -217,16 +217,12 @@ __attribute__((weak)) void pointing_device_task(void) {
}; };
#endif #endif
#if defined(POINTING_DEVICE_TASK_THROTTLE_MS) #if (POINTING_DEVICE_TASK_THROTTLE_MS > 0)
static uint32_t last_exec = 0; static uint32_t last_exec = 0;
if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) { if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) {
return; return;
} }
last_exec = timer_read32(); 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 #endif
// Gather report info // Gather report info

View File

@ -94,6 +94,9 @@ report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report);
#if defined(SPLIT_POINTING_ENABLE) #if defined(SPLIT_POINTING_ENABLE)
void pointing_device_set_shared_report(report_mouse_t report); void pointing_device_set_shared_report(report_mouse_t report);
uint16_t pointing_device_get_shared_cpi(void); 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) # if defined(POINTING_DEVICE_COMBINED)
void pointing_device_set_cpi_on_side(bool left, uint16_t cpi); 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); report_mouse_t pointing_device_combine_reports(report_mouse_t left_report, report_mouse_t right_report);

View File

@ -624,7 +624,7 @@ static void pointing_handlers_slave(matrix_row_t master_matrix[], matrix_row_t s
# endif # endif
report_mouse_t temp_report; report_mouse_t temp_report;
uint16_t temp_cpi; uint16_t temp_cpi;
# ifdef POINTING_DEVICE_TASK_THROTTLE_MS # if (POINTING_DEVICE_TASK_THROTTLE_MS > 0)
static uint32_t last_exec = 0; static uint32_t last_exec = 0;
if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) { if (timer_elapsed32(last_exec) < POINTING_DEVICE_TASK_THROTTLE_MS) {
return; return;