summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c')
-rw-r--r--firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
index bc92995094..932ce2bada 100644
--- a/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
+++ b/firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c
@@ -100,33 +100,29 @@ static void scrollwheel(short dbop_din)
100 old_btn = btn; 100 old_btn = btn;
101 repeat = counter = 0; 101 repeat = counter = 0;
102 } 102 }
103 if (btn != BUTTON_NONE) 103 /* wheel_delta will cause lists to jump over items,
104 * we want this for fast scrolling, but we must keep it accurate
105 * for slow scrolling */
106 int wheel_delta = 0;
107 /* generate repeats if quick enough, scroll slightly too*/
108 if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL))
104 { 109 {
105 /* wheel_delta will cause lists to jump over items, 110 btn |= BUTTON_REPEAT;
106 * we want this for fast scrolling, but we must keep it accurate 111 wheel_delta = repeat>>2;
107 * for slow scrolling */ 112 }
108 int wheel_delta = 0; 113
109 /* generate repeats if quick enough, scroll slightly too*/ 114 repeat += 2;
110 if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL)) 115 /* the wheel is more reliable if we don't send ever change,
111 { 116 * every 2th is basically one "physical click" is
112 btn |= BUTTON_REPEAT; 117 * 1 item in the rockbox menus */
113 wheel_delta = repeat>>2; 118 if (++counter >= 2 && queue_empty(&button_queue))
114 } 119 {
115 120 buttonlight_on();
116 repeat += 2; 121 backlight_on();
117 122 queue_post(&button_queue, btn, ((wheel_delta+1)<<24));
118 /* the wheel is more reliable if we don't send ever change, 123 /* message posted - reset count & last post to the queue */
119 * every 2th is basically one "physical click" is 124 counter = 0;
120 * 1 item in the rockbox menus */ 125 last_wheel_post = current_tick;
121 if (++counter >= 2 && queue_empty(&button_queue))
122 {
123 buttonlight_on();
124 backlight_on();
125 queue_post(&button_queue, btn, ((wheel_delta+1)<<24));
126 /* message posted - reset count & last post to the queue */
127 counter = 0;
128 last_wheel_post = current_tick;
129 }
130 } 126 }
131 } 127 }
132 if (repeat > 0) 128 if (repeat > 0)