format code according to conventions [skip ci]

master
QMK Bot 2020-03-13 17:24:38 +00:00
parent 3cd2a27ac0
commit f89439ae09
1 changed files with 17 additions and 11 deletions

View File

@ -105,8 +105,7 @@ static uint8_t wheel_unit(void) {
void mousekey_task(void) { void mousekey_task(void) {
// report cursor and scroll movement independently // report cursor and scroll movement independently
report_mouse_t const tmpmr = mouse_report; report_mouse_t const tmpmr = mouse_report;
if ((mouse_report.x || mouse_report.y) && if ((mouse_report.x || mouse_report.y) && timer_elapsed(last_timer_c) > (mousekey_repeat ? mk_interval : mk_delay * 10)) {
timer_elapsed(last_timer_c) > (mousekey_repeat ? mk_interval : mk_delay * 10)) {
if (mousekey_repeat != UINT8_MAX) mousekey_repeat++; if (mousekey_repeat != UINT8_MAX) mousekey_repeat++;
mouse_report.v = 0; mouse_report.v = 0;
mouse_report.h = 0; mouse_report.h = 0;
@ -117,16 +116,19 @@ void mousekey_task(void) {
/* diagonal move [1/sqrt(2)] */ /* diagonal move [1/sqrt(2)] */
if (mouse_report.x && mouse_report.y) { if (mouse_report.x && mouse_report.y) {
mouse_report.x = times_inv_sqrt2(mouse_report.x); mouse_report.x = times_inv_sqrt2(mouse_report.x);
if (mouse_report.x == 0) { mouse_report.x = 1; } if (mouse_report.x == 0) {
mouse_report.x = 1;
}
mouse_report.y = times_inv_sqrt2(mouse_report.y); mouse_report.y = times_inv_sqrt2(mouse_report.y);
if (mouse_report.y == 0) { mouse_report.y = 1; } if (mouse_report.y == 0) {
mouse_report.y = 1;
}
} }
mousekey_send(); mousekey_send();
last_timer_c = last_timer; last_timer_c = last_timer;
mouse_report = tmpmr; mouse_report = tmpmr;
} }
if ((mouse_report.v || mouse_report.h) && if ((mouse_report.v || mouse_report.h) && timer_elapsed(last_timer_w) > (mousekey_repeat ? mk_wheel_interval : mk_wheel_delay * 10)) {
timer_elapsed(last_timer_w) > (mousekey_repeat ? mk_wheel_interval: mk_wheel_delay * 10)) {
if (mousekey_repeat != UINT8_MAX) mousekey_repeat++; if (mousekey_repeat != UINT8_MAX) mousekey_repeat++;
mouse_report.x = 0; mouse_report.x = 0;
mouse_report.y = 0; mouse_report.y = 0;
@ -137,9 +139,13 @@ void mousekey_task(void) {
/* diagonal move [1/sqrt(2)] */ /* diagonal move [1/sqrt(2)] */
if (mouse_report.v && mouse_report.h) { if (mouse_report.v && mouse_report.h) {
mouse_report.v = times_inv_sqrt2(mouse_report.v); mouse_report.v = times_inv_sqrt2(mouse_report.v);
if (mouse_report.v == 0) { mouse_report.v = 1; } if (mouse_report.v == 0) {
mouse_report.v = 1;
}
mouse_report.h = times_inv_sqrt2(mouse_report.h); mouse_report.h = times_inv_sqrt2(mouse_report.h);
if (mouse_report.h == 0) { mouse_report.h = 1; } if (mouse_report.h == 0) {
mouse_report.h = 1;
}
} }
mousekey_send(); mousekey_send();
last_timer_w = last_timer; last_timer_w = last_timer;