Skip to content

Commit 010dfe8

Browse files
committed
fix keepawake interfering with mouse movement
1 parent 5ef975c commit 010dfe8

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

firmware/src/mouse.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,22 @@ void update_mouse(void)
7979
/* Signal a new report */
8080
g_mouse_service = 1;
8181
}
82+
} else {
83+
/* Signal a final report before halting movement */
84+
if (g_mouse_active)
85+
g_mouse_service = 1;
86+
/* When the user lifts up their fingers, reset everything */
87+
g_mouse_active = 0;
88+
g_cumulative_count = 0;
89+
g_mouse_report_X = 0;
90+
g_mouse_report_Y = 0;
91+
/* If we have stopped controlling the mouse, get ready for a fast response
92+
when we start up again. The nature of the algorithm that splits up requests
93+
over the mouse cycle puts small requests at the end of the cycle. */
94+
g_slot = MOUSE_CYCLES;
8295
}
83-
else if (g_keepawake_flag)
96+
97+
if (!g_mouse_active && g_keepawake_flag)
8498
{
8599
switch (g_jiggle_count)
86100
{
@@ -113,19 +127,6 @@ void update_mouse(void)
113127
g_jiggle_count--;
114128
break;
115129
}
116-
} else {
117-
/* Signal a final report before halting movement */
118-
if (g_mouse_active)
119-
g_mouse_service = 1;
120-
/* When the user lifts up their fingers, reset everything */
121-
g_mouse_active = 0;
122-
g_cumulative_count = 0;
123-
g_mouse_report_X = 0;
124-
g_mouse_report_Y = 0;
125-
/* If we have stopped controlling the mouse, get ready for a fast response
126-
when we start up again. The nature of the algorithm that splits up requests
127-
over the mouse cycle puts small requests at the end of the cycle. */
128-
g_slot = MOUSE_CYCLES;
129130
}
130131
}
131132

0 commit comments

Comments
 (0)