diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-04-09 19:21:02 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-04-09 19:21:02 -0400 |
commit | 13dbcab6c09d701e30addef4cadf3ea4af2774c7 (patch) | |
tree | e452f04a3cee977504889cc6564f83ae5c4b476d | |
parent | cd64aa2b10e81f17b0e62f90c7c473af9f95aee8 (diff) | |
download | rockbox-13dbcab6c0.tar.gz rockbox-13dbcab6c0.zip |
erosq: When mucking with the clickwheel, ensure we keep the screen awake!
Change-Id: I49d39f301f4b44c2477a657e2af964b97d73cf6b
-rw-r--r-- | firmware/drivers/button.c | 2 | ||||
-rw-r--r-- | firmware/target/hosted/button-devinput.c | 33 |
2 files changed, 30 insertions, 5 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 939f94884d..5addfee3de 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c @@ -687,7 +687,7 @@ static int button_read(void) status twice in a row. */ #ifndef HAVE_TOUCHSCREEN if (btn != last_read) - retval = lastbtn; + retval = lastbtn; else #endif retval = btn; diff --git a/firmware/target/hosted/button-devinput.c b/firmware/target/hosted/button-devinput.c index b1b4dfca5d..df2358579b 100644 --- a/firmware/target/hosted/button-devinput.c +++ b/firmware/target/hosted/button-devinput.c @@ -33,6 +33,22 @@ #include "button.h" #include "panic.h" +#ifdef HAVE_SCROLLWHEEL +#include "powermgmt.h" +#if defined(HAVE_BACKLIGHT) || defined(HAVE_BUTTON_LIGHT) +#include "backlight.h" +#endif +#endif /* HAVE_SCROLLWHEEL */ + +/* TODO: HAVE_SCROLLWHEEL is a hack. Instead of posting the exact number + of clicks, instead do it similar to the ipod clickwheel and post + the wheel angular velocity (degrees per second) + + * Track the relative position (ie based on click events) + * Use WHEELCLICKS_PER_ROTATION to convert clicks to angular distance + * Compute to angular velocity (degrees per second) + + */ #define NR_POLL_DESC 4 static int num_devices = 0; @@ -150,8 +166,17 @@ int button_read_device(void) } #ifdef HAVE_SCROLLWHEEL - // TODO: Is there a better way to handle this? - // TODO: enable BUTTON_REPEAT if the events happen quickly enough + /* Reset backlight and poweroff timers */ + if (wheel_ticks) { +#ifdef HAVE_BACKLIGHT + backlight_on(); +#endif +#ifdef HAVE_BUTTON_LIGHT + buttonlight_on(); +#endif + reset_poweroff_timer(); + } + if (wheel_ticks > 0) { while (wheel_ticks-- > 0) @@ -159,14 +184,14 @@ int button_read_device(void) queue_post(&button_queue, BUTTON_SCROLL_FWD, 0); } } - else + else if (wheel_ticks < 0) { while (wheel_ticks++ < 0) { queue_post(&button_queue, BUTTON_SCROLL_BACK, 0); } } -#endif +#endif /* HAVE_SCROLLWHEEL */ return button_bitmap; } |