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

Sleep timer on F3 key

From: Tobi <nutzlos_at_gmx.net>
Date: Sun, 18 Jul 2004 22:05:24 +0200

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
_at__at_ -427,6 +427,7 _at__at_
     int w, h, key;
     char buf[32];
     int oldrepeat = global_settings.repeat_mode;
+ int seconds;
     
     /* just to stop compiler warning */
     context = context;
_at__at_ -496,11 +497,15 _at__at_
                 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);
_at__at_ -573,7 +578,11 _at__at_
 
             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
Received on 2004-07-18

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy