Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Sleep timer on F3 key
From: Tobi (nutzlos_at_gmx.net)
Date: 2004-07-18


Hello,

maybe someone is interested in this small patch, which replaces the
useless scrollbar option with the sleep timer setting option. The
longest sleep time you can set with this is one hour. If you want to
change this just edit this line:
seconds = ((seconds / 15)*15 + 15) % 75;
e.g. for one and a half hour:
seconds = ((seconds / 15)*15 + 15) % 105;

To use it, copy the screens.patch file into the apps (I have used daily
src from 2004/07/18) directory and apply it with:
patch -p0 <screens.patch

Regards,
Boris


--- screens.c 2004-06-27 06:00:08.000000000 +0200
+++ screens.c 2004-07-18 20:56:22.000000000 +0200
@@ -427,6 +427,7 @@
     int w, h, key;
     char buf[32];
     int oldrepeat = global_settings.repeat_mode;
+ int seconds;
     
     /* just to stop compiler warning */
     context = context;
@@ -496,11 +497,15 @@
                 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
                 break;
             case BUTTON_F3:
- /* Scrollbar */
- lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_F3_SCROLL));
- lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_F3_BAR));
- lcd_putsxy(0, LCD_HEIGHT/2,
- global_settings.scrollbar ? str(LANG_ON) : str(LANG_OFF));
+ /* Sleep Timer */
+ lcd_putsxy(0, LCD_HEIGHT/2 - h*2, str(LANG_SLEEP_TIMER));
+ seconds = get_sleep_timer() + 59;
+ if (seconds == 59)
+ lcd_putsxy(0, LCD_HEIGHT/2 - h, str(LANG_OFF));
+ else{
+ snprintf(buf, 32, "%d:%02d", seconds / 3600, (seconds / 60) % 60);
+ lcd_putsxy(0, LCD_HEIGHT/2 - h, buf);
+ }
     
                 /* Status bar */
                 ptr = str(LANG_F3_STATUS);
@@ -573,7 +578,11 @@
 
             case BUTTON_F3 | BUTTON_LEFT:
             case BUTTON_F3 | BUTTON_LEFT | BUTTON_REPEAT:
- global_settings.scrollbar = !global_settings.scrollbar;
+ /* Sleep Timer*/
+ seconds = get_sleep_timer() + 59;
+ seconds = seconds / 60 + 1;
+ seconds = ((seconds / 15)*15 + 15) % 75;
+ set_sleep_timer(seconds * 60);
                 used = true;
                 break;
 


_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa