Add set_sleeptimer_duration function in minutes
Make set_sleep_timer a static function and only call set_sleeptimer_duration externally, which is always called with minutes values. Change-Id: I985308bf014e354f91c47a0b2bf62f4f5a591919 Reviewed-on: http://gerrit.rockbox.org/327 Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
This commit is contained in:
parent
9ee396b846
commit
71f70112b2
5 changed files with 12 additions and 6 deletions
|
@ -438,8 +438,8 @@ static int sleep_timer_voice(int selected_item, void*data)
|
|||
/* If a sleep timer is running, cancel it, otherwise start one */
|
||||
static int toggle_sleeptimer(void)
|
||||
{
|
||||
set_sleep_timer(get_sleep_timer() ? 0
|
||||
: global_settings.sleeptimer_duration * 60);
|
||||
set_sleeptimer_duration(get_sleep_timer() ? 0
|
||||
: global_settings.sleeptimer_duration);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -842,7 +842,7 @@ void settings_apply(bool read_disk)
|
|||
#endif
|
||||
set_poweroff_timeout(global_settings.poweroff);
|
||||
if (global_settings.sleeptimer_on_startup)
|
||||
set_sleep_timer(global_settings.sleeptimer_duration * 60);
|
||||
set_sleeptimer_duration(global_settings.sleeptimer_duration);
|
||||
set_keypress_restarts_sleep_timer(
|
||||
global_settings.keypress_restarts_sleeptimer);
|
||||
|
||||
|
|
|
@ -528,7 +528,7 @@ int do_shortcut_menu(void *ignored)
|
|||
#endif
|
||||
{
|
||||
char timer_buf[10];
|
||||
set_sleep_timer(sc->u.timedata.sleep_timeout * 60);
|
||||
set_sleeptimer_duration(sc->u.timedata.sleep_timeout);
|
||||
splashf(HZ, "%s (%s)", str(LANG_SLEEP_TIMER),
|
||||
sleep_timer_formatter(timer_buf, sizeof(timer_buf),
|
||||
sc->u.timedata.sleep_timeout, NULL));
|
||||
|
|
|
@ -167,7 +167,7 @@ void set_battery_capacity(int capacity); /* set local battery capacity value */
|
|||
int get_battery_capacity(void); /* get local battery capacity value */
|
||||
void set_battery_type(int type); /* set local battery type */
|
||||
|
||||
void set_sleep_timer(int seconds);
|
||||
void set_sleeptimer_duration(int minutes);
|
||||
int get_sleep_timer(void);
|
||||
void set_keypress_restarts_sleep_timer(bool enable);
|
||||
void handle_auto_poweroff(void);
|
||||
|
|
|
@ -60,6 +60,7 @@ int last_sent_battery_level = 100;
|
|||
/* battery level (0-100%) */
|
||||
int battery_percent = -1;
|
||||
void send_battery_level_event(void);
|
||||
static void set_sleep_timer(int seconds);
|
||||
|
||||
static bool sleeptimer_active = false;
|
||||
static long sleeptimer_endtick;
|
||||
|
@ -863,7 +864,12 @@ void send_battery_level_event(void)
|
|||
}
|
||||
}
|
||||
|
||||
void set_sleep_timer(int seconds)
|
||||
void set_sleeptimer_duration(int minutes)
|
||||
{
|
||||
set_sleep_timer(minutes * 60);
|
||||
}
|
||||
|
||||
static void set_sleep_timer(int seconds)
|
||||
{
|
||||
if (seconds) {
|
||||
sleeptimer_active = true;
|
||||
|
|
Loading…
Reference in a new issue