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