diff options
-rw-r--r-- | firmware/target/arm/as3525/sansa-e200v2/button-e200v2.c | 48 | ||||
-rw-r--r-- | firmware/target/arm/as3525/sansa-fuze/button-fuze.c | 43 |
2 files changed, 42 insertions, 49 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) |
diff --git a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c index afbba78074..f14e6f49c1 100644 --- a/firmware/target/arm/as3525/sansa-fuze/button-fuze.c +++ b/firmware/target/arm/as3525/sansa-fuze/button-fuze.c | |||
@@ -99,32 +99,29 @@ static void scrollwheel(short dbop_din) | |||
99 | old_btn = btn; | 99 | old_btn = btn; |
100 | repeat = counter = 0; | 100 | repeat = counter = 0; |
101 | } | 101 | } |
102 | if (btn != BUTTON_NONE) | 102 | /* wheel_delta will cause lists to jump over items, |
103 | * we want this for fast scrolling, but we must keep it accurate | ||
104 | * for slow scrolling */ | ||
105 | int wheel_delta = 0; | ||
106 | /* generate repeats if quick enough, scroll slightly faster too*/ | ||
107 | if (repeat > 1) | ||
103 | { | 108 | { |
104 | /* wheel_delta will cause lists to jump over items, | 109 | btn |= BUTTON_REPEAT; |
105 | * we want this for fast scrolling, but we must keep it accurate | 110 | wheel_delta = repeat>>2; |
106 | * for slow scrolling */ | 111 | } |
107 | int wheel_delta = 0; | ||
108 | /* generate repeats if quick enough, scroll slightly faster too*/ | ||
109 | if (repeat > 1) | ||
110 | { | ||
111 | btn |= BUTTON_REPEAT; | ||
112 | wheel_delta = repeat>>2; | ||
113 | } | ||
114 | 112 | ||
115 | repeat += 2; | 113 | repeat += 2; |
116 | 114 | ||
117 | /* the wheel is more reliable if we don't send ever change, | 115 | /* the wheel is more reliable if we don't send ever change, |
118 | * every 4th is basically one "physical click" is 1 item in | 116 | * every 4th is basically one "physical click" is 1 item in |
119 | * the rockbox menus */ | 117 | * the rockbox menus */ |
120 | if (++counter >= 4 && queue_empty(&button_queue)) | 118 | if (++counter >= 4 && queue_empty(&button_queue)) |
121 | { | 119 | { |
122 | buttonlight_on(); | 120 | buttonlight_on(); |
123 | backlight_on(); | 121 | backlight_on(); |
124 | queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); | 122 | queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); |
125 | /* message posted - reset count */ | 123 | /* message posted - reset count */ |
126 | counter = 0; | 124 | counter = 0; |
127 | } | ||
128 | } | 125 | } |
129 | } | 126 | } |
130 | if (repeat > 0) | 127 | if (repeat > 0) |