Skip to content

Commit

Permalink
linting except on vusb and doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
Alabastard-64 committed Jan 21, 2023
1 parent 4fc1b53 commit badb248
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/feature_pointing_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ void pointing_device_driver_set_cpi(uint16_t cpi) {}
| `POINTING_DEVICE_SDIO_PIN` | (Optional) Provides a default SDIO pin, useful for supporting multiple sensor configs. | _not defined_ |
| `POINTING_DEVICE_SCLK_PIN` | (Optional) Provides a default SCLK pin, useful for supporting multiple sensor configs. | _not defined_ |
!> `MOUSE_SCROLL_HIRES_ENABLE` will change scrolling behavior on OS's that support high resolution scrolling (currently Linux 5.15+, and Windows Vista+) this will allow for sub line scrolling in some applications. As a warning this feature may not be properly handled or implemented in a few applications that handle v/h axis counts separately from the OS scrolling might become over sensitive in those specific applications.
!> `MOUSE_SCROLL_HIRES_ENABLE` will change scrolling behavior on OS's that support high resolution scrolling (currently Linux 5.15+, and Windows Vista+) this will allow for sub line scrolling in some applications that support the feature. **Scrolling sensitivity will need to be adjusted based on `MOUSE_SCROLL_MULTIPLIER` when high resolution scrolling is active** (Drag scroll mode in pointing device modes does this automatically). Note that high resolution scrolling is activated by the OS during USB initialization so to test if high resolution scrolling is active the global variable `resolution_multiplier` will have the **first** and **third** bits set to `1` for active high resolution scrolling on vertical and horizontal axes respectively.
Most modern widely adopted applications (firefox, Chrome, discord, etc.) fully support the feature and most applications using default interfaces (windows explorer, QMK Toolbox, etc.) or that let the OS handle scroll movement will compensate for the higher tick count and behave normally just without any benefit from this feature. However, a few applications that handle scroll movement separately from the OS can result in increased sensitivity if they have not updated to handle high resolution scrolling (GIMP, LibreOffice, etc.).
Most modern widely adopted applications (firefox, Chrome, discord, etc.) fully support high resolution scrolling, and applications that let the OS handle v/h axis inputs and compensate for the expected higher tick count will behave normally just without any benefit from this feature. However, a few applications that handle scroll input separately from the OS can result in increased sensitivity if they have not updated to handle high resolution scrolling (GIMP, LibreOffice, etc.).
It is recommended to use the pointing device modes feature for drag scroll along with high resolution scrolling as it will automatically adjust to accommodate once it detects it is active.
Expand Down
4 changes: 2 additions & 2 deletions quantum/pointing_device/pointing_device_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ static report_mouse_t process_pointing_mode(pointing_mode_t pointing_mode, repor
// drag scroll mode (sets mouse axes to mouse_report h & v with divisor)
case PM_DRAG:
# ifdef MOUSE_SCROLL_HIRES_ENABLE
if (resolution_multiplier & 1 << 0) pointing_mode.y *= MAX(MOUSE_SCROLL_MULTIPLIER/pointing_mode.divisor, 1);
if (resolution_multiplier & 1 << 2) pointing_mode.x *= MAX(MOUSE_SCROLL_MULTIPLIER/pointing_mode.divisor, 1);
if (resolution_multiplier & 1 << 0) pointing_mode.y *= MAX(MOUSE_SCROLL_MULTIPLIER / pointing_mode.divisor, 1);
if (resolution_multiplier & 1 << 2) pointing_mode.x *= MAX(MOUSE_SCROLL_MULTIPLIER / pointing_mode.divisor, 1);
if (resolution_multiplier) pointing_mode.divisor = 1;
# endif
mouse_report.h = pointing_device_hv_clamp(pointing_mode.x / (int16_t)pointing_mode.divisor);
Expand Down
16 changes: 8 additions & 8 deletions tmk_core/protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ extern keymap_config_t keymap_config;
# define usb_lld_disconnect_bus(usbp)
#endif

uint8_t keyboard_idle __attribute__((aligned(2))) = 0;
uint8_t keyboard_protocol __attribute__((aligned(2))) = 1;
uint8_t keyboard_led_state = 0;
uint8_t keyboard_idle __attribute__((aligned(2))) = 0;
uint8_t keyboard_protocol __attribute__((aligned(2))) = 1;
uint8_t keyboard_led_state = 0;
#ifdef MOUSE_SCROLL_HIRES_ENABLE
uint8_t resolution_multiplier = 0;
uint8_t resolution_multiplier = 0;
#endif
volatile uint16_t keyboard_idle_count = 0;
volatile uint16_t keyboard_idle_count = 0;
static virtual_timer_t keyboard_idle_timer;

static void keyboard_idle_timer_cb(struct ch_virtual_timer *, void *arg);
Expand Down Expand Up @@ -125,7 +125,7 @@ static const USBDescriptor *usb_get_descriptor_cb(USBDriver *usbp, uint8_t dtype
uint16_t wValue = ((uint16_t)dtype << 8) | dindex;
uint16_t wLength = ((uint16_t)usbp->setup[7] << 8) | usbp->setup[6];
desc.ud_string = NULL;
desc.ud_size = get_usb_descriptor(wValue, wIndex, wLength, (const void **const) & desc.ud_string);
desc.ud_size = get_usb_descriptor(wValue, wIndex, wLength, (const void **const)&desc.ud_string);
if (desc.ud_string == NULL)
return NULL;
else
Expand Down Expand Up @@ -556,7 +556,7 @@ static void usb_event_cb(USBDriver *usbp, usbevent_t event) {
chSysUnlockFromISR();
}
#ifdef MOUSE_SCROLL_HIRES_ENABLE
resolution_multiplier = 0;
resolution_multiplier = 0;
#endif
return;

Expand Down Expand Up @@ -684,7 +684,7 @@ static bool usb_request_hook_cb(USBDriver *usbp) {
return TRUE;
break;
}
# endif
# endif
#endif /* SHARED_EP_ENABLE */
default:
universal_report_blank.report_id = usbp->setup[2];
Expand Down

0 comments on commit badb248

Please sign in to comment.