Skip to content

Commit 0a066ae

Browse files
committed
fixes from LimeProgramming
1 parent 108a9a2 commit 0a066ae

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

firmware/include/utils.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,10 @@ void reset_cycle() {
945945

946946
case MO_MVT_COAST:
947947
mouse_data.rmpkt.wheel = 0; // Reset Buffered wheel movement
948-
mouse_data.mouse_movt_ticker = 0; // Reset mouse poll count
949948
break;
950949
}
950+
951+
mouse_data.mouse_movt_ticker = 0; // Reset mouse poll count
951952

952953
return;
953954
}
@@ -1004,7 +1005,11 @@ void update_mousepacket()
10041005
case MO_MVT_AVERAGE:
10051006

10061007
// Avoid a Div by zero err
1007-
if ( mouse_data.mouse_movt_ticker == 0 ) { break; }
1008+
if ( mouse_data.mouse_movt_ticker == 0 ) {
1009+
retpkt.x = 0;
1010+
retpkt.y = 0;
1011+
break;
1012+
}
10081013

10091014
// Divide the total mouse XY axis values by number of mouse updates
10101015
retpkt.x = ( int16_t ) round( mouse_data.rmpkt.x / mouse_data.mouse_movt_ticker );

0 commit comments

Comments
 (0)