fix(hid): Fix scroll value truncation (#2865)

Fix 8 bit truncation of 16 bit scroll values when passed into
functions `zmk_hid_mouse_scroll_set` and
`zmk_hid_mouse_scroll_update`.

Fixes: #2864

Co-authored-by: Tobias Adolph <43353209+adolto@users.noreply.github.comgit>
This commit is contained in:
Tobias Adolph 2025-04-20 10:28:51 +02:00 committed by GitHub
parent 84772ebf14
commit 2c0e7daced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -377,9 +377,9 @@ int zmk_hid_mouse_button_release(zmk_mouse_button_t button);
int zmk_hid_mouse_buttons_press(zmk_mouse_button_flags_t buttons);
int zmk_hid_mouse_buttons_release(zmk_mouse_button_flags_t buttons);
void zmk_hid_mouse_movement_set(int16_t x, int16_t y);
void zmk_hid_mouse_scroll_set(int8_t x, int8_t y);
void zmk_hid_mouse_scroll_set(int16_t x, int16_t y);
void zmk_hid_mouse_movement_update(int16_t x, int16_t y);
void zmk_hid_mouse_scroll_update(int8_t x, int8_t y);
void zmk_hid_mouse_scroll_update(int16_t x, int16_t y);
void zmk_hid_mouse_clear(void);
#endif // IS_ENABLED(CONFIG_ZMK_POINTING)

View File

@ -445,7 +445,7 @@ void zmk_hid_mouse_movement_update(int16_t hwheel, int16_t wheel) {
LOG_DBG("Mouse movement updated to %d/%d", mouse_report.body.d_x, mouse_report.body.d_y);
}
void zmk_hid_mouse_scroll_set(int8_t hwheel, int8_t wheel) {
void zmk_hid_mouse_scroll_set(int16_t hwheel, int16_t wheel) {
mouse_report.body.d_scroll_x = hwheel;
mouse_report.body.d_scroll_y = wheel;
@ -453,7 +453,7 @@ void zmk_hid_mouse_scroll_set(int8_t hwheel, int8_t wheel) {
mouse_report.body.d_scroll_y);
}
void zmk_hid_mouse_scroll_update(int8_t hwheel, int8_t wheel) {
void zmk_hid_mouse_scroll_update(int16_t hwheel, int16_t wheel) {
mouse_report.body.d_scroll_x += hwheel;
mouse_report.body.d_scroll_y += wheel;