diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-04-19 17:05:36 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-04-19 17:05:36 +0000 |
commit | aef5731d719fe334039dda1c2f5c589da9401253 (patch) | |
tree | 23dbf5170ee433124a2c35d96e33bb8edc856911 /firmware | |
parent | 19fde6c0c09b9f584b9f201599f738136894144b (diff) |
FS#10148 by Dustin Skoracki, removes a redundant check for != BUTTON_NONE in the scrollwheel drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20744 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-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) old_btn = btn; repeat = counter = 0; } - if (btn != BUTTON_NONE) + /* wheel_delta will cause lists to jump over items, + * we want this for fast scrolling, but we must keep it accurate + * for slow scrolling */ + int wheel_delta = 0; + /* generate repeats if quick enough, scroll slightly too*/ + if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL)) { - /* wheel_delta will cause lists to jump over items, - * we want this for fast scrolling, but we must keep it accurate - * for slow scrolling */ - int wheel_delta = 0; - /* generate repeats if quick enough, scroll slightly too*/ - if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL)) - { - btn |= BUTTON_REPEAT; - wheel_delta = repeat>>2; - } - - repeat += 2; - - /* the wheel is more reliable if we don't send ever change, - * every 2th is basically one "physical click" is - * 1 item in the rockbox menus */ - if (++counter >= 2 && queue_empty(&button_queue)) - { - buttonlight_on(); - backlight_on(); - queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); - /* message posted - reset count & last post to the queue */ - counter = 0; - last_wheel_post = current_tick; - } + btn |= BUTTON_REPEAT; + wheel_delta = repeat>>2; + } + + repeat += 2; + /* the wheel is more reliable if we don't send ever change, + * every 2th is basically one "physical click" is + * 1 item in the rockbox menus */ + if (++counter >= 2 && queue_empty(&button_queue)) + { + buttonlight_on(); + backlight_on(); + queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); + /* message posted - reset count & last post to the queue */ + counter = 0; + last_wheel_post = current_tick; } } 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) old_btn = btn; repeat = counter = 0; } - if (btn != BUTTON_NONE) + /* wheel_delta will cause lists to jump over items, + * we want this for fast scrolling, but we must keep it accurate + * for slow scrolling */ + int wheel_delta = 0; + /* generate repeats if quick enough, scroll slightly faster too*/ + if (repeat > 1) { - /* wheel_delta will cause lists to jump over items, - * we want this for fast scrolling, but we must keep it accurate - * for slow scrolling */ - int wheel_delta = 0; - /* generate repeats if quick enough, scroll slightly faster too*/ - if (repeat > 1) - { - btn |= BUTTON_REPEAT; - wheel_delta = repeat>>2; - } + btn |= BUTTON_REPEAT; + wheel_delta = repeat>>2; + } - repeat += 2; + repeat += 2; - /* the wheel is more reliable if we don't send ever change, - * every 4th is basically one "physical click" is 1 item in - * the rockbox menus */ - if (++counter >= 4 && queue_empty(&button_queue)) - { - buttonlight_on(); - backlight_on(); - queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); - /* message posted - reset count */ - counter = 0; - } + /* the wheel is more reliable if we don't send ever change, + * every 4th is basically one "physical click" is 1 item in + * the rockbox menus */ + if (++counter >= 4 && queue_empty(&button_queue)) + { + buttonlight_on(); + backlight_on(); + queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); + /* message posted - reset count */ + counter = 0; } } if (repeat > 0) |