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-13dbcab6c09d701e30addef4cadf3ea4af2774c7.tar.gz rockbox-13dbcab6c09d701e30addef4cadf3ea4af2774c7.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) | |||
687 | status twice in a row. */ | 687 | status twice in a row. */ |
688 | #ifndef HAVE_TOUCHSCREEN | 688 | #ifndef HAVE_TOUCHSCREEN |
689 | if (btn != last_read) | 689 | if (btn != last_read) |
690 | retval = lastbtn; | 690 | retval = lastbtn; |
691 | else | 691 | else |
692 | #endif | 692 | #endif |
693 | retval = btn; | 693 | 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 @@ | |||
33 | #include "button.h" | 33 | #include "button.h" |
34 | #include "panic.h" | 34 | #include "panic.h" |
35 | 35 | ||
36 | #ifdef HAVE_SCROLLWHEEL | ||
37 | #include "powermgmt.h" | ||
38 | #if defined(HAVE_BACKLIGHT) || defined(HAVE_BUTTON_LIGHT) | ||
39 | #include "backlight.h" | ||
40 | #endif | ||
41 | #endif /* HAVE_SCROLLWHEEL */ | ||
42 | |||
43 | /* TODO: HAVE_SCROLLWHEEL is a hack. Instead of posting the exact number | ||
44 | of clicks, instead do it similar to the ipod clickwheel and post | ||
45 | the wheel angular velocity (degrees per second) | ||
46 | |||
47 | * Track the relative position (ie based on click events) | ||
48 | * Use WHEELCLICKS_PER_ROTATION to convert clicks to angular distance | ||
49 | * Compute to angular velocity (degrees per second) | ||
50 | |||
51 | */ | ||
36 | #define NR_POLL_DESC 4 | 52 | #define NR_POLL_DESC 4 |
37 | 53 | ||
38 | static int num_devices = 0; | 54 | static int num_devices = 0; |
@@ -150,8 +166,17 @@ int button_read_device(void) | |||
150 | } | 166 | } |
151 | 167 | ||
152 | #ifdef HAVE_SCROLLWHEEL | 168 | #ifdef HAVE_SCROLLWHEEL |
153 | // TODO: Is there a better way to handle this? | 169 | /* Reset backlight and poweroff timers */ |
154 | // TODO: enable BUTTON_REPEAT if the events happen quickly enough | 170 | if (wheel_ticks) { |
171 | #ifdef HAVE_BACKLIGHT | ||
172 | backlight_on(); | ||
173 | #endif | ||
174 | #ifdef HAVE_BUTTON_LIGHT | ||
175 | buttonlight_on(); | ||
176 | #endif | ||
177 | reset_poweroff_timer(); | ||
178 | } | ||
179 | |||
155 | if (wheel_ticks > 0) | 180 | if (wheel_ticks > 0) |
156 | { | 181 | { |
157 | while (wheel_ticks-- > 0) | 182 | while (wheel_ticks-- > 0) |
@@ -159,14 +184,14 @@ int button_read_device(void) | |||
159 | queue_post(&button_queue, BUTTON_SCROLL_FWD, 0); | 184 | queue_post(&button_queue, BUTTON_SCROLL_FWD, 0); |
160 | } | 185 | } |
161 | } | 186 | } |
162 | else | 187 | else if (wheel_ticks < 0) |
163 | { | 188 | { |
164 | while (wheel_ticks++ < 0) | 189 | while (wheel_ticks++ < 0) |
165 | { | 190 | { |
166 | queue_post(&button_queue, BUTTON_SCROLL_BACK, 0); | 191 | queue_post(&button_queue, BUTTON_SCROLL_BACK, 0); |
167 | } | 192 | } |
168 | } | 193 | } |
169 | #endif | 194 | #endif /* HAVE_SCROLLWHEEL */ |
170 | 195 | ||
171 | return button_bitmap; | 196 | return button_bitmap; |
172 | } | 197 | } |