Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
Index: apps/action.c =================================================================== --- apps/action.c (Revision 30969) +++ apps/action.c (Arbeitskopie) @@ -151,6 +151,10 @@ } #if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ) + +/* Timeout for gui boost in seconds. */ +#define GUI_BOOST_TIMEOUT (HZ) + /* Helper function which is called to boost / unboost CPU. This function * avoids to increase boost_count with each call of gui_boost(). */ static void gui_boost(bool want_to_boost) @@ -168,6 +172,15 @@ boosted = false; } } + +/* gui_unboost_callback() is called GUI_BOOST_TIMEOUT seconds after the + * last wheel scrolling event. */ +static int gui_unboost_callback(struct timeout *tmo) +{ + (void)tmo; + gui_boost(false); + return 0; +} #endif /* @@ -194,7 +207,6 @@ int ret = ACTION_UNKNOWN; static int last_context = CONTEXT_STD; - send_event(GUI_EVENT_ACTIONUPDATE, NULL); if (timeout == TIMEOUT_NOBLOCK) @@ -205,20 +217,16 @@ button = button_get_w_tmo(timeout); #if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ) - /* Boost the CPU in case of wheel scrolling activity in the defined contexts. - * Unboost the CPU after timeout. */ - static long last_boost_tick; + static struct timeout gui_unboost; + /* Boost the CPU in case of wheel scrolling activity in the defined contexts. + * Call unboost with a timeout of GUI_BOOST_TIMEOUT. */ if ((button&(BUTTON_SCROLL_BACK|BUTTON_SCROLL_FWD)) && (context == CONTEXT_STD || context == CONTEXT_LIST || context == CONTEXT_MAINMENU || context == CONTEXT_TREE)) { - last_boost_tick = current_tick; gui_boost(true); + timeout_register(&gui_unboost, gui_unboost_callback, GUI_BOOST_TIMEOUT, 0); } - else if (TIME_AFTER(current_tick, last_boost_tick + HZ)) - { - gui_boost(false); - } #endif /* Data from sys events can be pulled with button_get_data Index: firmware/export/config.h =================================================================== --- firmware/export/config.h (Revision 30969) +++ firmware/export/config.h (Arbeitskopie) @@ -983,6 +983,11 @@ #define INCLUDE_TIMEOUT_API #endif /* HAVE_USB_CHARGING_ENABLE && HAVE_USBSTACK */ +#if defined(HAVE_GUI_BOOST) && defined(HAVE_ADJUSTABLE_CPU_FREQ) +/* Timeout objects required if GUI boost is enabled */ +#define INCLUDE_TIMEOUT_API +#endif /* HAVE_GUI_BOOST && HAVE_ADJUSTABLE_CPU_FREQ */ + #if defined(HAVE_USBSTACK) || (CONFIG_STORAGE & STORAGE_NAND) #define STORAGE_GET_INFO #endif |