Skip to content

Commit

Permalink
スクロール量の変数が範囲外になる場合のロジックを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
shiiba-cba committed Jun 20, 2022
1 parent bc27cd9 commit 9cd0c02
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions keyboards/cocot46plus/cocot46plus.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,20 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) {
// clear accumulated scroll on assignment

if (h_rev != 0) {
if (mouse_report.h + h_rev > 127) {
h_rev = 127 - mouse_report.h;
} else if (mouse_report.h + h_rev < -127) {
h_rev = -127 - mouse_report.h;
}
mouse_report.h += h_rev;
h_acm -= h_rev * scrl_div_array[cocot_config.scrl_div];
}
if (v_rev != 0) {
if (mouse_report.v + v_rev > 127) {
v_rev = 127 - mouse_report.v;
} else if (mouse_report.v + v_rev < -127) {
v_rev = -127 - mouse_report.v;
}
mouse_report.v += v_rev;
v_acm -= v_rev * scrl_div_array[cocot_config.scrl_div];
}
Expand Down

0 comments on commit 9cd0c02

Please sign in to comment.