summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-04-09 08:30:05 +0000
committerThomas Martitz <kugel@rockbox.org>2009-04-09 08:30:05 +0000
commit7ce12e62aa348adcd155e11b9d676150cb78ef72 (patch)
treea3d08e368b32dfcae93ff71e36ddc0c4bd4e36c8 /apps
parenta7e112c8d9596ce27240237cf372abe2c039e2d1 (diff)
downloadrockbox-7ce12e62aa348adcd155e11b9d676150cb78ef72.zip
rockbox-7ce12e62aa348adcd155e11b9d676150cb78ef72.tar.gz
rockbox-7ce12e62aa348adcd155e11b9d676150cb78ef72.tar.bz2
rockbox-7ce12e62aa348adcd155e11b9d676150cb78ef72.tar.xz
FS#8523 - Disable WPS updating when the backlight is off.
Disables WPS updating when the lcd is inactive (sleep or disabled, backlight doesn't count in), which prevents a good deal of code from running uselessly. According to tests, it can yield up to 1h more battery life in cases of heavy WPSes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20666 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/gwps.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/apps/gui/gwps.c b/apps/gui/gwps.c
index 68f0ba2..1ff5410 100644
--- a/apps/gui/gwps.c
+++ b/apps/gui/gwps.c
@@ -208,6 +208,20 @@ static void gwps_fix_statusbars(void)
#endif
}
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+/*
+ * If the user is unable to see the wps, because the display is deactivated,
+ * we surpress updates until the wps gets actived again (the lcd driver will
+ * call this hook)
+ * */
+static void wps_lcd_activation_hook(void)
+{
+ /* issue an update */
+ wps_state.do_full_update = true;
+ /* force timeout in wps main loop, so that the update is instantly */
+ queue_post(&button_queue, BUTTON_NONE, 0);
+}
+#endif
static void gwps_leave_wps(void)
{
@@ -225,6 +239,10 @@ static void gwps_leave_wps(void)
show_remote_main_backdrop();
#endif
viewportmanager_set_statusbar(oldbars);
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+ /* Play safe and unregister the hook */
+ lcd_activation_set_hook(NULL);
+#endif
}
void gwps_draw_statusbars(void)
@@ -663,8 +681,17 @@ long gui_wps_show(void)
if (wps_state.do_full_update || update)
{
FOR_NB_SCREENS(i)
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+ if (lcd_active()
+#ifdef HAVE_REMOTE_LCD
+ /* currently, all remotes are readable without backlight
+ * so still update those */
+ && (i == SCREEN_MAIN)
+#endif
+ )
+#endif
{
- gui_wps_update(&gui_wps[i]);
+ gui_wps_update(&gui_wps[i]);
}
wps_state.do_full_update = false;
update = false;
@@ -677,6 +704,9 @@ long gui_wps_show(void)
restore = false;
restoretimer = RESTORE_WPS_INSTANTLY;
gwps_fix_statusbars();
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+ lcd_activation_set_hook(wps_lcd_activation_hook);
+#endif
FOR_NB_SCREENS(i)
{
screens[i].stop_scroll();