diff options
Diffstat (limited to 'apps/menus/main_menu.c')
-rw-r--r-- | apps/menus/main_menu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c index 394ee7c343..66d49a920e 100644 --- a/apps/menus/main_menu.c +++ b/apps/menus/main_menu.c | |||
@@ -412,12 +412,14 @@ static const char* sleep_timer_formatter(char* buffer, size_t buffer_size, | |||
412 | 412 | ||
413 | static void sleep_timer_set(int minutes) | 413 | static void sleep_timer_set(int minutes) |
414 | { | 414 | { |
415 | if (minutes) | ||
416 | global_settings.sleeptimer_duration = minutes; | ||
415 | set_sleep_timer(minutes * 60); | 417 | set_sleep_timer(minutes * 60); |
416 | } | 418 | } |
417 | 419 | ||
418 | static int sleep_timer(void) | 420 | static int sleep_timer(void) |
419 | { | 421 | { |
420 | int minutes = (get_sleep_timer() + 59) / 60; /* round up */ | 422 | int minutes = get_sleep_timer() ? 0 : global_settings.sleeptimer_duration; |
421 | return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes, | 423 | return (int)set_int(str(LANG_SLEEP_TIMER), "", UNIT_MIN, &minutes, |
422 | &sleep_timer_set, 5, 0, 300, sleep_timer_formatter); | 424 | &sleep_timer_set, 5, 0, 300, sleep_timer_formatter); |
423 | } | 425 | } |
@@ -428,10 +430,14 @@ int time_screen(void* ignored); | |||
428 | MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), | 430 | MENUITEM_FUNCTION(timedate_item, MENU_FUNC_CHECK_RETVAL, ID2P(LANG_TIME_MENU), |
429 | time_screen, NULL, NULL, Icon_Menu_setting ); | 431 | time_screen, NULL, NULL, Icon_Menu_setting ); |
430 | #endif | 432 | #endif |
431 | /* This item is in the time/date screen if there is a RTC */ | 433 | /* Sleep timer items are in the time/date screen if there is a RTC */ |
432 | MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer, | 434 | MENUITEM_FUNCTION(sleep_timer_call, 0, ID2P(LANG_SLEEP_TIMER), sleep_timer, |
433 | NULL, NULL, Icon_Menu_setting); /* make it look like a | 435 | NULL, NULL, Icon_Menu_setting); /* make it look like a |
434 | setting to the user */ | 436 | setting to the user */ |
437 | #if CONFIG_RTC == 0 | ||
438 | MENUITEM_SETTING(sleeptimer_on_startup, | ||
439 | &global_settings.sleeptimer_on_startup, NULL); | ||
440 | #endif | ||
435 | 441 | ||
436 | MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS), | 442 | MENUITEM_FUNCTION(show_credits_item, 0, ID2P(LANG_CREDITS), |
437 | (menu_function)show_credits, NULL, NULL, Icon_NOICON); | 443 | (menu_function)show_credits, NULL, NULL, Icon_NOICON); |
@@ -479,7 +485,7 @@ MAKE_MENU(main_menu_, ID2P(LANG_SETTINGS), mainmenu_callback, | |||
479 | #if CONFIG_RTC | 485 | #if CONFIG_RTC |
480 | &timedate_item, | 486 | &timedate_item, |
481 | #else | 487 | #else |
482 | &sleep_timer_call, | 488 | &sleep_timer_call, &sleeptimer_on_startup, |
483 | #endif | 489 | #endif |
484 | &manage_settings, | 490 | &manage_settings, |
485 | ); | 491 | ); |